/* ==========================================================================
   Podo Connect — design system
   Colored header + sober content, light & dark themes via [data-theme].
   ========================================================================== */

/* ---- Theme tokens ------------------------------------------------ */
:root,
[data-theme="light"] {
  --bg: #eef1f4;
  --bg-2: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #f3f6f8;
  --surface-3: #e9eef2;
  --text: #16222e;
  --text-soft: #41505f;
  --text-dim: #6b7a89;
  --border: #dfe6ec;
  --border-strong: #cdd7df;

  /* brand (header) — deep teal */
  --brand-1: #0d5c56;
  --brand-2: #0f766e;
  --brand-3: #149187;

  --link: #0f766e;
  --link-ink: #ffffff;

  --accent: #0f766e;
  --accent-2: #0e8a7f;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --accent-soft-strong: rgba(15, 118, 110, 0.18);
  --on-accent: #ffffff;

  --danger: #d33a3a;
  --danger-soft: #fdecec;
  --ok: #178a4f;
  --ok-soft: #e6f6ec;
  --warn: #b77600;
  --warn-soft: #fdf3df;

  --shadow-sm: 0 1px 2px rgba(23, 40, 55, 0.06), 0 1px 3px rgba(23, 40, 55, 0.06);
  --shadow: 0 1px 2px rgba(20, 34, 48, 0.05), 0 8px 24px -10px rgba(20, 34, 48, 0.14);
  --shadow-lg: 0 2px 6px rgba(20, 34, 48, 0.06), 0 22px 50px -22px rgba(20, 34, 48, 0.35);

  --footer-bg: #f1f4f7;
  --footer-border: #dfe6ec;
  --footer-head: #223040;
  --footer-text: #43535f;
  --footer-dim: #71808c;
  --footer-link: #0f766e;
  --footer-accent-bg: rgba(15, 118, 110, 0.10);

  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1160px;
}

[data-theme="dark"] {
  --bg: #0e151c;
  --bg-2: #131d27;
  --surface: #1a2531;
  --surface-2: #1f2b38;
  --surface-3: #2a3847;
  --text: #e7edf2;
  --text-soft: #b7c3cd;
  --text-dim: #8b9aa8;
  --border: #2a3744;
  --border-strong: #39495a;

  --brand-1: #0d5c56;
  --brand-2: #0f766e;
  --brand-3: #16a394;

  --link: #3ec7b8;
  --link-ink: #04231f;

  --accent: #1aa195;
  --accent-2: #2bb6a9;
  --accent-soft: rgba(26, 161, 149, 0.16);
  --accent-soft-strong: rgba(26, 161, 149, 0.26);
  --on-accent: #05211d;

  --danger: #ff7b7b;
  --danger-soft: rgba(255, 100, 100, 0.12);
  --ok: #57d18a;
  --ok-soft: rgba(80, 210, 140, 0.12);
  --warn: #ffc25c;
  --warn-soft: rgba(255, 190, 80, 0.12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 10px 28px -12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.3), 0 24px 55px -22px rgba(0, 0, 0, 0.65);

  --footer-bg: #0d151b;
  --footer-border: #223039;
  --footer-head: #eef4f7;
  --footer-text: #b9c8d0;
  --footer-dim: #7f98a3;
  --footer-link: #8be2d6;
  --footer-accent-bg: rgba(255, 255, 255, 0.08);
}

/* ---- Reset & base ----------------------------------------------- */
* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: "Manrope", "Plus Jakarta Sans", "Outfit", "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 340px);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
  transition: background 0.25s, color 0.25s;
}

a { color: var(--link); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-2); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ---- Header (colored, both themes) -------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 60;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-1) 0%, var(--brand-2) 55%, var(--brand-3) 130%);
  box-shadow: 0 2px 14px -6px rgba(6, 40, 37, 0.6);
}
.app-header a { color: inherit; }
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 24px;
  flex-wrap: wrap;
}

.logo { display: flex; align-items: center; gap: 12px; color: #fff !important; }
.logo-mark-wrap {
  display: grid; place-items: center;
  width: 42px; height: 42px; flex: 0 0 auto;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.logo-mark { width: 25px; height: 25px; }
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-text strong { font-size: 18px; font-weight: 800; letter-spacing: 0.1px; }
.logo-text small { color: rgba(255, 255, 255, 0.78); font-size: 11.5px; font-weight: 500; }

.app-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.nav-link {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 14px; font-weight: 500;
  white-space: nowrap;
  transition: background 0.16s, color 0.16s;
}
.nav-link .ic { opacity: 0.85; }
.nav-link:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.nav-link.active { background: rgba(255, 255, 255, 0.24); color: #fff; }
.nav-user {
  display: inline-flex; align-items: center; gap: 7px;
  margin: 0 4px; padding: 7px 12px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.nav-user .avatar {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.25); font-size: 12px;
}
.nav-user .ic { opacity: 0.9; }

/* User dropdown (avatar/name) */
.user-drop { position: relative; }
.nav-user { cursor: pointer; }
.user-drop .avatar { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); font-size: 12px; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  color: var(--text);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity 0.16s, transform 0.16s, visibility 0.16s;
  z-index: 70;
}
.user-drop:hover .user-menu,
.user-drop.open .user-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.user-menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 11px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--text);
  font-size: 14px; font-weight: 500; cursor: pointer; text-align: left;
}
.user-menu-item:hover { background: var(--surface-2); color: var(--accent); }
.user-menu-item[data-danger]:hover,
.user-menu-item.danger:hover { color: var(--danger); }

