/* ===========================================================
   TravelFlow — design tokens
   Paleta: base papel quente + "azul-oceano" (viagem) + coral pôr-do-sol
   Tipografia: Fraunces (display) + Inter (UI) + IBM Plex Mono (códigos)
=========================================================== */
:root{
  --bg: #F6F4EF;
  --surface: #FFFFFF;
  --surface-2: #FBFAF7;
  --border: #E4E0D3;
  --text: #1C2321;
  --text-muted: #6B7280;
  --primary: #1B6E6E;
  --primary-dark: #114E4E;
  --primary-soft: #E4F1F0;
  --accent: #FF7A45;
  --accent-soft: #FFE9DD;
  --success: #2E9E5B;
  --success-soft: #E3F5EA;
  --warning: #C98A1F;
  --warning-soft: #FBF1DD;
  --danger: #D9534F;
  --danger-soft: #FBE7E6;
  --hotel: #7C5CBF;
  --aereo: #1B6E6E;
  --carro: #C98A1F;
  --seguro: #D9534F;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(28,35,33,.06);
  --shadow: 0 8px 24px rgba(28,35,33,.08);
  --shadow-lg: 0 16px 48px rgba(28,35,33,.14);
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}
body.theme-dark{
  --bg: #10151A;
  --surface: #1A2129;
  --surface-2: #202932;
  --border: #2B3540;
  --text: #E8EBEE;
  --text-muted: #93A0AC;
  --primary: #3FA5A0;
  --primary-dark: #2C7A76;
  --primary-soft: #17302E;
  --accent: #FF9166;
  --accent-soft: #3A2A22;
  --success: #4FC181;
  --success-soft: #17301F;
  --warning: #E0AC4C;
  --warning-soft: #332A16;
  --danger: #F0817D;
  --danger-soft: #351E1D;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
}

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0; background:var(--bg); color:var(--text);
  font-family:var(--font-body); font-size:15px; line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3{font-family:var(--font-display); font-weight:600; margin:0;}
button,input,select,textarea{font-family:inherit; font-size:inherit; color:inherit;}
a{color:inherit;}
::selection{background:var(--accent-soft);}
:focus-visible{outline:2px solid var(--primary); outline-offset:2px;}
@media (prefers-reduced-motion: reduce){ *{animation:none !important; transition:none !important;} }

