/* ============================================================================
   COPIOBA TRAVEL COMPANION · DESIGN SYSTEM
   Cream / deep green / soft gold. Serif headings, rounded cards.
   No fake status bar (wifi/time/battery) anywhere.
   ============================================================================ */

/* ---- Tokens --------------------------------------------------------------- */
:root {
  --cream:        #F5EDE0;
  --cream-2:      #EFE5D5;
  --cream-card:   #EAE0CF;
  --green:        #4A7A3A;
  --green-deep:   #2E4D24;
  --green-night:  #1C3217;
  --gold:         #B5956A;
  --gold-soft:    #C7AC85;
  --white:        #FFFFFF;
  --ink:          #211E18;
  --ink-soft:     #5C564B;
  --ink-faint:    #8C8576;
  --line:         rgba(33,30,24,.10);
  --danger:       #B23A2E;
  --danger-deep:  #8E2C22;
  --ok:           #4A7A3A;

  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --shadow-card: 0 10px 30px rgba(33,30,24,.07);
  --shadow-soft: 0 4px 14px rgba(33,30,24,.06);
  --shadow-pop:  0 14px 40px rgba(33,30,24,.18);

  --serif: "Playfair Display", "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --maxw: 480px;       /* phone-width app frame */
  --nav-h: 76px;
}

/* ---- Reset ---------------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.45;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--gold-soft); color: #fff; }

h1, h2, h3, h4, .serif { font-family: var(--serif); font-weight: 600; letter-spacing: .2px; }

/* ---- App frame ------------------------------------------------------------ */
#app { min-height: 100%; }

.app-shell {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background: var(--cream);
  display: flex;
  flex-direction: column;
}

.view {
  flex: 1;
  padding: 22px 20px calc(var(--nav-h) + 28px);
  animation: fade .25s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.eyebrow {
  font-family: var(--serif);
  font-style: italic;
  color: var(--gold);
  font-size: 15px;
}
.screen-title { font-size: 30px; line-height: 1.08; margin-top: 2px; }
.section-label {
  font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 700; margin: 26px 2px 12px;
}
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }

/* ---- Header (consistent Copioba brand, no status bar) --------------------- */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 6px;
}
.app-header .brand-logo { height: 26px; width: auto; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--gold); color: #fff;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 17px; font-weight: 700;
  box-shadow: var(--shadow-soft);
}
.avatar:active { transform: scale(.96); }

/* ---- Hero card (deep green) ----------------------------------------------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(120% 90% at 80% 8%, rgba(181,149,106,.30), transparent 60%),
    linear-gradient(165deg, var(--green) 0%, var(--green-deep) 52%, var(--green-night) 100%);
  color: #fff;
  padding: 22px 22px 24px;
  min-height: 232px;
  display: flex; flex-direction: column; justify-content: flex-end;
  box-shadow: var(--shadow-card);
}
.hero .pill {
  position: absolute; top: 18px; right: 18px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 12px; padding: 10px 14px;
  text-align: center; backdrop-filter: blur(4px);
}
.hero .pill .dot { width: 16px; height: 16px; border-radius: 50%; background: var(--gold); margin: 0 auto 5px; }
.hero .pill small { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.92); }
.hero .place { font-family: var(--serif); font-style: italic; color: var(--gold-soft); font-size: 14px; }
.hero h2 { font-size: 30px; line-height: 1.06; margin: 6px 0 8px; }
.hero .meta { font-size: 13.5px; color: rgba(255,255,255,.82); }

/* ---- Generic cards -------------------------------------------------------- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}
.card + .card { margin-top: 12px; }

.detail-card { display: flex; align-items: center; gap: 14px; }
.detail-card .ico {
  width: 46px; height: 46px; border-radius: var(--radius-sm);
  display: grid; place-items: center; font-family: var(--serif);
  font-size: 13px; font-weight: 700; color: #fff; flex: none; letter-spacing: .04em;
}
.ico.passport { background: #2b2620; }
.ico.flight   { background: var(--danger); }
.ico.hotel    { background: var(--gold); }
.ico.insurance{ background: var(--green-deep); }
.detail-card .body { flex: 1; min-width: 0; }
.detail-card .body .k { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); font-weight: 700; }
.detail-card .body .v { font-family: var(--serif); font-size: 17px; margin-top: 1px; }
.detail-card .body .s { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.badge { font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 999px; }
.badge.ok { color: var(--green-deep); background: rgba(74,122,58,.14); }

/* ---- Quick access grid ---------------------------------------------------- */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.quick {
  background: var(--cream-card);
  border-radius: var(--radius-md);
  padding: 16px 8px 12px; text-align: center;
  transition: transform .12s ease;
}
.quick:active { transform: scale(.95); }
.quick .q-ico {
  width: 46px; height: 46px; margin: 0 auto 8px; border-radius: 13px;
  background: var(--white); display: grid; place-items: center;
  box-shadow: var(--shadow-soft); color: var(--gold);
}
.quick .q-ico svg { width: 22px; height: 22px; }
.quick span { font-size: 12.5px; color: var(--ink); font-weight: 600; }