.theme-toggle {
  display: grid; place-items: center;
  width: 40px; height: 40px; flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff; cursor: pointer;
  transition: background 0.16s, transform 0.16s;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.22); transform: translateY(-1px); }
.theme-toggle .ic { width: 19px; height: 19px; }
[data-theme="light"] .theme-toggle .t-sun { display: none; }
[data-theme="dark"] .theme-toggle .t-moon { display: none; }

/* ---- Layout -------------------------------------------------------- */
.app-main { flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 30px 24px 70px; }
.container { max-width: var(--maxw); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; margin: 0; font-weight: 800; letter-spacing: -0.3px; }
.page-head .sub { color: var(--text-dim); font-size: 14px; margin-top: 3px; }
.page-head-actions { display: flex; gap: 10px; align-items: center; }

/* ---- Buttons --------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; border: 1px solid transparent; border-radius: 11px;
  padding: 10px 18px; font-size: 14.5px; font-weight: 600; line-height: 1;
  text-decoration: none; white-space: nowrap;
  background: var(--surface-2); color: var(--text);
  transition: transform 0.12s, background 0.16s, box-shadow 0.16s, border-color 0.16s;
}
.btn:hover { background: var(--surface-3); color: var(--text); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(180deg, var(--brand-2), var(--brand-1));
  color: var(--link-ink);
}
.btn-primary:hover { background: linear-gradient(180deg, var(--brand-3), var(--brand-2)); color: var(--link-ink); box-shadow: 0 6px 18px -8px rgba(15, 118, 110, 0.7); }
.btn-light { background: #fff; color: var(--brand-2); }
.btn-light:hover { background: #f0fffb; color: var(--brand-1); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger-soft) 80%, var(--danger)); color: var(--danger); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 8px 13px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 13px 24px; font-size: 15.5px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn .ic { flex: 0 0 auto; }

/* ---- Cards & surfaces ---------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card-title { margin: 0 0 6px; font-size: 19px; font-weight: 800; }
.card-sub { color: var(--text-dim); font-size: 13.5px; margin: 0 0 18px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }

/* ---- Hero (guest) ------------------------------------------------------ */
.hero { text-align: center; padding: 26px 0 10px; max-width: 760px; margin: 0 auto; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-soft); font-size: 13.5px; font-weight: 600; margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}
.eyebrow .ic { color: var(--accent); }
.hero h1 { font-size: clamp(34px, 5vw, 54px); margin: 0 0 16px; font-weight: 800; letter-spacing: -1px; }
.hero h1 .accent { color: var(--accent); }
.hero p { color: var(--text-soft); font-size: clamp(16px, 2vw, 19px); margin: 0 auto 28px; line-height: 1.6; max-width: 620px; }

/* Stats pills (one line, fully rounded) */
.stats-wrap { display: flex; justify-content: center; margin: 4px 0 2px; }
.stats { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: nowrap; padding: 4px; overflow-x: auto; max-width: 100%; }
.stat {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 10px 20px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  color: var(--text-dim); font-size: 13.5px; white-space: nowrap; flex: 0 0 auto;
}
.stat > .ic { color: var(--accent); flex: 0 0 auto; }
.stat b { color: var(--text); font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 1.2em; }
.stat-label { color: var(--text-dim); }
a.stat { text-decoration: none; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
a.stat:hover { transform: translateY(-1px); border-color: var(--accent); box-shadow: var(--shadow); }
@media (max-width: 620px) { .stats { justify-content: flex-start; } }

/* ---- Featured tiles (home) ---------------------------------------------- */
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 4px; }
.feat-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s, box-shadow 0.18s, border-color 0.18s;
}
.feat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.feat-thumb { position: relative; height: 168px; display: grid; place-items: center; overflow: hidden; background: var(--surface-2); color: var(--text-dim); border-bottom: 1px solid var(--border); }
.feat-thumb > .ic { display: grid; place-items: center; }
.feat-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.feat-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 14px 16px; flex: 1; }
.feat-title { font-size: 15.5px; font-weight: 700; color: var(--text); margin: 0; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.feat-title:hover { color: var(--accent); }
.feat-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.feat-meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--text-dim); font-size: 12px; margin-top: auto; }
.feat-meta .chip { font-size: 12px; }
.feat-price { font-weight: 800; color: var(--text); font-size: 15px; }
@media (max-width: 820px) { .feat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .feat-grid { grid-template-columns: 1fr; } }