/* ---------- App shell ---------- */
.shell{ display:flex; min-height:100vh; }
.sidebar{
  width:250px; flex:none; background:var(--surface); border-right:1px solid var(--border);
  padding:20px 16px; display:flex; flex-direction:column; gap:18px; position:sticky; top:0; height:100vh;
}
.brand{ display:flex; align-items:center; gap:10px; padding:4px 4px 10px; }
.brand-mark{
  width:38px; height:38px; border-radius:11px; background:linear-gradient(135deg,var(--primary),var(--primary-dark));
  color:#fff; display:flex; align-items:center; justify-content:center; font-size:18px; flex:none;
}
.brand-text strong{ display:block; font-family:var(--font-display); font-size:17px; }
.brand-text span{ display:block; font-size:11.5px; color:var(--text-muted); }
.nav{ display:flex; flex-direction:column; gap:2px; flex:1; }
.nav-item{
  display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:var(--radius-sm);
  color:var(--text-muted); text-decoration:none; cursor:pointer; border:none; background:none; text-align:left; width:100%;
  font-size:14px; font-weight:500;
}
.nav-item:hover{ background:var(--surface-2); color:var(--text); }
.nav-item.active{ background:var(--primary-soft); color:var(--primary-dark); }
.nav-item .ic{ font-size:17px; width:20px; text-align:center; }
.nav-badge{ margin-left:auto; background:var(--accent); color:#fff; font-size:10.5px; font-weight:700; padding:1px 6px; border-radius:20px; }

.btn-block{ width:100%; }
.btn-primary{
  background:var(--primary); color:#fff; border:none; padding:11px 16px; border-radius:var(--radius-sm);
  font-weight:600; cursor:pointer; font-size:14px; transition:background .15s, transform .1s;
}
.btn-primary:hover{ background:var(--primary-dark); }
.btn-primary:active{ transform:scale(.98); }
.btn-ghost{
  background:none; border:1px solid var(--border); color:var(--text); padding:10px 16px; border-radius:var(--radius-sm);
  font-weight:600; cursor:pointer; font-size:14px;
}
.btn-ghost:hover{ background:var(--surface-2); }
.btn-danger{ background:var(--danger-soft); color:var(--danger); border:none; padding:10px 16px; border-radius:var(--radius-sm); font-weight:600; cursor:pointer; }
.btn-sm{ padding:7px 12px; font-size:13px; border-radius:8px; }
.btn-icon{ background:var(--surface-2); border:1px solid var(--border); border-radius:8px; width:34px; height:34px; cursor:pointer; }

.main{ flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar{
  display:flex; align-items:center; gap:14px; padding:16px 28px; border-bottom:1px solid var(--border);
  background:var(--bg); position:sticky; top:0; z-index:5;
}
.topbar-title{ flex:1; min-width:0; }
.eyebrow{ margin:0; font-size:11.5px; text-transform:uppercase; letter-spacing:.08em; color:var(--text-muted); font-weight:600; }
#pageTitle{ font-size:22px; }
.top-actions{ display:flex; align-items:center; gap:10px; }
.icon-button{
  width:36px; height:36px; border-radius:50%; border:1px solid var(--border); background:var(--surface);
  cursor:pointer; font-size:16px; display:flex; align-items:center; justify-content:center;
}
.profile-pill{
  display:flex; align-items:center; gap:8px; background:var(--surface); border:1px solid var(--border);
  padding:5px 12px 5px 5px; border-radius:30px; cursor:pointer;
}
.profile-pill span{
  width:26px; height:26px; border-radius:50%; background:var(--primary); color:#fff; font-weight:700;
  font-size:12px; display:flex; align-items:center; justify-content:center;
}
.profile-pill b{ font-size:13px; font-weight:600; }
.only-mobile{ display:none; }

.view{ padding:24px 28px 100px; max-width:1200px; }

.bottom-nav{
  display:none; position:fixed; bottom:0; left:0; right:0; background:var(--surface); border-top:1px solid var(--border);
  padding:6px 4px calc(6px + env(safe-area-inset-bottom)); z-index:20; box-shadow:0 -4px 16px rgba(0,0,0,.06);
}

/* ---------- Responsivo ---------- */
@media (max-width: 860px){
  .sidebar{ display:none; }
  .only-mobile{ display:flex; }
  .bottom-nav{ display:flex; justify-content:space-around; }
  .view{ padding:16px 14px 90px; }
  .topbar{ padding:14px 16px; }
  #pageTitle{ font-size:19px; }
  .profile-pill b{ display:none; }
}
.bn-item{
  flex:1; display:flex; flex-direction:column; align-items:center; gap:2px; padding:6px 2px; border:none;
  background:none; color:var(--text-muted); font-size:10.5px; font-weight:600; cursor:pointer;
}
.bn-item .ic{ font-size:19px; }
.bn-item.active{ color:var(--primary); }

/* ---------- Cards / Feed ---------- */
.card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow-sm); }
.section-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:16px; flex-wrap:wrap; }
.section-head h2{ font-size:19px; }
.stat-row{ display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; margin-bottom:22px; }
.stat-card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px; }
.stat-card .n{ font-family:var(--font-display); font-size:26px; font-weight:600; }
.stat-card .l{ font-size:12.5px; color:var(--text-muted); font-weight:600; text-transform:uppercase; letter-spacing:.04em; }

