
*{box-sizing:border-box}

:root{
  --bg-main:#f4f6fb;
  --bg-surface:#ffffff;
  --bg-soft:#f1f5f9;

  --border:#e2e8f0;
  --border-soft:#cbd5e1;

  --text-main:#0f172a;
  --text-muted:#64748b;

  --primary:#2563eb;
  --primary-soft:#e0e7ff;
}

body.dark{
  --bg-main:#0b1020;
  --bg-surface:#020617;
  --bg-soft:#020617;

  --border:#1e293b;
  --border-soft:#334155;

  --text-main:#e5e7eb;
  --text-muted:#94a3b8;

  --primary:#60a5fa;
  --primary-soft:#1e293b;
}

/* ===== Base ===== */
body{
  margin:0;
  font-family:system-ui,Segoe UI,sans-serif;
  background:var(--bg-main);
  color:var(--text-main);
  overflow: hidden;
}

/* ===== App ===== */
.app{
  display:grid;
  grid-template-columns:260px 1fr;
  height:100vh;
}

/* ===== Sidebar ===== */
.sidebar{
  background:var(--bg-surface);
  border-right:1px solid var(--border);
  padding:1.2rem;

  display:flex;
  flex-direction:column;
  height:100vh;
}

.sidebar h1{
  font-size:1.1rem;
  margin:0 0 1.6rem;
}

/* ===== Nav ===== */
.nav button{
  width:100%;
  background:transparent;
  border:1px solid transparent;
  color:var(--text-muted);
  padding:.7rem .9rem;
  text-align:left;
  border-radius:12px;
  cursor:pointer;
  margin-bottom:.4rem;
  transition:.2s;
}

.nav button:hover{
  background:var(--bg-soft);
  color:var(--text-main);
}

.nav button.active{
  background:var(--primary-soft);
  color:var(--primary);
  border-color:#c7d2fe;
}

/* ===== Main ===== */
.main{
  padding:1.8rem;
  overflow-y:auto;
}

/* ===== Cards ===== */
.card{
  background:var(--bg-surface);
  border-radius:18px;
  padding:1.5rem;
  margin-bottom:1.6rem;
  border:1px solid var(--border);
  box-shadow:
    0 1px 2px rgba(15,23,42,.04),
    0 12px 28px rgba(15,23,42,.06);
}

/* ===== Carros ===== */
.carros{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:1rem;
  margin-top:1rem;
}

/* Card base */
.carro{
  position:relative;
  background:var(--bg-soft);
  border:2px solid var(--border);
  border-radius:20px;
  padding:.9rem;

  display:flex;
  gap:.9rem;
  align-items:center;

  cursor:pointer;
  transition:
    border-color .2s ease,
    background .2s ease,
    transform .15s ease;
}

/* Hover */
.carro:hover{
  border-color:var(--primary);
  transform:translateY(-1px);
}

/* Selecionado (seu padrão mantido) */
.carro.active{
  border-color:var(--primary);
  background:linear-gradient(
    135deg,
    var(--bg-soft),
    var(--primary-soft)
  );
}

/* Imagem */
.carro img{
  width:56px;
  height:56px;
  border-radius:14px;
  object-fit:cover;
  flex-shrink:0;
}

/* Textos */
.carro strong{
  display:block;
  font-size:.95rem;
  line-height:1.2;
  color:var(--text-main);
}

.carro span{
  font-size:.7rem;
  color:var(--text-muted);
  text-transform:uppercase;
  letter-spacing:.06em;
}

/* Input invisível (mantido por semântica) */
.carro input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}

/* Realce sutil no texto quando ativo */
.carro.active strong{
  color:var(--primary);
}

/* Responsivo */
@media(max-width:500px){
  .carros{
    grid-template-columns:1fr;
  }
}

/* ===== Hospedagem – Botão adicionar ===== */
.hospedagem-header button{
  background:var(--bg-soft);
  border:1px solid var(--border);
  color:var(--text-main);
  padding:.6rem 1rem;
  border-radius:12px;
  cursor:pointer;
  font-size:.85rem;
  font-weight:500;
  transition:.2s;
  white-space:nowrap;
}

.hospedagem-header button:hover{
  background:var(--primary-soft);
  color:var(--primary);
  border-color:#c7d2fe;
}

.gastos-pessoas{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(320px,1fr));
  gap:1.2rem;
}


/* ===== Modal – Overlay ===== */
.modal{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.45);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:1000;
}

.modal:not([hidden]){
  display:flex;
}

/* Tema escuro */
body.dark .modal{
  background:rgba(0,0,0,.65);
}

/* ===== Modal – Conteúdo ===== */
.modal .modal-content{
  width:100%;
  max-width:420px;
  background:var(--bg-surface);
  border:1px solid var(--border);
  border-radius:20px;
  padding:1.5rem;
  box-shadow:
    0 10px 28px rgba(15,23,42,.18),
    0 1px 2px rgba(15,23,42,.05);
}

.modal h3{
  margin-top:0;
  margin-bottom:1.2rem;
  font-size:1.05rem;
}

.modal label{
  font-size:.75rem;
  color:var(--text-muted);
  text-transform:uppercase;
  letter-spacing:.06em;
}