/* ---- Forms ------------------------------------------------------------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13.5px; color: var(--text-soft); margin-bottom: 6px; font-weight: 600; }
.form-control, select.control, .control {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border-strong);
  color: var(--text); font-size: 14.5px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b9aa8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
textarea.form-control { min-height: 120px; resize: vertical; }
.form-row { display: flex; flex-direction: column; }
.field-error { color: var(--danger); font-size: 13px; margin-top: 5px; }
.form-hint { color: var(--text-dim); font-size: 12.5px; margin-top: 6px; }
.checkbox-row { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.checkbox-row input { width: 17px; height: 17px; accent-color: var(--accent); }
.checkbox-row label { color: var(--text-soft); }

.input-icon { position: relative; }
.input-icon .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; }
.input-icon .form-control { padding-left: 40px; }

/* ---- Filter bar --------------------------------------------------------- */
.filters {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.filters .field { display: flex; flex-direction: column; gap: 5px; min-width: 150px; flex: 1 1 150px; }
.filters .field label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-dim); font-weight: 700; }
.filters .field .control { flex: 1; min-width: 0; }
.filters .field.grow { flex: 1 1 220px; }
.filters .actions { display: flex; gap: 8px; }

/* ---- Listing rows -------------------------------------------------------- */
.list { display: flex; flex-direction: column; gap: 14px; }
.row-item {
  display: flex; gap: 18px; align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  text-decoration: none; color: inherit;
  transition: transform 0.14s, box-shadow 0.18s, border-color 0.18s;
}
.row-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.row-item .thumb {
  flex: 0 0 auto; width: 168px; min-height: 118px;
  border-radius: 12px; overflow: hidden;
  background: var(--surface-2);
  display: grid; place-items: center;
  border: 1px solid var(--border);
}
.row-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-item .thumb .ic { color: var(--text-dim); }
.gallery-ph { width: 100%; min-height: 320px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-dim); }
.row-body { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.row-top { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.row-title { font-size: 17px; font-weight: 700; color: var(--text); margin: 0; }
.row-title:hover { color: var(--accent); }
.row-title .id { color: var(--text-dim); font-weight: 600; font-size: 14px; }
.row-desc { color: var(--text-soft); font-size: 13.5px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row-foot { margin-top: auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; color: var(--text-dim); font-size: 13px; }
.row-price { margin-left: auto; font-weight: 800; font-size: 17px; color: var(--text); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-soft); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge .ic { width: 12px; height: 12px; }
.badge-accent { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.badge-accent.teal { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.badge-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.badge-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }

.chip { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 13px; white-space: nowrap; }
.chip .ic { width: 15px; height: 15px; }

/* ---- Price / key-value grid (detail) ------------------------------------- */
.price { color: var(--accent); font-weight: 800; font-size: 17px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.kv .k { color: var(--text-dim); font-size: 12.5px; }
.kv .v { font-weight: 700; margin-top: 2px; }

/* ---- Section / home --------------------------------------------------------- */
.section { margin-top: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title { display: inline-flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 800; margin: 0; }
.section-title .tile {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent);
}
.see-all { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; }

/* ---- Forum --------------------------------------------------------------- */
.answer { border-top: 1px solid var(--border); padding: 18px 0; display: flex; gap: 16px; }
.answer.accepted {
  background: var(--ok-soft);
  border: 1px solid color-mix(in srgb, var(--ok) 55%, transparent);
  border-radius: 14px;
  margin: 4px 0;
  padding: 16px;
}
.accepted .answer-score { align-self: center; }
.thr-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.thr-img { position: relative; margin: 0; }
.thr-img img { width: 100%; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); display: block; }
.thr-del { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: rgba(0, 0, 0, 0.55); color: #fff; cursor: pointer; }
.thr-del:hover { background: var(--danger); }
.answers > .answer:first-child { border-top: 0; }
.answer-score { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 46px; }
.vote-btn {
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 9px; width: 32px; height: 32px; cursor: pointer; padding: 0;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.vote-btn .ic { width: 16px; height: 16px; }
.vote-btn:hover { background: var(--surface-3); }
.vote-btn.on { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); border-color: transparent; }
.vote-score { font-weight: 800; font-size: 14px; }
.answer-body { flex: 1; min-width: 0; }
.answer-author { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; color: var(--text-dim); font-size: 13px; }
.answer-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.accepted-flag { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 700; font-size: 13px; margin-bottom: 8px; }

/* ---- Chat ---------------------------------------------------------------- */
.chat-box { display: flex; flex-direction: column; gap: 10px; max-height: 58vh; overflow: auto; padding: 4px 2px; }
.bubble { max-width: 74%; padding: 10px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.bubble.mine { align-self: flex-end; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-bottom-right-radius: 4px; border-color: transparent; }
.bubble.theirs { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble .who { font-size: 11.5px; color: var(--text-dim); margin-bottom: 3px; font-weight: 600; }
.bubble .msg { white-space: pre-wrap; line-height: 1.5; }
.composer { display: flex; gap: 10px; margin-top: 14px; }
.composer .form-control { flex: 1; }
.composer-closed { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border-strong); color: var(--text-dim); }
.composer-closed .ic { color: var(--warn); }

/* ---- Conversation list / open chat -------------------------------------- */
.conv-list { display: flex; flex-direction: column; gap: 10px; }
.conv-row {
  display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px;
  transition: transform 0.12s, box-shadow 0.15s, border-color 0.15s;
}
.conv-row:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.conv-row.conv-closed { opacity: 0.55; }
.conv-thumb { flex: 0 0 auto; width: 56px; height: 56px; border-radius: 12px; overflow: hidden; display: grid; place-items: center; background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border); }
.conv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.conv-thumb.sm { width: 44px; height: 44px; border-radius: 10px; }
.conv-body { flex: 1; min-width: 0; }
.conv-top { display: flex; align-items: center; gap: 10px; }
.conv-title { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.conv-preview { margin-top: 3px; font-size: 13px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-meta { margin-top: 5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-dim); }
.conv-meta .ic { opacity: 0.7; }
.pill-orange { flex: 0 0 auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; background: var(--warn); color: #fff; font-size: 12px; font-weight: 700; }
.chat-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.chat-item { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.chat-item .conv-body strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Nav unread badge ---------------------------------------------------- */
.nav-link .nav-badge, .nav-badge { min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px; background: var(--warn); color: #fff; font-size: 10.5px; font-weight: 800; align-items: center; justify-content: center; }

/* ---- Busy overlay -------------------------------------------------------- */
#busy { position: fixed; inset: 0; z-index: 300; background: rgba(6, 20, 18, 0.42); backdrop-filter: blur(1px); display: none; align-items: center; justify-content: center; }
#busy.on { display: flex; }
.busy-inner { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; padding: 16px 20px; box-shadow: var(--shadow-lg); font-weight: 600; }

/* ---- Pending message bubble ---------------------------------------------- */
.bubble.pending { opacity: 0.92; border-color: var(--warn) !important; background: color-mix(in srgb, var(--warn) 16%, var(--surface)); }
.bubble .send-state { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 11px; color: var(--warn); font-weight: 600; }
.bubble .send-state.error { color: var(--danger); }
.spin-xs { width: 11px; height: 11px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: sp 0.7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---- Modal --------------------------------------------------------------- */
.modal-ovl { position: fixed; inset: 0; z-index: 200; background: rgba(6, 20, 18, 0.5); display: flex; align-items: center; justify-content: center; padding: 18px; backdrop-filter: blur(2px); }.modal { width: 100%; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; max-height: calc(100dvh - 24px); display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); font-size: 16px; flex: 0 0 auto; }
.modal-x { border: 0; background: transparent; color: var(--text-dim); font-size: 15px; cursor: pointer; padding: 2px; line-height: 1; }
.modal-x:hover { color: var(--text); }
.modal-body { padding: 18px; overflow-y: auto; min-height: 0; }

/* ---- Alerts -------------------------------------------------------------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 15px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; margin-bottom: 16px; }
.alert .ic { margin-top: 1px; flex: 0 0 auto; }
.alert-error { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.alert-info { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent); }
.alert-success { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.alert-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
/* L'état masqué est géré par l'attribut [hidden] : ne PAS forcer display ici,
   sinon l'encadré reste visible même vide. */
.register-banner { padding: 12px 15px; border-radius: 12px; background: var(--warn-soft); border: 1px solid transparent; color: var(--warn); font-size: 14px; line-height: 1.5; margin-bottom: 16px; }
.register-banner[hidden] { display: none; }

/* Bannière "mode impersonation" : pleine largeur, juste sous le header. */
#imp-bar { position: fixed; left: 0; right: 0; z-index: 400; padding: 0 16px; }
#imp-bar .imp-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  background: var(--warn); color: var(--surface);
  padding: 9px 14px; border-radius: 0 0 12px 12px;
  font-size: 13px; box-shadow: 0 6px 18px rgba(0, 0, 0, .14);
  flex-wrap: wrap;
}
#imp-bar .imp-inner strong { color: var(--surface); }
#imp-bar #imp-back { flex: 0 0 auto; }

/* ---- Toasts -------------------------------------------------------------- */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  font-size: 14px; max-width: 90vw;
  animation: rise 0.25s ease;
}
.toast .toast-ic { color: var(--accent); display: grid; place-items: center; }
.toast.out { opacity: 0; transform: translateY(6px); transition: 0.25s; }
.toast-error .toast-ic { color: var(--danger); }
.toast-warn .toast-ic { color: var(--warn); }
@keyframes rise { from { opacity: 0; transform: translateY(10px);} to { opacity: 1; transform: none; } }

/* ---- Misc ---------------------------------------------------------------- */
.muted { color: var(--text-dim); }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; } .mt-2 { margin-top: 20px; } .mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; } .mb-2 { margin-bottom: 20px; } .mb-3 { margin-bottom: 30px; }
.small { font-size: 13px; }
.pill-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

.loading { display: flex; justify-content: center; padding: 70px 0; color: var(--text-dim); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--border-strong);
  border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 26px; align-items: start; }
.job-detail { max-width: 880px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; gap: 16px; } }

.noimg { color: var(--text-dim); }

/* ---- Footer -------------------------------------------------------------- */
.app-footer { background: var(--footer-bg); color: var(--footer-text); border-top: 1px solid var(--footer-border); padding: 40px 28px 24px; transition: background 0.25s, color 0.25s; }
.app-footer a { color: var(--footer-link); }
.app-footer a:hover { color: var(--footer-head); }
.footer-inner { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 30px; }
.footer-inner h4 { margin: 0 0 12px; font-size: 14px; color: var(--footer-head); text-transform: uppercase; letter-spacing: 0.6px; }
.footer-inner .brand-lockup { display: flex; gap: 12px; align-items: center; }
.footer-inner .brand-lockup .mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--footer-accent-bg); color: var(--footer-link); }
.footer-inner .brand-lockup .mark svg { width: 22px; height: 22px; }
.footer-inner ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 14px; }
.footer-inner p { color: var(--footer-dim); }
.footer-bottom { max-width: var(--maxw); margin: 30px auto 0; padding-top: 18px; border-top: 1px solid var(--footer-border); color: var(--footer-dim); font-size: 13px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
@media (max-width: 720px) { .footer-inner { grid-template-columns: 1fr; } }

/* ---- Legal --------------------------------------------------------------- */
.legal { max-width: 820px; margin: 0 auto; }
.legal h1 { font-size: 30px; }
.legal h2 { font-size: 19px; margin-top: 30px; color: var(--accent); }
.legal p, .legal li { color: var(--text-soft); line-height: 1.7; }

/* ---- Gallery (detail images) -------------------------------------------- */
.gallery-main { width: 100%; border-radius: 14px; max-height: 460px; object-fit: cover; border: 1px solid var(--border); }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 10px; }
.gallery-thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; cursor: pointer; border: 2px solid var(--border); opacity: 0.85; transition: opacity 0.15s, border-color 0.15s; }
.gallery-thumbs img:hover { opacity: 1; border-color: var(--accent); }