.filters{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:16px; }
.chip{
  padding:7px 14px; border-radius:30px; border:1px solid var(--border); background:var(--surface);
  font-size:13px; font-weight:600; cursor:pointer; color:var(--text-muted); white-space:nowrap;
}
.chip.active{ background:var(--primary); color:#fff; border-color:var(--primary); }

.trip-feed{ display:flex; flex-direction:column; gap:16px; }

/* Cartão de viagem — assinatura visual: cartão de embarque (boarding pass) */
.trip-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg);
  box-shadow:var(--shadow-sm); overflow:hidden; cursor:pointer; transition:box-shadow .15s, transform .1s;
  position:relative;
}
.trip-card:hover{ box-shadow:var(--shadow); transform:translateY(-1px); }
.trip-head{ display:flex; align-items:center; gap:12px; padding:16px 18px 12px; }
.trip-avatar{
  width:42px; height:42px; border-radius:50%; background:var(--primary-soft); color:var(--primary-dark);
  display:flex; align-items:center; justify-content:center; font-weight:700; font-family:var(--font-display); flex:none;
}
.trip-head-text{ flex:1; min-width:0; }
.trip-head-text .name{ font-weight:600; font-size:14.5px; }
.trip-head-text .meta{ font-size:12.5px; color:var(--text-muted); }
.status-pill{ font-size:11px; font-weight:700; padding:4px 10px; border-radius:30px; text-transform:uppercase; letter-spacing:.03em; white-space:nowrap; }
.status-orcamento{ background:var(--warning-soft); color:var(--warning); }
.status-aprovado{ background:var(--primary-soft); color:var(--primary-dark); }
.status-pago{ background:var(--success-soft); color:var(--success); }
.status-andamento{ background:var(--accent-soft); color:var(--accent); }
.status-concluido{ background:var(--surface-2); color:var(--text-muted); }
.status-cancelado{ background:var(--danger-soft); color:var(--danger); }

.trip-perf{ height:0; border-top:2px dashed var(--border); margin:0 18px; position:relative; }
.trip-perf::before, .trip-perf::after{
  content:''; position:absolute; top:-9px; width:18px; height:18px; border-radius:50%; background:var(--bg); border:1px solid var(--border);
}
.trip-perf::before{ left:-27px; }
.trip-perf::after{ right:-27px; }

.trip-body{ padding:14px 18px 16px; display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.trip-title{ font-size:15.5px; font-weight:600; margin-right:auto; }
.svc-pill{
  display:inline-flex; align-items:center; gap:5px; font-size:12px; font-weight:600; padding:5px 10px 5px 8px;
  border-radius:30px; background:var(--surface-2); border:1px solid var(--border);
}
.svc-pill .dot{ width:7px; height:7px; border-radius:50%; }
.svc-hotel .dot{ background:var(--hotel); } .svc-aereo .dot{ background:var(--aereo); }
.svc-carro .dot{ background:var(--carro); } .svc-seguro .dot{ background:var(--seguro); }

.trip-footer{ display:flex; align-items:center; justify-content:space-between; padding:0 18px 16px; font-size:13px; color:var(--text-muted); }
.trip-footer .total{ font-family:var(--font-mono); font-weight:600; color:var(--text); font-size:14px; }

.empty-state{ text-align:center; padding:60px 20px; color:var(--text-muted); }
.empty-state .em-ic{ font-size:38px; margin-bottom:10px; }
.empty-state h3{ color:var(--text); margin-bottom:6px; font-size:16px; }

/* ---------- Tabelas ---------- */
table{ width:100%; border-collapse:collapse; }
th{ text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--text-muted); padding:10px 12px; border-bottom:1px solid var(--border); }
td{ padding:12px; border-bottom:1px solid var(--border); font-size:14px; }
tr:last-child td{ border-bottom:none; }
.table-card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; overflow-x:auto; }
.row-click{ cursor:pointer; }
.row-click:hover{ background:var(--surface-2); }