.modal input{
  width:100%;
  margin-top:.4rem;
  padding:.6rem .7rem;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--bg-soft);
  color:var(--text-main);
}

#modalHospedagem input:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 2px var(--primary-soft);
}

/* ===== Ações ===== */
.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:.6rem;
  margin-top:1.4rem;
}

.modal-actions button{
  padding:.55rem 1rem;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--bg-soft);
  color:var(--text-main);
  cursor:pointer;
  font-weight:500;
  transition:.2s;
}

/* Cancelar */
.modal-actions button.cancel{
  color:var(--text-muted);
}

.modal-actions button.cancel:hover{
  background:var(--bg-main);
}

/* Salvar */
.modal-actions button.primary{
  background:var(--primary-soft);
  color:var(--primary);
  border-color:#c7d2fe;
}

.modal-actions button.primary:hover{
  background:var(--primary);
  color:#fff;
}

/* ===== Hospedagem (Cards) ===== */
.hospedagem{
  display:flex;
  flex-direction:column;
  gap:1rem;
}

/* ===== Hospedagem – Header ===== */
.hospedagem-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
}

.hospedagem-cards{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
  gap:1.2rem;
}

.stay-card{
  background:var(--bg-soft);
  border:1px solid var(--border);
  border-radius:18px;
  overflow:hidden;
  cursor:pointer;
  transition:border-color .2s ease, box-shadow .2s ease, transform .15s ease;
}

.stay-card:hover{
  border-color:var(--border-soft);
  transform:translateY(-2px);
}

.stay-card.active{
  border-color:var(--primary);
  box-shadow:0 0 0 2px var(--primary-soft);
}

.stay-card img{
  width:100%;
  height:140px;
  object-fit:cover;
  display:block;
}

.stay-info{
  padding:1rem;
  display:flex;
  flex-direction:column;
  gap:.4rem;
}

.stay-info strong{
  font-size:.95rem;
  color:var(--text-main);
}

.stay-info span{
  font-size:.85rem;
  color:var(--text-muted);
}

.stay-info a{
  font-size:.8rem;
  color:var(--primary);
  text-decoration:none;
  width:max-content;
}

.stay-info a:hover{
  text-decoration:underline;
}

/* ===== Hospedagem – Total por pessoa ===== */
.hospedagem-total{
  margin-top:1.4rem;
  padding:1.1rem 1.3rem;
  background:linear-gradient(
    135deg,
    var(--bg-soft),
    var(--bg-main)
  );
  border:1px solid var(--border);
  border-radius:18px;

  display:flex;
  justify-content:center;
  align-items:center;
}

/* Texto base */
.hospedagem-total strong{
  font-weight:500;
  font-size:.9rem;
  color:var(--text-muted);
  letter-spacing:.02em;
}

/* Valor */
.hospedagem-total span{
  margin-left:.5rem;
  font-size:1.45rem;
  font-weight:600;
  color:var(--text-main);
}

/* Tema escuro */
body.dark .hospedagem-total{
  box-shadow:0 10px 28px rgba(0,0,0,.25);
}

/* Mobile */
@media(max-width:600px){
  .hospedagem-total{
    padding:1rem;
  }

  .hospedagem-total span{
    font-size:1.25rem;
  }
}

/* ===== Routes ===== */
.route{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:1rem;
  margin-bottom:1.6rem;
}

.route div{
  background:var(--bg-soft);
  border:1px solid var(--border);
  border-radius:18px;
  padding:1rem;
}

.route span{
  font-size:.7rem;
  color:var(--text-muted);
  text-transform:uppercase;
  letter-spacing:.05em;
}

.route p span{
  all: inherit;
  display: inline;
}

/* ===== Mobile ===== */
@media(max-width:700px){
  .route{
    grid-template-columns:1fr;
  }
}

/* ===== Tables ===== */
table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  background:var(--bg-surface);
  border-radius:16px;
  overflow:hidden;
  border:1px solid var(--border);
}

th,td{
  padding:.75rem;
  border-bottom:1px solid var(--border);
  text-align:center;
  font-size:.85rem;
}

th{
  background:var(--bg-soft);
  color:var(--text-muted);
  font-weight:600;
}

tbody tr:last-child td{
  border-bottom:none;
}

tbody tr:hover{
  background:#999;
}

/* ===== Mobile ===== */
@media(max-width:900px){
  .app{grid-template-columns:1fr}
  .sidebar{
    display:flex;
    gap:.5rem;
    align-items:center;
  }
  .nav button{text-align:center}
}

/* ===== Theme Toggle ===== */
.theme-toggle{
  margin-top:auto;
  padding-top:1.2rem;
  border-top:1px solid var(--border);
}

.theme-toggle button{
  width:100%;
  background:var(--bg-soft);
  border:1px solid var(--border);
  color:var(--text-main);
  padding:.7rem;
  border-radius:12px;
  cursor:pointer;
  font-weight:500;
  transition:.2s;
}

.theme-toggle button:hover{
  background:var(--primary-soft);
  color:var(--primary);
}

#gasto-pessoa {
  width: 100%;
  margin-top: .4rem;
  padding: .6rem .7rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-main);
}