/* Image manager (drag to reorder / delete / add) */
.imgmng-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.imgmng-tile {
  position: relative; width: 118px; height: 118px; flex: 0 0 auto;
  border-radius: 12px; overflow: hidden; cursor: grab;
  border: 2px solid var(--border-strong); background: var(--surface-2);
  transition: box-shadow 0.15s, opacity 0.15s, border-color 0.15s;
}
.imgmng-tile.is-main { border-color: var(--accent); }
.imgmng-tile img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.imgmng-tile.dragging { opacity: 0.45; }
.imgmng-tile.drop-before { box-shadow: -4px 0 0 0 var(--accent); }
.imgmng-del {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  display: grid; place-items: center; width: 22px; height: 22px;
  border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.62);
  color: #fff; font-size: 12px; line-height: 1; cursor: pointer;
}
.imgmng-del:hover { background: var(--danger); }
.imgmng-main {
  position: absolute; left: 6px; bottom: 6px; z-index: 2;
  padding: 2px 8px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 600;
}
.imgmng-actions { margin-top: 14px; }
.imgmng-add { display: inline-flex; }
.imgmng-add input { display: none; }

/* ---- Footer nav usage, small helpers ------------------------------------- */
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border-radius: 11px; }
.spacer { flex: 1; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flex { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.gap-0 { gap: 0; }

/* Responsive: rows collapse to vertical thumb on small screens */
@media (max-width: 960px) {
  .only-wide { display: none; }
  .logo-text small { display: none; }
}
@media (max-width: 620px) {
  /* Keep rows horizontal with a small square thumbnail (thumb stays beside text).
     Entries with an explicit inline size (e.g. #/compte menu, 48px) keep it. */
  .row-item { flex-direction: row; align-items: stretch; }
  .row-item .thumb { width: 92px; height: 92px; align-self: stretch; }
  .row-price { margin-left: auto; }
  .app-main { padding: 20px 14px 60px; }
  .header-inner { padding: 10px 14px; }
}

/* ---- Bottom tab bar (iOS-style, mobile) ---------------------------------- */
.tabbar {
  display: none;
}
@media (max-width: 900px) {
  /* Masque la barre de navigation du haut sur mobile. */
  .app-nav { display: none !important; }

  .tabbar {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -6px 20px -12px rgba(0, 0, 0, 0.35);
    padding-bottom: env(safe-area-inset-bottom);
  }
  body:not(.logged-in) .tabbar { display: none; }
  .tab-item {
    flex: 1 1 0;
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; min-width: 0;
    padding: 8px 2px 7px;
    color: var(--text-dim);
    font-size: 10.5px; font-weight: 600; text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .tab-item .ic { display: block; }
  .tab-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tab-item.active { color: var(--accent); }
  .tab-item .nav-badge { position: absolute; top: 2px; right: calc(50% - 16px); }

  /* Décalage du contenu pour ne pas être caché derrière la barre. */
  .app-main { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .app-footer { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
}
@media (max-width: 480px) {
  .tab-item span { font-size: 10px; }
  .tab-item { padding-top: 6px; padding-bottom: 5px; }
}


/* ---- Small phones: tidy spacing ------------------------------------------ */
@media (max-width: 560px) {
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head h1 { font-size: 23px; }
  .page-head-actions { flex-wrap: wrap; }
  .page-head-actions .btn { flex: 1 1 auto; }
  .legal h1 { font-size: 25px; }
  .chat-head { flex-wrap: wrap; }
  .composer .btn { padding: 10px 12px; }
}
@media (max-width: 480px) {
  .modal { max-width: calc(100vw - 20px) !important; max-height: calc(100dvh - 20px) !important; display: flex; flex-direction: column; overflow: hidden; }
  .modal-body { padding: 14px; overflow-y: auto; min-height: 0; }
  .modal-head { flex: 0 0 auto; }
  .btn { padding: 10px 14px; font-size: 14px; }
  .nav-link { font-size: 14.5px; }
  .gallery-thumbs img { width: 52px; height: 52px; }
  .gallery-main { max-height: 300px; }
}



/* ===========================================================================
   Mobile refinement (mobile-first tweaks)
   =========================================================================== */

/* Bottom tab bar slightly taller */
@media (max-width: 1000px) {
  .tabbar { min-height: 60px; }
  .tab-item { padding-top: 10px; padding-bottom: 9px; gap: 3px; }

  /* Compact header (logo + theme) */
  .header-inner { padding: 8px 14px; gap: 8px; }
  .logo { gap: 8px; }
  .logo-mark-wrap { width: 32px; height: 32px; border-radius: 9px; }
  .logo-mark { width: 19px; height: 19px; }
  .logo-text strong { font-size: 15px; }
  .theme-toggle { width: 36px; height: 36px; }

  /* Hide the redundant page headings/summaries */
  .page-head { margin-bottom: 12px; }
  .page-head h1, .page-head .sub { display: none; }

  /* Homepage stats pills fit on one line */
  .stats { gap: 8px; justify-content: center; overflow: visible; }
  .stat { padding: 6px 11px; }
  .stat .ic { width: 16px; height: 16px; }
  .stat b { font-size: 15px; }
  .stat-label { font-size: 11px; }
}

/* Homepage feature cards: horizontal rows, small image, hide pills */
@media (max-width: 760px) {
  .feat-grid { grid-template-columns: 1fr !important; }
  .feat-card { flex-direction: row; align-items: stretch; }
  .feat-card .feat-thumb { flex: 0 0 auto; width: 112px; align-self: stretch; min-height: 112px; border-bottom: 0; border-right: 1px solid var(--border); }
  .feat-body { padding: 12px 14px; }
  .feat-chips { display: none !important; }
}

/* Listings keep a horizontal row layout on small screens (small thumbnail) */
@media (max-width: 760px) {
  .list .row-item { flex-direction: row; }
  .row-item .thumb { flex: 0 0 auto; width: 92px; height: 92px; border-radius: 10px; }
  .row-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
  .row-item .thumb .ic { width: 30px; height: 30px; }
  .row-top { flex-direction: column; align-items: flex-start; gap: 2px; }
  .row-title { font-size: 15px; }
  .row-top .price { font-size: 14px; }
}

/* ===========================================================================
   Mobile search / filter pills / FAB
   =========================================================================== */
.search-bar { display: flex; gap: 8px; margin: 0 0 10px; align-items: stretch; }
.search-bar .grow { flex: 1; min-width: 0; }
.search-bar .btn { flex: 0 0 auto; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.fpill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 999px; cursor: pointer;
  background: var(--surface-2); color: var(--text-soft);
  border: 1px solid var(--border-strong); font-size: 13px; font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}
.fpill.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.choice-opt {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 12px 14px; margin: 2px 0; border-radius: 10px; border: 0;
  background: transparent; color: var(--text); font-size: 15px; font-weight: 500;
  cursor: pointer; text-align: left;
}
.choice-opt:hover { background: var(--surface-2); }
.choice-opt.active { background: var(--accent-soft); color: var(--accent); }
.choice-list { display: flex; flex-direction: column; max-height: 60vh; overflow: auto; }

/* Floating "+" action button */
.fab {
  position: fixed; right: 18px; bottom: calc(74px + env(safe-area-inset-bottom));
  z-index: 90; display: none; place-items: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(180deg, var(--brand-2), var(--brand-1));
  color: #fff; box-shadow: 0 8px 22px -8px rgba(15, 118, 110, 0.8);
  text-decoration: none;
}
.fab:active { transform: scale(0.94); }

@media (max-width: 760px) {
  .fab { display: grid; }
  .m-hide { display: none !important; }
}

/* ===========================================================================
   Mobile tuning (overrides)
   =========================================================================== */
@media (max-width: 1000px) {
  /* Tab bar ~25% taller than original with slightly bigger icons */
  .tabbar { min-height: 75px; }
  .tabbar .tab-item { padding-top: 9px; padding-bottom: 7px; gap: 4px; }
  .tabbar .tab-item .ic { width: 26px; height: 26px; }
  .tabbar .tab-item span { font-size: 10.5px; }
  .app-main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .app-footer { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .fab { bottom: calc(90px + env(safe-area-inset-bottom)); }
}
@media (max-width: 760px) {
  /* feat-thumb never taller than its card */
  .feat-card .feat-thumb { min-height: 0; height: auto; align-self: stretch; width: 124px; }
  /* tighter spacing between home sections */
  .section { margin-top: 10px; }
}

/* ===========================================================================
   Design polish — typography, states, numerics, a11y (2026 redesign pass)
   =========================================================================== */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  padding: 10px 16px; border-radius: 0 0 10px 0;
  background: var(--accent); color: #fff; font-weight: 700;
}
.skip-link:focus-visible { left: 0; }

/* Numeric data stays aligned */
.price, .row-price, .feat-price, .stat b, .vote-score, .kv .v,
.pill-orange, .nav-badge, .card-title, .row-title .id { font-variant-numeric: tabular-nums; }

/* Display type: tighter, heavier, intentional */
.page-head h1 { font-size: clamp(23px, 2.6vw, 30px); letter-spacing: -0.035em; line-height: 1.04; }
.hero h1 { letter-spacing: -0.045em; line-height: 1.0; }
.hero .sub, .page-head .sub, .card-sub { text-wrap: pretty; }
.feat-title, .row-title, .conv-title, .chat-title { line-height: 1.25; }

/* Press feedback + calm default shadow on primary CTA */
.btn:active, .fab:active { transform: scale(0.97); }
.btn-primary { box-shadow: 0 10px 20px -14px rgba(15, 118, 110, 0.75); }

/* Keep custom field rings, avoid double outline */
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

/* Active filter pills now that the token exists */
.fpill.active, .choice-opt.active { background: var(--accent-soft); }
.fpill { transition: background 0.14s, border-color 0.14s, color 0.14s, transform 0.14s; }
.fpill:hover { background: var(--surface-3); }
.fpill:active { transform: scale(0.96); }

/* ===========================================================================
   Deeper design pass — rhythm, elevation, micro-details (2026, CSS-only)
   =========================================================================== */
html { scroll-behavior: smooth; }

/* Text selection carries the brand */
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); color: var(--text); }

/* Consistent, quiet scrollbars (WebKit) */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--border-strong) 60%, var(--text-dim)); background-clip: padding-box; border: 3px solid transparent; }