/* ---------- Formulários ---------- */
.form-grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:14px; }
.form-grid.cols-1{ grid-template-columns:1fr; }
.form-grid.cols-3{ grid-template-columns:repeat(3,1fr); }
@media (max-width:640px){ .form-grid, .form-grid.cols-3{ grid-template-columns:1fr; } }
.field{ display:flex; flex-direction:column; gap:6px; }
.field label{ font-size:12.5px; font-weight:600; color:var(--text-muted); }
.field input, .field select, .field textarea{
  padding:10px 12px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--surface-2); color:var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus{ outline:none; border-color:var(--primary); background:var(--surface); }
.field textarea{ resize:vertical; min-height:70px; font-family:inherit; }
.field-hint{ font-size:11.5px; color:var(--text-muted); }

/* ---------- Modal ---------- */
.modal-root{ position:fixed; inset:0; background:rgba(16,20,17,.5); display:flex; align-items:flex-end; justify-content:center; z-index:100; }
@media (min-width:720px){ .modal-root{ align-items:center; } }
.modal{
  background:var(--surface); border-radius:20px 20px 0 0; width:100%; max-width:640px; max-height:92vh; overflow-y:auto;
  padding:22px 22px 26px; box-shadow:var(--shadow-lg);
}
@media (min-width:720px){ .modal{ border-radius:var(--radius-lg); } }
.modal-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; }
.modal-head h2{ font-size:18px; }
.modal-close{ background:none; border:none; font-size:20px; cursor:pointer; color:var(--text-muted); }
.modal-actions{ display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }

/* Steps do wizard */
.steps{ display:flex; gap:6px; margin-bottom:18px; }
.step-dot{ flex:1; height:4px; border-radius:4px; background:var(--border); }
.step-dot.done{ background:var(--primary); }
.wizard-service-list{ display:flex; flex-direction:column; gap:10px; margin:14px 0; }
.wizard-service-item{
  display:flex; align-items:center; gap:10px; padding:10px 12px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--surface-2);
}
.wizard-service-item .ic{ font-size:18px; }
.wizard-service-item .info{ flex:1; font-size:13.5px; }
.wizard-service-item .info b{ display:block; font-size:14px; }
.add-service-row{ display:flex; gap:8px; flex-wrap:wrap; }

/* ---------- Toast ---------- */
.toast{
  position:fixed; bottom:24px; left:50%; transform:translateX(-50%); background:var(--text); color:var(--bg);
  padding:12px 20px; border-radius:30px; font-size:13.5px; font-weight:600; z-index:200; box-shadow:var(--shadow-lg);
}
body.theme-dark .toast{ background:#E8EBEE; color:#10151A; }

/* ---------- Auth ---------- */
.auth-screen{ min-height:100vh; display:flex; align-items:center; justify-content:center; background:var(--bg); padding:20px; }
.auth-card{ width:100%; max-width:380px; }
.auth-brand{ text-align:center; margin-bottom:26px; }
.auth-mark{
  width:52px; height:52px; border-radius:16px; background:linear-gradient(135deg,var(--primary),var(--primary-dark));
  color:#fff; display:flex; align-items:center; justify-content:center; font-size:24px; margin:0 auto 12px;
}
.auth-brand h1{ font-size:24px; }
.auth-brand p{ color:var(--text-muted); font-size:13px; margin:2px 0 0; }
.auth-form{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:24px; display:flex; flex-direction:column; gap:14px; box-shadow:var(--shadow); }
.auth-form h3{ font-size:16px; margin-bottom:2px; }
.auth-switch{ text-align:center; font-size:13px; color:var(--text-muted); margin-top:14px; }
.auth-switch button{ background:none; border:none; color:var(--primary); font-weight:600; cursor:pointer; padding:0; }
.auth-error{ background:var(--danger-soft); color:var(--danger); padding:9px 12px; border-radius:8px; font-size:13px; }

/* ---------- Settings tabs ---------- */
.tabs{ display:flex; gap:4px; border-bottom:1px solid var(--border); margin-bottom:20px; overflow-x:auto; }
.tab{ padding:10px 16px; background:none; border:none; font-weight:600; font-size:13.5px; color:var(--text-muted); cursor:pointer; border-bottom:2px solid transparent; white-space:nowrap; }
.tab.active{ color:var(--primary-dark); border-color:var(--primary); }
.settings-list{ display:flex; flex-direction:column; gap:10px; }
.settings-row{ display:flex; align-items:center; gap:12px; padding:14px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); }
.settings-row .swatch{ width:34px; height:34px; border-radius:9px; flex:none; }
.settings-row .info{ flex:1; min-width:0; }
.settings-row .info b{ display:block; font-size:14px; }
.settings-row .info span{ font-size:12.5px; color:var(--text-muted); }

