/* TAC Connect — customer app */
:root {
  --primary: #215A63;
  --primary-dark: #163e44;
  --accent: #C4936A;
  --secondary: #5A8289;
  --sand: #F4F1EC;
  --sand-2: #ebe6dd;
  --ink: #1b3034;
  --muted: #667d81;
  --line: #e4dfd6;
  --card: #fff;
  --ok: #2f7d5b;
  --danger: #b4483c;
  --radius: 18px;
  --font: ui-sans-serif, system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body { margin: 0; min-height: 100%; font: 16px/1.45 var(--font); color: var(--ink); background: var(--sand); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
a { color: var(--primary); }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.015em; }
p { margin: 0 0 .7em; }
.ic { flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* ------------ splash & loading ------------ */
.splash { flex: 1; display: grid; place-items: center; background: var(--primary-dark); }
.splash img { width: 76px; height: 76px; border-radius: 20px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.94); opacity: .8; } }
.spinner { width: 22px; height: 22px; border: 2.5px solid rgba(0,0,0,.12); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------ login ------------ */
.login { flex: 1; display: flex; flex-direction: column; background: linear-gradient(170deg, var(--primary) 0%, var(--primary-dark) 62%); color: #fff; padding-top: var(--safe-top); }
.login-hero { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; padding: 40px 26px 26px; position: relative; overflow: hidden; min-height: 300px; }
.login-hero .waves { position: absolute; left: -10%; right: -10%; bottom: -6px; opacity: .22; }
.login-hero img.logo { width: 64px; height: 64px; border-radius: 17px; box-shadow: 0 8px 24px rgba(0,0,0,.25); margin-bottom: 22px; }
.login-hero h1 { font-size: 30px; font-weight: 750; max-width: 15ch; }
.login-hero p { color: rgba(255,255,255,.82); margin-top: 10px; font-size: 16.5px; max-width: 34ch; }
.login-card { background: var(--sand); color: var(--ink); border-radius: 26px 26px 0 0; padding: 26px 22px calc(26px + var(--safe-bottom)); }
.login-card h2 { font-size: 19px; margin-bottom: 4px; }
.login-card .lead { color: var(--muted); font-size: 14.5px; margin-bottom: 18px; }
.sandbox-pill { display: inline-flex; gap: 6px; align-items: center; background: #fbf0d9; color: #8a5d0c; font-size: 12.5px; font-weight: 650; padding: 4px 10px; border-radius: 99px; margin-bottom: 12px; }

.input { width: 100%; height: 54px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; padding: 0 16px; font: 17px var(--font); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--secondary); box-shadow: 0 0 0 4px rgba(90,130,137,.16); }
.code-input { text-align: center; letter-spacing: .5em; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; padding-left: calc(16px + .5em); }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 54px; border: 0; border-radius: 14px; background: var(--primary); color: #fff; font-weight: 700; font-size: 16.5px; cursor: pointer; margin-top: 12px; transition: transform .08s, opacity .15s; text-decoration: none; }
.btn:active { transform: scale(.985); }
.btn[disabled] { opacity: .55; }
.btn.accent { background: var(--accent); color: #2b1d10; }
.btn.ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--line); }
.btn.sm { height: 42px; font-size: 15px; border-radius: 12px; width: auto; padding: 0 16px; margin: 0; }
.link { background: none; border: 0; color: var(--primary); font-weight: 600; padding: 10px 0; cursor: pointer; }
.err { color: var(--danger); font-size: 14px; margin-top: 10px; min-height: 1.2em; }
.note { font-size: 13.5px; color: var(--muted); margin-top: 14px; }

/* ------------ shell ------------ */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(244,241,236,.88); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); padding: calc(10px + var(--safe-top)) 16px 10px; display: flex; align-items: center; gap: 12px; min-height: calc(58px + var(--safe-top)); border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar img { width: 34px; height: 34px; border-radius: 10px; }
.topbar .t { flex: 1; min-width: 0; }
.topbar .t b { display: block; font-size: 16.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .t span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.icon-btn:active { background: var(--sand-2); }

.view { flex: 1; padding: 6px 16px calc(var(--tabbar) + var(--safe-bottom) + 22px); max-width: 640px; width: 100%; margin: 0 auto; }
.view.chat-view { padding: 0; display: flex; flex-direction: column; max-width: none; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: rgba(255,255,255,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom); }
.tabbar a { flex: 1; height: var(--tabbar); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 650; position: relative; }
.tabbar a.on { color: var(--primary); }
.tabbar a.on::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.tabbar .badge { position: absolute; top: 8px; left: calc(50% + 6px); background: var(--accent); color: #2b1d10; font-size: 11px; font-weight: 800; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; }
.tabbar .badge:empty { display: none; }

.imp-bar { background: #fbf0d9; color: #7a5208; font-size: 13px; padding: 8px 16px; text-align: center; }
.imp-bar a { color: inherit; font-weight: 700; }

/* ------------ trips ------------ */
.hello { font-size: 26px; font-weight: 750; margin: 8px 0 4px; }
.sub { color: var(--muted); margin-bottom: 18px; }
.section { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; margin: 26px 2px 10px; }

.hero { display: block; text-decoration: none; color: #fff; border-radius: 24px; overflow: hidden; position: relative; background: linear-gradient(155deg, var(--secondary) 0%, var(--primary) 45%, var(--primary-dark) 100%); padding: 20px 20px 22px; box-shadow: 0 14px 40px rgba(22,62,68,.28); }
.hero .waves { position: absolute; right: -40px; bottom: -14px; width: 120%; opacity: .16; pointer-events: none; }
.hero .chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.2); padding: 5px 11px; border-radius: 99px; font-size: 13px; font-weight: 700; }
.hero .chip.soon { background: var(--accent); border-color: var(--accent); color: #2b1d10; }
.hero h2 { font-size: 24px; margin: 16px 0 6px; font-weight: 750; position: relative; }
.hero .when { font-size: 16px; color: rgba(255,255,255,.9); position: relative; }
.hero .facts { display: flex; gap: 18px; margin-top: 18px; position: relative; flex-wrap: wrap; }
.hero .facts div { font-size: 13px; color: rgba(255,255,255,.75); }
.hero .facts b { display: block; font-size: 17px; color: #fff; }
.hero .go { position: absolute; right: 18px; top: 18px; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.16); display: grid; place-items: center; }

.trip-row { display: flex; gap: 14px; align-items: center; background: var(--card); border-radius: 16px; padding: 14px; text-decoration: none; color: var(--ink); border: 1px solid var(--line); margin-bottom: 10px; }
.trip-row:active { background: #fbfaf7; }
.date-tile { width: 54px; flex: none; text-align: center; border-radius: 12px; background: var(--sand); padding: 6px 0; }
.date-tile b { display: block; font-size: 21px; line-height: 1.1; color: var(--primary); }
.date-tile span { font-size: 11.5px; text-transform: uppercase; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.trip-row .grow { flex: 1; min-width: 0; }
.trip-row .ttl { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trip-row .meta { font-size: 13.5px; color: var(--muted); }
.trip-row.cancel { opacity: .6; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #e6eff0; color: var(--primary); }
.tag.red { background: #f8e4e1; color: var(--danger); }
.tag.ok { background: #e1f1e9; color: var(--ok); }

.prompt { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; gap: 14px; align-items: flex-start; margin-top: 14px; }
.prompt .pi { width: 42px; height: 42px; border-radius: 12px; background: #f6ebe1; color: #a9764e; display: grid; place-items: center; flex: none; }
.prompt b { display: block; margin-bottom: 2px; }
.prompt p { font-size: 14px; color: var(--muted); margin: 0 0 10px; }
.prompt .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.prompt .x { margin-left: auto; margin-top: -6px; margin-right: -6px; }

.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .ic { color: var(--secondary); opacity: .5; margin-bottom: 10px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; font-size: 18px; }

/* ------------ trip detail ------------ */
.detail-hero { margin: 0 -16px; padding: 18px 20px 26px; background: linear-gradient(160deg, var(--secondary), var(--primary) 50%, var(--primary-dark)); color: #fff; position: relative; overflow: hidden; }
.detail-hero .waves { position: absolute; left: -20%; right: -20%; bottom: -8px; opacity: .16; }
.detail-hero h1 { font-size: 26px; font-weight: 750; margin: 10px 0 6px; position: relative; }
.detail-hero .when { font-size: 16.5px; opacity: .92; position: relative; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 14px; }
.card h3 { font-size: 16px; margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.code-copy { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--primary); cursor: pointer; font-variant-numeric: tabular-nums; }
.info-block { border-top: 1px solid var(--line); }
.info-block:first-of-type { border-top: 0; }
.info-block summary { list-style: none; cursor: pointer; padding: 14px 0; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.info-block summary::-webkit-details-marker { display: none; }
.info-block summary::after { content: ""; margin-left: auto; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; margin-right: 4px; }
.info-block[open] summary::after { transform: rotate(-135deg); }
.info-block .body { padding: 0 0 14px; color: #3a4f53; font-size: 15px; }
.row-actions { display: flex; gap: 10px; margin-top: 16px; }
.row-actions .btn { margin: 0; }

/* ------------ chat ------------ */
.chat-head { padding: 0 16px 10px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.chat-head .dot { width: 8px; height: 8px; border-radius: 50%; background: #c6d3d4; }
.chat-head .dot.on { background: #3aa57a; }
.thread { flex: 1; padding: 10px 14px 16px; display: flex; flex-direction: column; gap: 3px; }
.day { align-self: center; font-size: 12.5px; font-weight: 650; color: var(--muted); background: var(--sand-2); padding: 3px 10px; border-radius: 99px; margin: 12px 0 6px; }
.m { display: flex; flex-direction: column; max-width: 82%; margin-top: 4px; }
.m.in { align-self: flex-end; align-items: flex-end; }
.m.out { align-self: flex-start; }
.m .b { padding: 10px 14px; border-radius: 20px; background: #fff; border: 1px solid var(--line); overflow-wrap: anywhere; font-size: 16px; line-height: 1.42; }
.m.out .b { border-bottom-left-radius: 6px; }
.m.in .b { background: var(--primary); color: #fff; border-color: var(--primary); border-bottom-right-radius: 6px; }
.m.in .b a { color: #fff; }
.m .who { font-size: 12px; color: var(--muted); margin: 0 6px 3px; font-weight: 600; }
.m .t { font-size: 11.5px; color: var(--muted); margin: 3px 6px 0; }
.m .b img { display: block; max-width: 100%; max-height: 340px; border-radius: 14px; margin: 2px 0; }
.m .b .file { display: inline-flex; gap: 6px; align-items: center; font-weight: 650; }
.m .ctx { font-size: 12px; color: var(--muted); margin: 0 6px 3px; }
.m.pending .b { opacity: .6; }
.announce { align-self: stretch; max-width: none; margin: 10px 0 6px; }
.announce .b { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 16px; padding: 14px 16px; background: #fff; }
.announce .b strong.at { display: block; font-size: 16.5px; margin-bottom: 4px; }
.announce .lbl { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: #a9764e; font-weight: 800; margin: 0 4px 4px; }

.composer { position: sticky; bottom: calc(var(--tabbar) + var(--safe-bottom)); background: rgba(244,241,236,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: 8px 10px 10px; border-top: 1px solid var(--line); }
.composer .ctx-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; background: #e6eff0; color: var(--primary); border-radius: 99px; padding: 4px 6px 4px 11px; margin: 0 0 8px 4px; font-weight: 600; }
.composer .ctx-chip button { border: 0; background: rgba(0,0,0,.06); width: 20px; height: 20px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.composer .att { display: flex; align-items: center; gap: 10px; margin: 0 4px 8px; font-size: 14px; }
.composer .att img { width: 46px; height: 46px; object-fit: cover; border-radius: 10px; }
.composer .box { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { flex: 1; min-height: 44px; max-height: 150px; resize: none; border: 1.5px solid var(--line); border-radius: 22px; padding: 10px 16px; font: 16px/1.4 var(--font); background: #fff; outline: none; color: var(--ink); }
.composer textarea:focus { border-color: var(--secondary); }
.round { width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; flex: none; }
.round.send { background: var(--primary); color: #fff; }
.round.send[disabled] { opacity: .45; }
.round.attach { background: #fff; border: 1.5px solid var(--line); color: var(--muted); }

/* ------------ more ------------ */
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list .li { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); background: none; width: 100%; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; cursor: pointer; font-size: 16px; }
.list .li:first-child { border-top: 0; }
.list .li .li-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--sand); color: var(--primary); display: grid; place-items: center; flex: none; }
.list .li .grow { flex: 1; min-width: 0; }
.list .li small { display: block; color: var(--muted); font-size: 13px; }
.switch { width: 48px; height: 28px; border-radius: 99px; background: #cfd8d9; position: relative; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch.on { background: var(--ok); }
.switch.on::after { transform: translateX(20px); }
select.lang { border: 0; background: transparent; font: 600 15px var(--font); color: var(--primary); }

/* ------------ sheets & toasts ------------ */
.sheet-bg { position: fixed; inset: 0; z-index: 80; background: rgba(10,30,33,.45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
.sheet { background: var(--sand); width: 100%; max-width: 520px; border-radius: 24px 24px 0 0; padding: 10px 22px calc(24px + var(--safe-bottom)); animation: up .22s ease; max-height: 88vh; overflow: auto; }
.sheet .grab { width: 40px; height: 5px; background: #cfc8bc; border-radius: 3px; margin: 0 auto 16px; }
.sheet h2 { font-size: 21px; margin-bottom: 6px; }
.sheet ol { padding-left: 22px; margin: 14px 0; }
.sheet li { margin-bottom: 12px; }
.sheet .hl { display: inline-flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 1px 8px; font-weight: 650; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar) + var(--safe-bottom) + 76px); z-index: 90; background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 14px; font-size: 15px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: calc(100% - 32px); text-align: center; animation: fade .2s; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(5,15,17,.92); display: grid; place-items: center; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }

@media (min-width: 700px) {
  .login { align-items: center; justify-content: center; }
  .login-hero { flex: none; min-height: 0; width: 440px; padding: 0 0 26px; }
  .login-card { width: 440px; border-radius: 26px; margin-bottom: 40px; }
  .tabbar { justify-content: center; }
  .tabbar a { flex: 0 0 140px; }
}

/* decorative waves stay behind text and low */
.login-hero .waves, .detail-hero .waves { position: absolute; left: -10%; right: -10%; width: 120%; height: 46px; bottom: -2px; }
.hero .waves { height: 58px; bottom: -6px; right: auto; left: -10%; width: 120%; }
.login-hero > *:not(.waves), .detail-hero > *:not(.waves), .hero > *:not(.waves) { position: relative; }
.hero .go { position: absolute; }
