/* Disc Trader — brand kit v1 (navy foundation, cyan for primary actions).
   Tokens from brand/disc-trader-tokens.css; see the brand style guide for usage rules. */
:root {
  --dt-navy: #06172E;
  --dt-cyan: #00D5E8;
  --dt-blue: #0866FF;
  --dt-white: #F5F9FF;
  --dt-surface: #102640;
  --dt-muted: #A9BDD2;
  --dt-border: #39546E;
  --dt-teal: #007B8C;
  --dt-radius: 12px;
  --dt-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* App roles */
  --bg: var(--dt-navy);
  --surface: var(--dt-surface);
  --field: var(--dt-navy);
  --text: var(--dt-white);
  --muted: var(--dt-muted);
  --border: var(--dt-border);
  --accent: var(--dt-cyan);
  --accent-text: var(--dt-navy);   /* never white on cyan */
  --error: #FF8A8A;
  --radius: var(--dt-radius);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* components set display; hidden must still win */

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/24px var(--dt-font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Header ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.top-inner {
  max-width: 960px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  min-height: 64px;
}
.brand { display: flex; align-items: center; min-height: 44px; flex-shrink: 0; }
.brand img { height: auto; }
.brand .logo-full { display: block; width: 170px; }
.brand .logo-icon { display: none; width: 36px; }
@media (max-width: 374px) {             /* guide: below ~160px of room, use the icon alone */
  .brand .logo-full { display: none; }
  .brand .logo-icon { display: block; }
}
@media (min-width: 600px) { .brand .logo-full { width: 200px; } }

.offline-banner {
  margin: 0; padding: 8px 16px; text-align: center; font-size: 14px; line-height: 20px;
  background: #2B2410; color: #F3DC9A; border-bottom: 1px solid #5C4A18;
}

/* ---------- Layout & type ---------- */
main { max-width: 640px; margin: 0 auto; padding: 16px 16px 48px; }
@media (max-width: 767px) {
  /* room for the bottom tab bar */
  main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}

.page-head { margin: 4px 0 16px; }
/* Page titles stay a step below the logo so they don't compete with the brand. */
.page-title { margin: 4px 0 12px; font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -0.01em; }
.page-head .page-title { margin-bottom: 4px; }
.page-sub { margin: 0; color: var(--muted); font-size: 14px; line-height: 20px; }
.section-title { font-size: 20px; line-height: 28px; font-weight: 700; margin: 24px 0 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 8px; font-size: 20px; line-height: 28px; font-weight: 700; }
.hint { margin: 0 0 12px; color: var(--muted); font-size: 14px; line-height: 20px; }

/* ---------- Buttons ---------- */
.primary, .secondary {
  display: block; width: 100%; min-height: 48px; padding: 12px 16px;
  font: inherit; font-size: 14px; line-height: 20px; font-weight: 700;
  border-radius: var(--radius); cursor: pointer; text-align: center; text-decoration: none;
}
.primary { color: var(--accent-text); background: var(--accent); border: 0; }
.secondary { color: var(--text); background: transparent; border: 1px solid var(--border); }
.primary:disabled { opacity: .5; cursor: not-allowed; }
.button-link { display: block; }

/* ---------- Photos ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-grid.extras:not(:empty) { margin-top: 8px; }

.slot {
  position: relative; aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center; text-align: center;
  border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--field); cursor: pointer; overflow: hidden;
}
.slot:hover { border-color: var(--muted); }
.slot:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.slot img { display: none; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot.filled { border-style: solid; border-color: var(--accent); }
.slot.filled img { display: block; }
.slot-label { font-weight: 600; font-size: 14px; line-height: 20px; }
.slot-label small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; line-height: 16px; }
.slot.filled .slot-label {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2px;
  background: rgba(6, 23, 46, .8); color: var(--dt-white); font-size: 12px;
}
.slot.filled .slot-label small { display: none; }

.remove {
  position: absolute; top: 6px; right: 6px;
  width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: rgba(6, 23, 46, .85); color: var(--dt-white);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.remove::before { content: ""; position: absolute; inset: -6px; }  /* 44px touch target */

.add-extra {
  display: inline-flex; align-items: center; min-height: 44px; margin-top: 4px;
  color: var(--accent); font-weight: 600; font-size: 14px; cursor: pointer;
}
.add-extra.disabled { color: var(--muted); pointer-events: none; }

/* ---------- Fields ---------- */
.field { display: block; margin-bottom: 16px; font-size: 14px; line-height: 20px; font-weight: 600; }
.field input:not([type=range]), .field select, .field textarea, .flight input,
#search {
  display: block; width: 100%; min-height: 48px;
  margin-top: 6px; padding: 12px;
  font: inherit; font-weight: 400; font-size: 16px; line-height: 24px; /* 16px avoids iOS zoom */
  color: var(--text); background: var(--field);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.field input::placeholder, .field textarea::placeholder, #search::placeholder { color: #7F95AD; }
.field input:disabled { opacity: .5; }
.field input[type=range] { width: 100%; margin-top: 12px; accent-color: var(--accent); }
.field textarea { resize: vertical; }
.counter { display: block; text-align: right; color: var(--muted); font-weight: 500; font-size: 12px; }
select { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23A9BDD2' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px !important; }

/* Stacked on phones, side by side on wider screens */
.row > .field { min-width: 0; }
@media (min-width: 480px) {
  .row { display: flex; gap: 12px; }
  .row > .field { flex: 1; }
}
.row.align-end { display: flex; gap: 12px; align-items: center; }
.row.align-end > .field { flex: 1; }
.row.align-end .check { margin-top: 10px; white-space: nowrap; }

fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
legend { font-size: 14px; line-height: 20px; font-weight: 600; margin-bottom: 6px; padding: 0; }

.flight { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.flight legend { grid-column: 1 / -1; }
.flight label { font-size: 12px; font-weight: 500; color: var(--muted); }
.flight input { margin-top: 4px; text-align: center; padding: 12px 4px; }

.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; flex-shrink: 0; }
.checks { display: flex; gap: 20px; margin-bottom: 8px; flex-wrap: wrap; }
.attest { align-items: flex-start; margin-bottom: 12px; font-size: 14px; line-height: 20px; }
.attest input { margin-top: 0; }

/* ---------- Segmented control & chips ---------- */
.segmented { display: flex; flex-wrap: wrap; }
.segmented legend { width: 100%; }
.segmented label { flex: 1; }
/* Visually hidden radios/checkboxes stay inside their label: absolutely positioned elements escape
   overflow clipping otherwise, and the off-screen chips widened the whole page on phones. */
.segmented label, .chips label { position: relative; }
.segmented input, .chips label input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; }
.segmented span {
  display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 4px;
  border: 1px solid var(--border); margin-left: -1px;
  font-size: 14px; font-weight: 600; text-align: center; cursor: pointer; background: var(--field);
}
.segmented label:first-of-type span { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.segmented label:last-of-type span { border-radius: 0 var(--radius) var(--radius) 0; }
.segmented input:checked + span { background: var(--accent); color: var(--accent-text); border-color: var(--accent); position: relative; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.chips input:checked + span { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.chips input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.error { color: var(--error); font-size: 14px; line-height: 20px; margin: 6px 0 0; }
.error:empty { display: none; }
.invalid { border-color: var(--error) !important; }

/* ---------- Browse ---------- */
.browse-controls { margin-bottom: 16px; }
#search { margin-top: 0; }
.scroll-row { flex-wrap: nowrap; overflow-x: auto; margin: 12px -16px; padding: 2px 16px; scrollbar-width: none; }
.scroll-row::-webkit-scrollbar { display: none; }
.scroll-row label { flex-shrink: 0; }

.feed { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 600px) { .feed { grid-template-columns: repeat(3, 1fr); } }
.disc-card {
  display: block; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.disc-card:hover { border-color: var(--muted); }
.disc-card img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #E9ECE8; } /* neutral, no brand tint on photos */
.disc-card-body { padding: 10px 12px 12px; }
.disc-card h3 { margin: 0 0 2px; font-size: 16px; line-height: 22px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.disc-card p { margin: 0; font-size: 13px; line-height: 18px; color: var(--muted); }
.disc-card .price { color: var(--accent); font-weight: 700; font-size: 16px; line-height: 22px; }
.flight-mini { font-variant-numeric: tabular-nums; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 32px 0; }

/* ---------- Listing detail ---------- */
.back { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 4px; font-weight: 600; font-size: 14px; text-decoration: none; }
.gallery {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory;
  margin: 0 -16px 16px; padding: 0 16px; scrollbar-width: none;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery figure { flex: 0 0 85%; margin: 0; scroll-snap-align: center; position: relative; }
@media (min-width: 600px) { .gallery figure { flex-basis: 45%; } }
.gallery img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); background: #E9ECE8; }
.gallery figcaption {
  position: absolute; left: 8px; bottom: 8px; padding: 2px 10px; border-radius: 999px;
  background: rgba(6, 23, 46, .85); color: var(--dt-white); font-size: 12px; font-weight: 600;
}
.price.big { font-size: 28px; line-height: 34px; font-weight: 700; margin: 0; color: var(--accent); }
.detail-title { font-size: 20px; line-height: 28px; font-weight: 700; margin: 2px 0 16px; }
.flight-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.flight-row div {
  text-align: center; background: var(--field); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 4px;
  font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}
.flight-row span { display: block; font-size: 22px; line-height: 28px; font-weight: 700; color: var(--text); text-transform: none; letter-spacing: 0; }
.attrs { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 16px; font-size: 14px; line-height: 20px; }
.attrs dt { color: var(--muted); }
.attrs dd { margin: 0; font-weight: 500; }
.desc { white-space: pre-wrap; }

/* ---------- Your listings ---------- */
.listing {
  display: flex; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; margin-bottom: 12px;
}
.listing img { width: 88px; height: 88px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: #E9ECE8; }
.listing .info { flex: 1; min-width: 0; }
.listing h3 { margin: 0 0 2px; font-size: 16px; line-height: 22px; font-weight: 600; }
.listing h3 a { color: var(--text); text-decoration: none; }
.listing p { margin: 0 0 2px; font-size: 13px; line-height: 18px; color: var(--muted); }
.listing .price { color: var(--accent); font-weight: 700; font-size: 14px; }
.listing .tags { font-size: 12px; }
.listing-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; align-self: flex-start; }
.listing-actions .edit, .listing .delete {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 4px;
  font: inherit; font-size: 14px; font-weight: 600; text-decoration: none;
}
.listing .delete { background: none; border: 0; color: var(--muted); cursor: pointer; }

/* ---------- Accounts ---------- */
.auth-card { max-width: 420px; margin: 8px auto 16px; }
.auth-card .page-title { margin: 0 0 4px; }
.google-btn { display: flex; justify-content: center; min-height: 44px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--muted); font-size: 14px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.notice { background: var(--field); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; font-size: 14px; line-height: 20px; margin: 0 0 16px; }
.notice p { margin: 0 0 6px; }
.notice p:last-child { margin: 0; }
#view-account .card form .primary { margin-top: 4px; }

/* ---------- Editing ---------- */
.edit-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-color: var(--accent); }
.edit-banner a { display: inline-flex; align-items: center; min-height: 36px; font-weight: 600; white-space: nowrap; }

/* ---------- Main navigation ----------
   Phones: fixed bottom tab bar (icon + label). Wider screens: inline links in the header. */
.tabs { display: flex; }
.tab {
  position: relative; display: flex; align-items: center; justify-content: center;
  color: var(--muted); text-decoration: none; font-weight: 600;
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.tab.active { color: var(--accent); }
.tab-cta svg { stroke-width: 2.5; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--dt-blue); color: var(--dt-white); font-style: normal; font-size: 13px; font-weight: 700;
}
.tab.active .avatar { box-shadow: 0 0 0 2px var(--accent); }
.badge {
  position: absolute; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--accent-text); font-size: 11px; line-height: 18px; font-weight: 700; text-align: center;
}

@media (max-width: 767px) {
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 4px 4px env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .tab { flex: 1; flex-direction: column; gap: 2px; min-height: 56px; font-size: 11px; line-height: 14px; }
  .tab-cta svg { width: 32px; height: 32px; padding: 5px; border-radius: 10px; background: var(--accent); color: var(--accent-text); stroke: var(--accent-text); }
  .tab-cta { gap: 0; }
  .tab-cta.active svg { box-shadow: 0 0 0 2px var(--dt-white); }
  .badge { top: 4px; left: calc(50% + 6px); }
  body.in-thread .tabs { display: none; }  /* the chat composer takes the bottom of the screen */
}

@media (min-width: 768px) {
  .tabs { align-items: center; gap: 4px; }
  .tab { gap: 8px; min-height: 44px; padding: 0 12px; border-radius: var(--radius); font-size: 14px; }
  .tab:hover { color: var(--text); }
  .tab-cta { background: var(--accent); color: var(--accent-text); margin: 0 4px; }
  .tab-cta:hover, .tab-cta.active { color: var(--accent-text); }
  .tab-cta.active { box-shadow: inset 0 0 0 2px var(--dt-white); }
  .badge { top: 4px; left: 26px; }
}

/* ---------- Messages ---------- */
.link-btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px;
  background: none; border: 0; color: var(--accent); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}

.inbox { display: flex; flex-direction: column; gap: 8px; }
.convo {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none;
}
.convo:hover { border-color: var(--muted); }
.convo img, .convo-noimg { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: #E9ECE8; }
.convo-body { flex: 1; min-width: 0; }
.convo-top { display: flex; justify-content: space-between; gap: 8px; }
.convo-top strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-top time { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.convo p { margin: 0; font-size: 14px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-listing { color: var(--muted); }
.convo-preview { color: var(--muted); }
.convo.unread { border-color: var(--accent); }
.convo.unread .convo-preview { color: var(--text); font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.empty-state { text-align: center; padding: 32px 8px; }
.empty-state p { margin: 0 0 8px; }
.empty-state .primary { margin-top: 16px; }

.thread-listing {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 12px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.thread-listing-link { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--text); text-decoration: none; }
.thread-listing-link img, .thread-listing-link .convo-noimg {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 8px; object-fit: cover; background: #E9ECE8;  /* crop, never stretch */
}
.thread-listing-link span { min-width: 0; }
.thread-listing-link strong { display: block; font-size: 14px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-listing-link small { display: block; color: var(--muted); font-size: 13px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.safety {
  margin: 0 0 16px; padding: 8px 12px; border-radius: var(--radius);
  background: rgba(8, 102, 255, .14); border: 1px solid rgba(8, 102, 255, .45);
  font-size: 13px; line-height: 18px; color: var(--text);
}

.messages { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; min-height: 30vh; }
.thread-empty { text-align: center; margin: 24px 0; }
.msg { max-width: 80%; padding: 8px 12px; border-radius: 16px; }
.msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg time { display: block; margin-top: 2px; font-size: 11px; line-height: 14px; opacity: .7; }
.msg.mine { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.msg.theirs { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.seen { align-self: flex-end; margin: -2px 4px 0; font-size: 11px; color: var(--muted); }

.composer {
  position: sticky; bottom: 0; z-index: 5;
  margin: 0 -16px; padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--border);
}
.quick-replies { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 8px; padding: 0 16px; }
.quick-replies::-webkit-scrollbar { display: none; }
.chip-btn {
  flex-shrink: 0; min-height: 36px; padding: 0 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea {
  flex: 1; min-height: 44px; max-height: 140px; padding: 10px 14px; resize: none;
  font: inherit; font-size: 16px; line-height: 22px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px;
}
.send-btn {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-text);
}
.send-btn svg { width: 20px; height: 20px; fill: currentColor; }
.send-btn:disabled { opacity: .5; }
main:has(#view-thread:not([hidden])) { padding-bottom: 0; }

.blocked-list { list-style: none; margin: 0; padding: 0; }
.blocked-list li { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); }
.blocked-list li:first-child { border-top: 0; }
.hint.center { text-align: center; margin: 8px 0 0; }

/* ---------- Browse: filter row, result bar, sort ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.filter-row { margin-top: 0; }
.filter-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.filter-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.filter-btn.active { border-color: var(--accent); color: var(--accent); }
.count-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: var(--accent-text); font-size: 12px; line-height: 20px; text-align: center;
}
.result-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.result-meta { display: flex; align-items: center; gap: 4px; margin: 0; color: var(--muted); font-size: 14px; }
.result-meta .link-btn { min-height: 44px; }
.sort-control { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; }
.sort-control svg {
  position: absolute; left: 12px; width: 18px; height: 18px; pointer-events: none;
  fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.sort-control select {
  min-height: 44px; padding: 8px 0 8px 38px; border-radius: 999px;
  font: inherit; font-size: 16px; font-weight: 600; color: var(--text);   /* 16px: no iOS zoom on tap */
  background-color: var(--surface); border: 1px solid var(--border); cursor: pointer;
}
.sort-note { margin: 4px 0 0; font-size: 13px; }
.empty .secondary { width: auto; display: inline-block; margin-top: 8px; padding: 10px 20px; min-height: 44px; }

/* ---------- Filter sheet ---------- */
.sheet {
  padding: 0; border: 0; color: var(--text); background: var(--surface);
  max-width: none; max-height: none; overflow: hidden;
}
.sheet::backdrop { background: rgba(2, 8, 18, .7); }
.sheet-inner { display: flex; flex-direction: column; max-height: inherit; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 4px 16px; position: relative; }
.sheet-head h2 { margin: 12px 0 8px; font-size: 20px; line-height: 28px; }
.icon-btn {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: none; color: var(--text); cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.sheet-body { overflow-y: auto; padding: 4px 16px 8px; }
.sheet-body fieldset { margin-bottom: 20px; }
.sheet-body legend { font-size: 16px; margin-bottom: 8px; }
.sheet-body .hint { margin: 8px 0 0; }
.range-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.range-row select {
  width: 100%; min-height: 48px; padding: 10px 36px 10px 12px;
  font: inherit; font-size: 16px; color: var(--text); background-color: var(--field);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.sheet-foot {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border);
}
.sheet-foot .primary { flex: 1; }
.sheet-foot .link-btn:disabled { color: var(--muted); opacity: .6; cursor: default; }
body.sheet-open { overflow: hidden; }

@media (max-width: 767px) {           /* bottom sheet with a grab handle */
  .sheet { position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-height: 85vh; border-radius: 16px 16px 0 0; }
  .sheet-head::before {
    content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px;
    border-radius: 2px; background: var(--border);
  }
  .sheet[open] { animation: sheet-up .22s ease-out; }
}
@media (min-width: 768px) {
  .sheet { width: min(440px, calc(100% - 32px)); max-height: 80vh; border-radius: 16px; border: 1px solid var(--border); }
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .sheet[open] { animation: none; } }
.sheet-head h2:focus { outline: none; }

/* Chat header ⋯ menu */
.more { position: relative; flex-shrink: 0; }
.icon-btn circle { fill: currentColor; stroke: none; }
.menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 15; min-width: 200px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}
.menu [role=menuitem] {
  display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 12px;
  background: none; border: 0; border-radius: 8px; color: var(--text);
  font: inherit; font-size: 15px; font-weight: 500; text-align: left; cursor: pointer; white-space: nowrap;
}
.menu [role=menuitem]:hover, .menu [role=menuitem]:focus-visible { background: var(--field); }
.menu .danger { color: var(--error); }

/* Report sheet */
.reason-list { margin-bottom: 16px; }
.radio-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 4px; min-height: 44px;
  border-top: 1px solid var(--border); cursor: pointer;
}
.radio-row:first-of-type { border-top: 0; }
.radio-row input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.radio-row span { font-weight: 600; }
.radio-row small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; line-height: 18px; }
.optional { color: var(--muted); font-weight: 400; }
.report-done { padding-top: 8px; padding-bottom: 16px; }
.report-done p { margin: 0 0 8px; }

/* Browser autofill (saved emails etc.) paints fields yellow, which turns olive on navy.
   Keep autofilled fields looking like every other field. */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus,
textarea:-webkit-autofill, select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--field) inset;
          box-shadow: 0 0 0 1000px var(--field) inset;
  transition: background-color 9999s ease-out 0s;   /* defeats Chrome's own autofill fill */
}
input:autofill { -webkit-text-fill-color: var(--text); box-shadow: 0 0 0 1000px var(--field) inset; }

/* "Sending" dots on a just-sent message. Hidden for the first 300ms so instant sends never flash them. */
.msg time.sending { display: inline-flex; gap: 3px; height: 14px; align-items: center; opacity: 0; animation: show-sending 0s .3s forwards; }
.msg time.sending i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: sending-dot 1.2s ease-in-out infinite; }
.msg time.sending i:nth-child(2) { animation-delay: .15s; }
.msg time.sending i:nth-child(3) { animation-delay: .3s; }
.msg.pending p { opacity: .85; }
@keyframes show-sending { to { opacity: .7; } }
@keyframes sending-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-3px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .msg time.sending { animation: none; opacity: .7; }
  .msg time.sending i { animation: none; }
}

/* ---------- Sign-in: tabs, password fields ---------- */
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 4px 0 16px;
  background: var(--field); border: 1px solid var(--border); border-radius: var(--radius);
}
.auth-tabs [role=tab] {
  min-height: 40px; border: 0; border-radius: 8px; background: none; cursor: pointer;
  color: var(--muted); font: inherit; font-size: 14px; font-weight: 600;
}
.auth-tabs [role=tab][aria-selected=true] { background: var(--surface); color: var(--text); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.auth-form .primary { margin-top: 4px; }
.auth-form > .hint { margin: -8px 0 16px; }
.auth-links { margin: 8px 0 0; }
.auth-links.center { text-align: center; margin-top: 12px; }

.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 52px !important; }
.pw-toggle {
  position: absolute; right: 2px; top: calc(50% + 3px); transform: translateY(-50%);
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 8px;
}
.pw-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pw-toggle.on { color: var(--accent); }
.hint.ok { color: #6EE7B7; margin-top: 8px; }
#verify-status .hint { display: block; margin-top: 8px; }

/* Toast: brief confirmation above the tab bar */
.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 30;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 999px;
  background: var(--dt-white); color: var(--dt-navy); font-size: 15px; font-weight: 600; text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  transform: translate(-50%, 8px); opacity: 0; transition: opacity .2s ease, transform .2s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 768px) { .toast { bottom: 32px; } }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

.auth-legacy { margin: 4px 0 0; }
.auth-subtitle { margin: 0 0 4px; font-size: 18px; line-height: 24px; }
.empty-state .secondary { margin-top: 10px; }