/* ---------- Anexos ---------- */
.attach-list{ display:flex; flex-direction:column; gap:8px; margin-top:10px; }
.attach-item{ display:flex; align-items:center; gap:10px; padding:9px 12px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--surface-2); font-size:13px; }
.attach-item .ic{ font-size:16px; }
.attach-item a{ flex:1; text-decoration:none; color:var(--text); font-weight:500; }
.dropzone{
  border:2px dashed var(--border); border-radius:var(--radius); padding:22px; text-align:center; color:var(--text-muted);
  font-size:13.5px; cursor:pointer; background:var(--surface-2);
}
.dropzone.drag{ border-color:var(--primary); color:var(--primary); }

/* ---------- Fatura ---------- */
.invoice{ background:#fff; color:#1C2321; border-radius:var(--radius); padding:36px; max-width:760px; margin:0 auto; box-shadow:var(--shadow); }
.invoice-head{ display:flex; justify-content:space-between; align-items:flex-start; gap:20px; border-bottom:2px solid #1C2321; padding-bottom:20px; margin-bottom:20px; }
.invoice-head img{ max-height:56px; max-width:180px; object-fit:contain; }
.invoice-head .agencia-nome{ font-family:var(--font-display); font-size:20px; font-weight:600; }
.invoice-head .num{ text-align:right; font-family:var(--font-mono); }
.invoice-head .num .badge{ display:inline-block; background:#1C2321; color:#fff; padding:3px 10px; border-radius:6px; font-size:12px; margin-bottom:4px; }
.invoice-cols{ display:grid; grid-template-columns:1fr 1fr; gap:20px; margin-bottom:24px; font-size:13.5px; }
.invoice-cols .label{ font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:#8A8F8C; font-weight:700; margin-bottom:4px; }
.invoice table{ margin-bottom:20px; }
.invoice th{ color:#8A8F8C; border-bottom:1px solid #E4E0D3; }
.invoice td{ border-bottom:1px solid #F0EEE7; }
.invoice .total-row td{ font-weight:700; font-size:16px; border-top:2px solid #1C2321; border-bottom:none; }
.invoice-bank{ background:#F6F4EF; border-radius:10px; padding:14px 16px; font-size:13px; margin-bottom:16px; }
.invoice-bank .label{ font-size:11px; text-transform:uppercase; color:#8A8F8C; font-weight:700; margin-bottom:6px; }
.invoice-foot{ text-align:center; font-size:11.5px; color:#8A8F8C; margin-top:28px; }
@media print{
  body *{ visibility:hidden; }
  #printArea, #printArea *{ visibility:visible; }
  #printArea{ position:absolute; top:0; left:0; width:100%; }
  .invoice{ box-shadow:none; }
}

.spinner{ width:20px; height:20px; border:2.5px solid var(--border); border-top-color:var(--primary); border-radius:50%; animation:spin .7s linear infinite; }
@keyframes spin{ to{ transform:rotate(360deg); } }

.badge-mono{ font-family:var(--font-mono); font-size:12px; background:var(--surface-2); border:1px solid var(--border); padding:2px 8px; border-radius:6px; }
.muted{ color:var(--text-muted); }
.hr{ height:1px; background:var(--border); margin:16px 0; border:none; }