/* ---- Pendências / list rows ---------------------------------------------- */
.row-card { display: flex; align-items: center; gap: 14px; }
.row-card .clock {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: #F3E2C7; display: grid; place-items: center; color: var(--gold);
}
.row-card .grow { flex: 1; min-width: 0; }
.row-card .grow .t { font-family: var(--serif); font-size: 16px; }
.row-card .grow .d { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.row-card .go { color: var(--gold); font-weight: 700; font-size: 13px; white-space: nowrap; }

/* message from team */
.team-msg { background: var(--cream-card); border-radius: var(--radius-lg); padding: 18px; display: flex; gap: 14px; }
.team-msg .who { width: 44px; height: 44px; border-radius: 50%; background: #2b2620; color: #fff; display: grid; place-items: center; font-family: var(--serif); flex: none; }
.team-msg .name { font-weight: 700; font-size: 14px; }
.team-msg .role { color: var(--ink-faint); font-size: 12.5px; }
.team-msg blockquote { font-family: var(--serif); font-style: italic; font-size: 15px; margin: 6px 0; line-height: 1.5; }

/* ---- Itinerary timeline --------------------------------------------------- */
.day-head { display: flex; align-items: baseline; gap: 10px; margin: 24px 2px 12px; }
.day-head .d { font-family: var(--serif); font-style: italic; color: var(--gold); font-size: 14px; }
.day-head .date { font-family: var(--serif); font-size: 20px; }
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: rgba(181,149,106,.45); }
.tl-item { position: relative; margin-bottom: 12px; }
.tl-item::before {
  content: ""; position: absolute; left: -26px; top: 20px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--cream); border: 3px solid var(--gold);
}
.tl-item.now::before { background: var(--danger); border-color: var(--danger); box-shadow: 0 0 0 4px rgba(178,58,46,.18); }
.tl-time { font-size: 12.5px; color: var(--ink-faint); font-weight: 700; letter-spacing: .04em; }
.tl-item.now .tl-time { color: var(--danger); }
.tl-title { font-family: var(--serif); font-size: 18px; margin: 2px 0 3px; }
.tl-loc { font-size: 12.5px; color: var(--ink-soft); }
.tl-desc { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }

/* ---- Language module / phrase cards -------------------------------------- */
.progress-card {
  background: linear-gradient(160deg, var(--gold-soft), var(--gold));
  color: #fff; border-radius: var(--radius-xl); padding: 22px; box-shadow: var(--shadow-card);
}
.progress-card .big { font-family: var(--serif); font-size: 30px; line-height: 1; }
.progress-card .lbl { font-family: var(--serif); font-style: italic; opacity: .9; font-size: 14px; }
.progress-card .meta { font-size: 12.5px; opacity: .9; margin-top: 6px; }

.module-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--white); border-radius: var(--radius-md); padding: 16px 16px;
  box-shadow: var(--shadow-soft); margin-bottom: 10px; transition: transform .12s ease;
}
.module-card:active { transform: scale(.985); }
.module-card .num { width: 48px; height: 48px; border-radius: 13px; background: var(--cream-card); display: grid; place-items: center; font-size: 22px; flex: none; }
.module-card .grow { flex: 1; min-width: 0; }
.module-card .grow .t { font-family: var(--serif); font-size: 18px; }
.module-card .grow .c { font-size: 12.5px; color: var(--ink-faint); margin-top: 1px; }
.module-card .chev { color: var(--gold); font-size: 20px; }