/* More generous vertical rhythm */
.app-main { padding-top: 38px; }
.section { margin-top: 34px; }
.section-head { margin-bottom: 18px; }
.section-title { font-size: 20px; }
.list { gap: 16px; }

/* Surfaces: rely more on elevation than outline; keep a hairline for dark */
.card, .panel, .filters, .feat-card, .row-item, .conv-row {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, var(--accent) 2%), var(--surface));
}
.card { padding: 24px; }
.card-sub { margin-bottom: 22px; }

/* Refined elevation on interactive, clickable surfaces */
.feat-card:hover, .row-item:hover, .conv-row:hover,
.feat-card:focus-visible, .row-item:focus-visible, .conv-row:focus-visible {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

/* Buttons: primary keeps a real colored glow; default gets a quiet edge */
.btn:not(.btn-primary):not(.btn-light):not(.btn-ghost) { border-color: var(--border); }
.btn-primary { box-shadow: 0 12px 24px -14px rgba(15, 118, 110, 0.85); }
.btn-ghost:hover { transform: translateY(-1px); }

/* Inputs: hover affordance + steady focus, softer radius for grouped feels */
.form-control:hover, .control:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--accent)); }
textarea.form-control { min-height: 130px; }

/* Chips / badges read as quiet tags, not pills of noise */
.badge { letter-spacing: 0.01em; }