.phrase-card { background: var(--white); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-card); margin-bottom: 12px; border-left: 4px solid transparent; }
.phrase-card.sos { border-left-color: var(--danger); }
.phrase-card .pt { font-family: var(--serif); font-size: 21px; line-height: 1.2; }
.phrase-card .pron { color: var(--gold); font-size: 13px; margin-top: 4px; font-variant: small-caps; letter-spacing: .03em; }
.phrase-card .tr { color: var(--ink-soft); font-style: italic; margin-top: 6px; font-size: 14.5px; }
.phrase-actions { display: flex; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.btn-soft {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--cream-2); color: var(--ink); border-radius: 10px;
  padding: 9px 14px; font-size: 13px; font-weight: 600;
}
.btn-soft svg { width: 16px; height: 16px; }
.btn-soft.playing { background: var(--green); color: #fff; }
.btn-soft.fav-on { color: var(--danger); }
.btn-soft:active { transform: scale(.96); }

/* segmented control */
.segment { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.segment::-webkit-scrollbar { display: none; }
.chip { white-space: nowrap; padding: 9px 16px; border-radius: 999px; background: var(--cream-card); font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.chip.active { background: var(--ink); color: var(--cream); }

/* ---- SOS view ------------------------------------------------------------- */
.sos-hero { background: linear-gradient(150deg, var(--danger), var(--danger-deep)); color: #fff; border-radius: var(--radius-xl); padding: 18px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow-card); }
.sos-hero .siren { width: 64px; height: 64px; border-radius: 18px; background: rgba(255,255,255,.14); display: grid; place-items: center; font-size: 30px; flex: none; }
.sos-hero .num { font-family: var(--serif); font-size: 34px; line-height: 1; }
.sos-hero .lbl { font-size: 12.5px; opacity: .92; }
.sos-hero .call-btn { margin-left: auto; background: #fff; color: var(--danger); font-weight: 800; border-radius: 12px; padding: 12px 18px; font-size: 15px; }

.sos-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.sos-num { background: var(--white); border-radius: var(--radius-md); padding: 16px; box-shadow: var(--shadow-soft); display: flex; align-items: center; gap: 12px; text-align: left; }
.sos-num .e { font-size: 26px; flex: none; }
.sos-num .n { font-family: var(--serif); font-size: 24px; line-height: 1; }
.sos-num .w { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.sos-num:active { transform: scale(.97); }

.show-card { background: var(--cream-card); border: 1px dashed rgba(181,149,106,.7); border-radius: var(--radius-lg); padding: 18px; }
.show-card .kicker { font-family: var(--serif); font-style: italic; color: var(--gold); font-size: 13px; }
.show-card .big-say { font-family: var(--serif); font-size: 20px; line-height: 1.32; margin-top: 8px; }
.show-card .say-tr { color: var(--ink-soft); font-style: italic; font-size: 14px; margin-top: 10px; }
.show-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.wa-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; background: #25D366; color: #04331a; font-weight: 800; border-radius: 14px; padding: 15px; font-size: 15px; box-shadow: var(--shadow-soft); }
.wa-btn.dark { background: var(--green-deep); color: #fff; }
.wa-btn svg { width: 20px; height: 20px; }
.wa-btn:active { transform: scale(.99); }

/* fullscreen "show to responder" overlay */
.show-overlay { position: fixed; inset: 0; z-index: 90; background: var(--cream); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 28px; }
.show-overlay .close { position: absolute; top: 18px; right: 22px; font-family: var(--serif); font-style: italic; color: var(--ink-faint); font-size: 15px; }
.show-overlay .en { font-family: var(--serif); font-size: clamp(26px, 7vw, 40px); line-height: 1.22; }
.show-overlay .pt { color: var(--ink-soft); font-family: var(--serif); font-style: italic; font-size: clamp(15px, 4.6vw, 20px); line-height: 1.5; margin-top: 22px; max-width: 30ch; }

/* ---- Empty / welcome states (graceful, never an error) -------------------- */
.welcome-hero {
  border-radius: var(--radius-xl);
  background: linear-gradient(165deg, var(--green) 0%, var(--green-deep) 60%, var(--green-night) 100%);
  color: #fff; padding: 30px 24px; box-shadow: var(--shadow-card);
}
.welcome-hero .logo-mark { height: 30px; margin-bottom: 18px; filter: brightness(0) invert(1); opacity: .96; }
.welcome-hero h2 { font-size: 25px; line-height: 1.12; }
.welcome-hero p { color: rgba(255,255,255,.85); font-size: 14px; margin-top: 10px; }
.empty-soft { text-align: center; color: var(--ink-soft); padding: 34px 18px; }
.empty-soft .em { font-size: 40px; }
.empty-soft .t { font-family: var(--serif); font-size: 20px; margin: 10px 0 4px; }
.empty-soft .s { font-size: 13.5px; }

/* ---- Bottom navigation ---------------------------------------------------- */
.bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: var(--maxw);
  height: var(--nav-h);
  background: rgba(245,237,224,.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex; align-items: stretch; z-index: 40;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--ink-faint); }
.nav-item svg { width: 23px; height: 23px; }
.nav-item span { font-size: 11px; font-weight: 600; }
.nav-item.active { color: var(--gold); }
.nav-item.active span { color: var(--ink); }

/* ---- Floating SOS button (ALWAYS visible) --------------------------------- */
.sos-fab {
  position: fixed; z-index: 60;
  bottom: calc(var(--nav-h) + 14px); right: 16px;
  width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #d4493b, var(--danger) 60%, var(--danger-deep));
  color: #fff; font-weight: 800; font-size: 15px; letter-spacing: .04em;
  display: grid; place-items: center;
  box-shadow: 0 10px 26px rgba(178,58,46,.45);
  animation: sos-pulse 2.6s ease-in-out infinite;
}
.sos-fab:active { transform: scale(.93); }
@keyframes sos-pulse { 0%,100% { box-shadow: 0 10px 26px rgba(178,58,46,.40); } 50% { box-shadow: 0 10px 30px rgba(178,58,46,.62); } }

/* LEFT-HANDED MODE — mirror the FAB to the opposite thumb */
body.lefty .sos-fab { right: auto; left: 16px; }

/* ---- Login ---------------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--cream); }
.login-card { width: 100%; max-width: 380px; background: var(--white); border-radius: var(--radius-xl); padding: 34px 28px; box-shadow: var(--shadow-card); }
.login-logo { height: 46px; margin: 4px auto 8px; }
.login-tagline { text-align: center; font-family: var(--serif); font-style: italic; color: var(--gold); font-size: 15px; margin-bottom: 26px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); font-weight: 700; margin-bottom: 7px; }
.field input { width: 100%; padding: 14px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 15px; background: var(--white); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.field input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(74,122,58,.14); }
.btn-primary { width: 100%; background: var(--green); color: #fff; border-radius: var(--radius-sm); padding: 15px; font-size: 15.5px; font-weight: 700; box-shadow: var(--shadow-soft); transition: transform .1s, background .15s; }
.btn-primary:hover { background: var(--green-deep); }
.btn-primary:active { transform: scale(.99); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.login-help { text-align: center; color: var(--ink-faint); font-size: 12.5px; margin-top: 14px; }
.login-error { background: rgba(178,58,46,.10); color: var(--danger-deep); border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13px; margin-bottom: 16px; text-align: center; }
.lang-switch { display: flex; justify-content: center; gap: 6px; margin-top: 20px; }
.lang-switch button { font-size: 12px; font-weight: 700; color: var(--ink-faint); padding: 6px 12px; border-radius: 999px; }
.lang-switch button.active { background: var(--cream-card); color: var(--ink); }

/* ---- Settings sheet ------------------------------------------------------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(33,30,24,.42); z-index: 80; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease; }
.sheet { width: 100%; max-width: var(--maxw); background: var(--cream); border-radius: 24px 24px 0 0; padding: 12px 20px calc(28px + env(safe-area-inset-bottom)); animation: slideup .26s ease; }
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.sheet .grip { width: 44px; height: 5px; border-radius: 3px; background: rgba(33,30,24,.18); margin: 6px auto 16px; }
.sheet h3 { font-size: 22px; margin-bottom: 4px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid var(--line); }
.setting-row .lab { font-size: 14.5px; }
.setting-row .lab small { display: block; color: var(--ink-faint); font-size: 12px; margin-top: 2px; }
.seg-mini { display: flex; gap: 6px; background: var(--cream-card); padding: 4px; border-radius: 999px; }
.seg-mini button { padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.seg-mini button.active { background: var(--white); color: var(--ink); box-shadow: var(--shadow-soft); }
.toggle { width: 52px; height: 30px; border-radius: 999px; background: var(--cream-card); position: relative; transition: background .18s; flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-soft); transition: transform .18s; }
.toggle.on { background: var(--green); }
.toggle.on::after { transform: translateX(22px); }
.sheet .signout { width: 100%; text-align: center; color: var(--danger); font-weight: 700; padding: 16px; margin-top: 8px; font-size: 14.5px; }

/* ---- Toast ---------------------------------------------------------------- */
.toast { position: fixed; bottom: calc(var(--nav-h) + 22px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--cream); padding: 11px 18px; border-radius: 999px; font-size: 13.5px; z-index: 100; box-shadow: var(--shadow-pop); animation: fade .2s ease; }

/* ---- Loading -------------------------------------------------------------- */
.loader { min-height: 100vh; display: grid; place-items: center; }
.spin { width: 30px; height: 30px; border: 3px solid var(--cream-card); border-top-color: var(--green); border-radius: 50%; animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

.skeleton { background: linear-gradient(90deg, var(--cream-2) 25%, var(--cream-card) 37%, var(--cream-2) 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: var(--radius-lg); }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

@media (max-width: 360px) { .screen-title { font-size: 26px; } .hero h2 { font-size: 26px; } }