/* Headers: a touch more presence and space between title and action */
.page-head { margin-bottom: 22px; }
.header-inner { padding: 16px 24px; }

/* Hero breathes on desktop, tightened on mobile later */
.hero { padding: 40px 0 14px; }
.eyebrow { letter-spacing: 0.02em; }

/* Footer: lift it out of the page background with a hairline top and tone */
.app-footer { border-top-color: var(--footer-border); }
.footer-bottom { font-size: 12.5px; }

/* Modal bottom sheet feel on mobile */
.modal { border-radius: 18px; }
@media (max-width: 560px) {
  .modal { border-radius: 20px 20px 0 0; }
  .app-main { padding-top: 26px; }
  .section { margin-top: 26px; }
}

/* ===========================================================================
   Mobile zoom control (SPA app feel). Prevents double-tap / pinch re-zoom and
   iOS auto-zoom on input focus (Safari zooms when field font-size < 16px).
   =========================================================================== */
html { touch-action: manipulation; }
body { -webkit-text-size-adjust: 100%; }
@media (max-width: 760px) {
  input, select, textarea { font-size: 16px; }
}

/* ===========================================================================
   Messaging header on small screens: compact, never wider than the viewport.
   The item identity wraps to its own full-width truncated line so the buttons
   and title can't push the header wider than the screen.
   =========================================================================== */
@media (max-width: 640px) {
  .chat-head { gap: 8px 8px; flex-wrap: wrap; align-items: center; }
  .chat-head > a, .chat-head > button { max-width: 100%; }
  .chat-head .chat-item { order: 3; flex: 1 1 100%; min-width: 0; gap: 9px; }
  .chat-head .chat-item .conv-body { min-width: 0; flex: 1; }
  .chat-head .chat-item .conv-body strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .chat-head .muted.small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .chat-head .btn-sm { padding: 8px 10px; font-size: 12.5px; }
}

/* ===========================================================================
   Chat mode (single conversation): fixed to the visible viewport. The page
   does not scroll; the message list scrolls inside the card, filling exactly
   the space between the sticky app-header and the bottom (never smaller or
   larger). Applied via body.chat-mode on the conversation route.
   =========================================================================== */
body.chat-mode { overflow: hidden; height: 100vh; height: 100dvh; min-height: 0; }
body.chat-mode .app-footer { display: none; }

/* .app-main already sits below the sticky header in flow; make it fill the
   remaining viewport as a flex column and never grow past it. */
body.chat-mode .app-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding-top: 16px;
  padding-bottom: 16px;
}

body.chat-mode .chat-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* The card hosting the messages takes all leftover height and becomes an
   internal flex column so its message list can scroll. */
body.chat-mode .chat-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

body.chat-mode .chat-box {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 16px;
}

/* Composer pinned to the bottom of the card. */
body.chat-mode .composer,
body.chat-mode .composer-closed {
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex: 0 0 auto;
}
body.chat-mode .composer-closed { border-radius: 0; }

/* On mobile the fixed bottom tab bar overlays the viewport bottom, so reserve
   room for it so the composer never sits underneath. */
@media (max-width: 900px) {
  body.chat-mode .app-main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* ===========================================================================
   iOS standalone PWA (Dynamic Island / notch). Only applied when
   html.ios-standalone is set by JS (i.e. iOS Safari home-screen PWA only).
   Pushes the sticky header content below the top safe-area so it never sits
   under the clock / wifi / battery. Android is untouched.
   =========================================================================== */
html.ios-standalone .app-header {
  padding-top: max(4px, calc(env(safe-area-inset-top, 0px) - 18px));
}

/* ===========================================================================
   Pre-login homepage on small screens: nudge spacing slightly tighter (from
   the original) so the whole login card fits without scrolling. Scoped to
   .guest so logged-in pages are unaffected. Deliberately subtle.
   =========================================================================== */
@media (max-width: 760px) {
  .guest .hero { padding-top: 8px; }
  .guest .eyebrow { margin-bottom: 14px; padding: 7px 14px; font-size: 13px; }
  .guest .hero h1 { font-size: clamp(28px, 7vw, 34px); margin-bottom: 10px; }
  .guest .hero p { font-size: 15px; line-height: 1.55; margin-bottom: 16px; }
  .guest .stats-wrap { margin-top: -2px; }
  .guest .mt-3 { margin-top: 18px; }
  .guest .card { padding: 20px; }
}
/* Very short viewports (e.g. small landscape) drop the tagline to fit the form. */
@media (max-width: 760px) and (max-height: 600px) {
  .guest .hero p { display: none; }
  .guest .stats-wrap { display: none; }
  .guest .mt-3 { margin-top: 10px; }
}

/* ===========================================================================
   Stats pills on small screens: give side breathing room and stack the number
   above its label when space is really tight.
   =========================================================================== */
.stats-wrap { padding: 0 4px; }
.stats { overflow-x: auto; }
@media (max-width: 480px) {
  .stats-wrap { padding: 0 8px; }
  .stat {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 0;
    align-items: center;
    text-align: left;
    padding: 8px 14px;
    flex: 1 1 0;
    min-width: 0;
  }
  .stat > .ic { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
  .stat b { grid-column: 2; grid-row: 1; line-height: 1.1; }
  .stat-label { grid-column: 2; grid-row: 2; line-height: 1; margin-top: 1px; }
  .stats { width: 100%; }
}

/* ===========================================================================
   Custom city autocomplete dropdown (replaces the native <datalist> picker)
   =========================================================================== */
.city-wrap { position: relative; }
.city-list {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 4px);
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  max-height: 220px;
  overflow: auto;
}
.city-list:empty { display: none; }
.city-item {
  display: block; width: 100%; text-align: left;
  padding: 9px 12px;
  border: 0; background: transparent; color: var(--text);
  font-size: 14px; cursor: pointer;
}
.city-item:hover, .city-item.active { background: var(--surface-2); }

/* Searchable single-choice modal (city filter popup) */
.choice-search { margin-bottom: 8px; }
.choice-search-list { max-height: 280px; overflow: auto; }
