/* =====================================================================
 * DigiSurvey — Hub design layer (Survey Hub + Report Hub)
 * ---------------------------------------------------------------------
 * One design language for the two list/browse screens: top bar with the
 * DigiSurvey wordmark, page header, KPI tiles, filter toolbar, survey
 * cards, folder cards, skeletons and empty states.
 * Builds on shared/design-tokens.css (light + dark). Chrome 109-safe:
 * no :has(), container queries, color-mix() or CSS nesting.
 * ===================================================================== */

:root, [data-theme="dark"] {
  --hub-max: 1320px;
  --hub-accent: #5b8cff;          /* brand royal blue (dark) */
  --hub-accent-soft: rgba(91, 140, 255, 0.14);
  --hub-teal: #35d0bb;
  --hub-teal-soft: rgba(53, 208, 187, 0.14);
  --hub-info: #8fb3ff;
  --hub-info-soft: rgba(143, 179, 255, 0.14);
  --hub-topbar: rgba(8, 18, 33, 0.86);
  --hub-field: #0b1728;
  --hub-skel-a: rgba(158, 178, 210, 0.07);
  --hub-skel-b: rgba(158, 178, 210, 0.16);
  --hub-card-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 6px 18px rgba(0, 0, 0, 0.22);
  --hub-card-shadow-hover: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 16px 36px rgba(0, 0, 0, 0.38);
  --hub-mosaic-bg: #0b1627;
  --hub-gold: #e9b949;            /* brand gold — the tick in the mark */
  --hub-gold-soft: rgba(233, 185, 73, 0.14);
  --hub-gold-line: rgba(233, 185, 73, 0.55);
}
[data-theme="light"] {
  --hub-accent: #2563eb;          /* brand royal blue */
  --hub-accent-soft: rgba(37, 99, 235, 0.10);
  --hub-teal: #0f766e;
  --hub-teal-soft: rgba(15, 118, 110, 0.1);
  --hub-info: #2f5fc4;
  --hub-info-soft: rgba(47, 95, 196, 0.09);
  --hub-topbar: rgba(255, 255, 255, 0.9);
  --hub-field: #ffffff;
  --hub-skel-a: rgba(11, 37, 69, 0.05);
  --hub-skel-b: rgba(11, 37, 69, 0.1);
  --hub-card-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 14px rgba(15, 23, 42, 0.05);
  --hub-card-shadow-hover: 0 2px 4px rgba(15, 23, 42, 0.06), 0 16px 34px rgba(15, 23, 42, 0.1);
  --hub-mosaic-bg: #eef0f3;
  --hub-gold: #b7791f;
  --hub-gold-soft: rgba(183, 121, 31, 0.12);
  --hub-gold-line: rgba(183, 121, 31, 0.5);
}

/* lit command-deck canvas — a cool-blue aura top-left, a faint gold aura
   top-right, over the base, so every hub screen has depth, not flat black.
   Matches the Dashboard so the whole app reads as one system. */
.hub-page {
  background:
    radial-gradient(1150px 540px at 6% -10%, rgba(37, 99, 235, 0.14), transparent 58%),
    radial-gradient(900px 460px at 100% -8%, var(--hub-gold-soft), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text-primary); font-family: var(--font-sans); min-height: 100vh; overflow-x: hidden;
}
.hub-page *, .hub-page *::before, .hub-page *::after { box-sizing: border-box; }
.hub-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.hub-top {
  position: sticky; top: 0; z-index: 30;
  background: var(--hub-topbar); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .hub-top { background: var(--surface); } }
.hub-top-in { max-width: var(--hub-max); margin: 0 auto; padding: 0 16px; height: 60px; display: flex; align-items: center; gap: 12px; }
.hub-brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text-primary); text-decoration: none; }
.hub-logo { width: 30px; height: 30px; flex: 0 0 auto; }
.hub-logo-ring { transform-box: fill-box; transform-origin: 50% 50%; animation: hubspin 10s linear infinite; }
@keyframes hubspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .hub-logo-ring { animation: none; } }
.hub-wm { display: flex; flex-direction: column; line-height: 1; min-width: 0; }
.hub-wm-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -0.2px; white-space: nowrap; }
.hub-wm-name b { font-weight: 700; color: var(--hub-accent); }
.hub-wm-by { font-size: 10px; color: var(--text-muted); margin-top: 3px; letter-spacing: .2px; white-space: nowrap; }
.hub-crumb { display: none; align-items: center; gap: 8px; padding-left: 12px; margin-left: 2px; border-left: 1px solid var(--border-strong); font-size: 13px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
@media (min-width: 720px) { .hub-crumb { display: flex; } }
.hub-top-spacer { flex: 1; }
.hub-top-actions { display: flex; align-items: center; gap: 6px; }
.hub-icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: transparent;
  color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; padding: 0;
  transition: background .15s, color .15s, border-color .15s;
}
.hub-icon-btn:hover { background: var(--hover); color: var(--text-primary); border-color: var(--border-strong); }
.hub-icon-btn svg { width: 17px; height: 17px; }
.hub-hide-sm { display: none !important; }
@media (min-width: 720px) { .hub-hide-sm { display: inline-flex !important; } }
@media (max-width: 719px) { .hub-hide-lg-only { display: none !important; } }
.hub-back { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); text-decoration: none; padding: 8px 10px; border-radius: 9px; }
.hub-back:hover { color: var(--text-primary); background: var(--hover); }

/* ---------- buttons ---------- */
.hub-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--card); color: var(--text-primary);
  font: 600 13px/1 var(--font-sans); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .12s, box-shadow .15s;
}
.hub-btn:hover { background: var(--card-hover); border-color: var(--text-muted); }
.hub-btn:active { transform: translateY(1px); }
.hub-btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.hub-btn-primary { background: var(--primary); border-color: var(--primary); color: var(--text-on-primary); box-shadow: 0 6px 16px rgba(228, 176, 74, 0.22); }
[data-theme="light"] .hub-btn-primary { box-shadow: 0 6px 16px rgba(11, 37, 69, 0.18); }
.hub-btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.hub-btn-sm { min-height: 34px; padding: 0 12px; font-size: 12.5px; }
.hub-btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.hub-btn-ghost:hover { background: var(--hover); border-color: transparent; color: var(--text-primary); }

.hub-page a:focus-visible, .hub-page button:focus-visible, .hub-page select:focus-visible, .hub-page input:focus-visible,
.hub-page summary:focus-visible, .hub-page [tabindex]:focus-visible {
  outline: 2px solid var(--hub-accent); outline-offset: 2px;
}

/* ---------- layout ---------- */
.hub-main { max-width: var(--hub-max); margin: 0 auto; padding: 20px 16px 48px; }
@media (min-width: 720px) { .hub-main { padding: 28px 24px 64px; } }

.hub-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 20px; margin-bottom: 20px;
  position: relative; overflow: hidden; padding: 20px 22px 20px 26px; border-radius: 18px;
  background: radial-gradient(280px 190px at 100% 0, var(--hub-accent-soft), transparent 70%), var(--card);
  border: 1px solid var(--border); box-shadow: var(--hub-card-shadow); }
.hub-head::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, #16a06b, #3b82f6); }
.hub-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--hub-gold); margin-bottom: 6px; display: inline-flex; align-items: center; gap: 8px; }
.hub-eyebrow::before { content: ''; width: 18px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--hub-gold), transparent); }
.hub-title { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.4px; display: flex; align-items: center; gap: 10px; margin: 0; }
@media (min-width: 720px) { .hub-title { font-size: 28px; } }
.hub-count { font: 600 12px/1 var(--font-mono); padding: 5px 9px; border-radius: 999px; background: var(--hub-accent-soft); color: var(--hub-accent); letter-spacing: 0; }
.hub-subtitle { color: var(--text-secondary); font-size: 13.5px; margin-top: 6px; max-width: 560px; line-height: 1.5; }
.hub-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- KPI tiles ---------- */
.hub-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
@media (min-width: 900px) { .hub-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
.kpi {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; text-align: left; width: 100%;
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--hub-card-shadow); cursor: pointer; color: inherit; font: inherit;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.kpi:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--hub-card-shadow-hover); }
.kpi.active { border-color: var(--hub-accent); box-shadow: 0 0 0 1px var(--hub-accent) inset, var(--hub-card-shadow); }
.kpi-ic { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28); }
.kpi-ic svg { width: 18px; height: 18px; }
/* Dual-colour scheme: green + blue */
.kpi-ic.gold { background: linear-gradient(140deg, #16a06b, #0f7a52); box-shadow: 0 8px 18px -10px #16a06b, inset 0 1px 0 rgba(255, 255, 255, 0.28); }
.kpi-ic.info { background: linear-gradient(140deg, #3b82f6, #2563eb); box-shadow: 0 8px 18px -10px #3b82f6, inset 0 1px 0 rgba(255, 255, 255, 0.28); }
.kpi-ic.teal { background: linear-gradient(140deg, #16a06b, #0f7a52); box-shadow: 0 8px 18px -10px #16a06b, inset 0 1px 0 rgba(255, 255, 255, 0.28); }
.kpi-ic.warn { background: linear-gradient(140deg, #3b82f6, #2563eb); box-shadow: 0 8px 18px -10px #3b82f6, inset 0 1px 0 rgba(255, 255, 255, 0.28); }
.kpi:hover { transform: translateY(-2px); }
.kpi:hover .kpi-ic { transform: translateY(-1px) scale(1.04); transition: transform .18s ease; }
.kpi-txt { min-width: 0; }
.kpi-val { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1; letter-spacing: -0.3px; }
.kpi-lbl { font-size: 12px; color: var(--text-secondary); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- toolbar ---------- */
.hub-toolbar { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-bottom: 18px; box-shadow: var(--hub-card-shadow); }
.hub-tb-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hub-tb-row + .hub-tb-row { margin-top: 10px; }
.hub-search { position: relative; flex: 1 1 260px; min-width: 0; }
.hub-search > .icon-inline { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); display: flex; pointer-events: none; z-index: 1; color: var(--hub-gold); }
.hub-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--hub-gold); pointer-events: none; z-index: 1; }
.hub-search > .icon-inline svg { position: static; transform: none; left: auto; top: auto; }
.hub-search input {
  width: 100%; height: 44px; padding: 0 40px 0 42px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--hub-field); color: var(--text-primary); font: 500 14px var(--font-sans);
  box-shadow: 0 2px 8px rgba(0,0,0,.06), inset 0 1px 0 rgba(255,255,255,.03);
}
.hub-search input::placeholder { color: var(--text-muted); font-weight: 400; }
.hub-search input:focus { outline: none; border-color: var(--hub-gold); box-shadow: 0 0 0 3px var(--hub-gold-soft), 0 4px 14px rgba(0,0,0,.08); }
/* on phones the search is the main action — make it taller, pill-shaped and
   clearly tappable rather than a plain box */
@media (max-width: 719px) {
  .hub-search input { height: 48px; border-radius: 999px; font-size: 15px; padding-left: 44px; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
  .hub-search .icon-inline, .hub-search svg { left: 16px; }
  .hub-search-clear { right: 8px; width: 34px; height: 34px; }
}
.hub-search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--text-muted); cursor: pointer; display: none; align-items: center; justify-content: center; }
.hub-search-clear.show { display: flex; }
.hub-search-clear svg { position: static; transform: none; width: 14px; height: 14px; }
.hub-select {
  height: 38px; padding: 0 30px 0 11px; border-radius: 10px; border: 1px solid var(--border-strong); background-color: var(--hub-field);
  color: var(--text-primary); font: 500 12.5px var(--font-sans); cursor: pointer; min-width: 0; max-width: 100%;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a93a3' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.hub-select:focus { outline: none; border-color: var(--hub-accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.hub-select.is-set { border-color: var(--hub-accent); color: var(--hub-accent); font-weight: 600; }
.hub-select option, .hub-select optgroup { background: var(--surface); color: var(--text-primary); }
.hub-field-lbl { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hub-field-lbl > span { font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--text-muted); }

.hub-seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--hover); border: 1px solid var(--border); gap: 2px; }
.hub-seg button {
  border: 0; background: transparent; color: var(--text-secondary); font: 600 12.5px var(--font-sans); padding: 0 12px; height: 32px;
  border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.hub-seg button:hover { color: var(--text-primary); }
.hub-seg button[aria-pressed="true"] { background: var(--card); color: var(--text-primary); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }
[data-theme="dark"] .hub-seg button[aria-pressed="true"] { background: var(--card-hover); }
.hub-seg svg { width: 15px; height: 15px; }
.hub-seg .n { font: 600 10.5px var(--font-mono); color: var(--text-muted); }

.hub-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; flex: 1 1 100%; }
@media (min-width: 720px) { .hub-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .hub-filters { display: flex; flex: 1 1 auto; } .hub-filters .hub-field-lbl { flex: 1 1 0; } }
.hub-tb-end { display: flex; gap: 8px; align-items: flex-end; margin-left: auto; }
.hub-active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); margin: -6px 0 14px; }
.hub-active-filters:empty { display: none; }
.hub-fchip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--hub-accent-soft); color: var(--hub-accent); font-weight: 600; border: 0; cursor: pointer; font-size: 12px; }
.hub-fchip svg { width: 12px; height: 12px; }
.hub-linkbtn { border: 0; background: none; color: var(--text-secondary); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font: 600 12px var(--font-sans); padding: 4px; }
.hub-linkbtn:hover { color: var(--text-primary); }

/* ---------- groups ---------- */
.hub-group { margin-bottom: 26px; }
.hub-group-h { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.hub-group-h h2 { font-family: var(--font-display); font-size: 14px; font-weight: 600; margin: 0; white-space: nowrap; }
.hub-group-h .n { font: 600 11px var(--font-mono); color: var(--text-muted); padding: 3px 8px; border-radius: 999px; background: var(--hover); border: 1px solid var(--border); white-space: nowrap; }
.hub-group-h .line { flex: 1; height: 1px; background: var(--border); }

.hub-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 640px) { .hub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .hub-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 1440px) { .hub-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- survey card ---------- */
.sv-card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--hub-card-shadow);
  transition: transform .18s var(--ease), box-shadow .18s, border-color .18s; cursor: pointer;
  animation: hubIn .35s var(--ease) both;
}
@keyframes hubIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sv-card, .hub-folder { animation: none; } }
.sv-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--hub-card-shadow-hover); }
.sv-card:focus-within { border-color: var(--hub-accent); }

.sv-media { position: relative; border-radius: 15px 15px 0 0; overflow: hidden; }
.sv-mosaic {
  position: relative; height: 148px; background: var(--hub-mosaic-bg);
  display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px;
}
.sv-mosaic img { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--hub-skel-a); }
.sv-mosaic .t0 { grid-row: 1 / span 2; grid-column: 1; }
.sv-mosaic.m-1 .t0 { grid-column: 1 / span 2; }
.sv-mosaic.m-2 .t1 { grid-row: 1 / span 2; }
.sv-mosaic.is-loading { background: linear-gradient(90deg, var(--hub-skel-a) 25%, var(--hub-skel-b) 50%, var(--hub-skel-a) 75%); background-size: 200% 100%; animation: hubShimmer 1.3s linear infinite; }
.sv-noph { grid-column: 1 / span 2; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text-muted); font-size: 11.5px; font-weight: 600;
  background-image: radial-gradient(var(--border-strong) 1px, transparent 1px); background-size: 14px 14px; }
.sv-noph svg { width: 26px; height: 26px; opacity: .8; }
.sv-noph.err { color: var(--danger); }
.sv-ov { position: absolute; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: center; gap: 6px; pointer-events: none; }
.sv-ov.top { top: 10px; }
.sv-ov.bot { bottom: 10px; justify-content: flex-end; }
.sv-glass { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; background: rgba(6, 16, 29, 0.72); color: #f1f4f9; font: 600 11px var(--font-mono); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.sv-glass svg { width: 12px; height: 12px; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; line-height: 1.2; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.st-progress { background: rgba(143, 179, 255, 0.16); color: #9fbfff; }
.pill.st-ready { background: rgba(47, 201, 143, 0.18); color: #3fd9a0; }
.pill.st-sync { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.pill.st-done { background: rgba(228, 176, 74, 0.2); color: #f0c268; }
.sv-ov .pill { background: rgba(6, 16, 29, 0.78); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
[data-theme="light"] .hub-list .pill.st-progress, [data-theme="light"] .pill-flat.st-progress { background: var(--hub-info-soft); color: var(--hub-info); }
[data-theme="light"] .hub-list .pill.st-ready, [data-theme="light"] .pill-flat.st-ready { background: var(--success-bg); color: var(--success); }
[data-theme="light"] .hub-list .pill.st-sync, [data-theme="light"] .pill-flat.st-sync { background: var(--warning-bg); color: var(--warning); }
[data-theme="light"] .hub-list .pill.st-done, [data-theme="light"] .pill-flat.st-done { background: var(--hub-accent-soft); color: var(--hub-accent); }

.sv-body { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 0; }
.sv-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.sv-when { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }

.plate {
  display: inline-flex; align-items: stretch; border: 1.5px solid #1f2733; border-radius: 6px; background: #fdfdfb; color: #111827;
  overflow: hidden; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.7); min-width: 0; max-width: 100%; text-decoration: none;
}
.plate-ind { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 4px; background: #1d4ed8; color: #fff; font: 700 7px/1 var(--font-sans); letter-spacing: .4px; gap: 2px; }
.plate-ind i { width: 7px; height: 7px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.85); display: block; }
.plate-no { padding: 4px 9px; font: 700 14px/1.1 var(--font-mono); letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate.plate-alt { border-color: var(--border-strong); background: var(--hover); color: var(--text-secondary); box-shadow: none; }
.plate.plate-alt .plate-ind { background: var(--hub-accent-soft); color: var(--hub-accent); }
.plate.plate-alt .plate-no { font-size: 12px; letter-spacing: .3px; }

.sv-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: -0.1px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; display: block; }
.sv-title:hover { color: var(--hub-accent); }
.sv-insurer { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; min-width: 0; }
.sv-insurer svg { width: 13px; height: 13px; flex: 0 0 auto; color: var(--text-muted); }
.sv-insurer span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sv-meta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; padding: 9px 10px; border-radius: 10px; background: var(--hover); border: 1px solid var(--border); margin: 0; }
.sv-meta div { min-width: 0; }
.sv-meta dt { font-size: 9.5px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; color: var(--text-muted); margin: 0; }
.sv-meta dd { font: 500 12px var(--font-mono); color: var(--text-primary); margin: 3px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-meta dd.none { color: var(--text-muted); font-family: var(--font-sans); }

.sv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; border: 1px solid var(--border); background: var(--hover); color: var(--text-secondary); white-space: nowrap; }
.chip.type { background: var(--hub-info-soft); color: var(--hub-info); border-color: transparent; }
.chip.stage { background: var(--hub-accent-soft); color: var(--hub-accent); border-color: transparent; }
.chip svg { width: 12px; height: 12px; }

.sv-prog { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.sv-prog .seg { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.sv-prog .bar { height: 5px; border-radius: 999px; background: var(--border-strong); overflow: hidden; position: relative; }
.sv-prog .seg.done .bar { background: var(--hub-teal); }
.sv-prog .seg.part .bar::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 45%; background: var(--hub-teal); border-radius: 999px; }
.sv-prog .lbl { font-size: 10.5px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; }
.sv-prog .seg.done .lbl { color: var(--text-secondary); }
.sv-prog .lbl b { font: 600 10.5px var(--font-mono); color: var(--text-primary); }
.sv-prog .lbl svg { width: 11px; height: 11px; color: var(--hub-teal); flex: 0 0 auto; }

.sv-actions { display: flex; align-items: stretch; border-top: 1px solid var(--border); }
.sv-act {
  flex: 1 1 0;
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 44px; border: 0; background: transparent; color: var(--text-secondary);
  font: 600 12.5px var(--font-sans); cursor: pointer; text-decoration: none; min-width: 0; padding: 0 6px; white-space: nowrap;
}
.sv-more { flex: 0 0 44px; }
.sv-act + .sv-act, .sv-more { border-left: 1px solid var(--border); }
.sv-act:hover { background: var(--hover); color: var(--text-primary); }
.sv-act svg { width: 15px; height: 15px; flex: 0 0 auto; }
.sv-act.primary { color: var(--hub-accent); }
.sv-actions > :first-child { border-bottom-left-radius: 15px; }
.sv-more { position: relative; }
.sv-more > summary { list-style: none; display: flex; align-items: center; justify-content: center; height: 44px; cursor: pointer; color: var(--text-secondary); border-bottom-right-radius: 15px; }
.sv-more > summary::-webkit-details-marker { display: none; }
.sv-more > summary:hover, .sv-more[open] > summary { background: var(--hover); color: var(--text-primary); }
.sv-more > summary svg { width: 16px; height: 16px; }
.sv-menu {
  position: absolute; right: 6px; bottom: calc(100% + 6px); z-index: 25; min-width: 190px; padding: 6px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
}
.sv-menu button, .sv-menu a { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text-primary); font: 500 13px var(--font-sans); cursor: pointer; text-align: left; text-decoration: none; }
.sv-menu button:hover, .sv-menu a:hover { background: var(--hover); }
.sv-menu svg { width: 15px; height: 15px; color: var(--text-secondary); }
.sv-menu .danger, .sv-menu .danger svg { color: var(--danger); }
.sv-menu .danger:hover { background: var(--danger-bg); }
.sv-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; }

/* list view */
.hub-list { display: flex; flex-direction: column; gap: 10px; }
.hub-list .sv-card { display: grid; grid-template-columns: 92px minmax(0, 1fr); animation: none; }
.hub-list .sv-media { border-radius: 15px 0 0 0; grid-row: 1; }
.hub-list .sv-mosaic { height: 100%; min-height: 92px; grid-template-columns: 1fr; grid-template-rows: 1fr; }
.hub-list .sv-mosaic img:not(.t0) { display: none; }
.hub-list .sv-mosaic .t0 { grid-column: 1; grid-row: 1; }
.hub-list .sv-ov { display: none; }
.hub-list .sv-body { padding: 12px 14px; gap: 8px; }
.hub-list .sv-meta, .hub-list .sv-prog { display: none; }
.hub-list .sv-actions { grid-column: 1 / -1; }
.hub-list .sv-list-status { display: inline-flex; }
.sv-list-status { display: none; }
@media (min-width: 900px) {
  .hub-list .sv-card { grid-template-columns: 104px minmax(0, 1.4fr) minmax(0, 1fr) 300px; align-items: stretch; }
  .hub-list .sv-media { border-radius: 15px 0 0 15px; }
  .hub-list .sv-mosaic { min-height: 96px; }
  .hub-list .sv-body { grid-column: 2; }
  .hub-list .sv-side { display: flex; }
  .hub-list .sv-actions { grid-column: 4; grid-row: 1; border-top: 0; border-left: 1px solid var(--border); grid-template-columns: repeat(3, minmax(0, 1fr)) 40px; align-items: stretch; }
  .hub-list .sv-act, .hub-list .sv-more > summary { height: 100%; }
  .hub-list .sv-actions > :first-child { border-bottom-left-radius: 0; }
  .hub-list .sv-more > summary { border-radius: 0 15px 15px 0; }
  .hub-list .sv-menu { bottom: auto; top: calc(100% - 4px); }
}
.sv-side { display: none; flex-direction: column; justify-content: center; gap: 8px; padding: 12px 14px; min-width: 0; }
.sv-side .sv-meta { display: grid; background: transparent; border: 0; padding: 0; }
.sv-side .sv-prog { display: grid; }

/* ---------- skeleton ---------- */
.sk { border-radius: 6px; background: linear-gradient(90deg, var(--hub-skel-a) 25%, var(--hub-skel-b) 50%, var(--hub-skel-a) 75%); background-size: 200% 100%; animation: hubShimmer 1.3s linear infinite; }
@keyframes hubShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-card { cursor: default; animation: none; }
.sk-card:hover { transform: none; box-shadow: var(--hub-card-shadow); border-color: var(--border); }
.sk-line { height: 12px; }

/* ---------- empty / error ---------- */
.hub-empty { text-align: center; padding: 48px 20px; border: 1px dashed var(--border-strong); border-radius: 18px; background: var(--card); }
.hub-empty-ic { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 18px; display: flex; align-items: center; justify-content: center; background: var(--hub-accent-soft); color: var(--hub-accent); }
.hub-empty-ic svg { width: 28px; height: 28px; }
.hub-empty h3 { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin: 0 0 6px; }
.hub-empty p { color: var(--text-secondary); font-size: 13.5px; max-width: 420px; margin: 0 auto 18px; line-height: 1.55; }
.hub-empty .hub-head-actions { justify-content: center; }
.hub-more-wrap { display: flex; justify-content: center; margin-top: 8px; }

/* ---------- folder cards (Report Hub + drill-downs) ---------- */
.hub-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 12px; }
.hub-folder {
  display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--hub-card-shadow); cursor: pointer; color: inherit; text-align: left; font: inherit; width: 100%;
  transition: transform .18s var(--ease), border-color .18s, box-shadow .18s; animation: hubIn .35s var(--ease) both;
}
.hub-folder:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--hub-card-shadow-hover); }
.hub-folder-ic { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--hub-accent-soft); color: var(--hub-accent); flex: 0 0 auto; }
.hub-folder-ic svg { width: 21px; height: 21px; }
.hub-folder-ic.info { background: var(--hub-info-soft); color: var(--hub-info); }
.hub-folder-ic.teal { background: var(--hub-teal-soft); color: var(--hub-teal); }
.hub-folder-txt { flex: 1; min-width: 0; }
.hub-folder-name { font-family: var(--font-display); font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-folder-sub { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
.hub-folder-go { color: var(--text-muted); flex: 0 0 auto; display: flex; }
.hub-folder-go svg { width: 16px; height: 16px; }
.hub-folder:hover .hub-folder-go { color: var(--hub-accent); }

/* ---------- breadcrumb ---------- */
.hub-bc { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 16px; font-size: 13px; }
.hub-bc span { color: var(--text-secondary); cursor: pointer; padding: 4px 6px; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px; }
.hub-bc span:hover { background: var(--hover); color: var(--text-primary); }
.hub-bc span.current { color: var(--text-primary); font-weight: 600; cursor: default; }
.hub-bc span.current:hover { background: none; }
.hub-bc span.sep { color: var(--text-muted); cursor: default; padding: 0; }
.hub-bc span.sep:hover { background: none; }
.hub-bc svg { width: 14px; height: 14px; }

/* ---------- footer ---------- */
.hub-footer { max-width: var(--hub-max); margin: 0 auto; padding: 18px 16px 28px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; font-size: 11.5px; color: var(--text-muted); }
.hub-footer b { color: var(--text-secondary); font-weight: 600; }
.hub-list .sv-noph { grid-column: 1; grid-row: 1; font-size: 10px; text-align: center; padding: 4px; }
.hub-list .sv-noph svg { width: 20px; height: 20px; }
.sv-glass[hidden] { display: none !important; }
.sv-job { font-family: var(--font-mono); font-size: 11px; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* mobile toolbar: search on its own line, filters collapse behind a button */
.hub-filter-btn { display: none; }
@media (max-width: 719px) {
  .hub-search { flex-basis: 100%; }
  .hub-toolbar .hub-seg:first-of-type { flex: 1 1 auto; }
  .hub-toolbar #catSeg { flex: 1 1 auto; min-width: 0; }
  #catSeg button { flex: 1 1 0; justify-content: center; padding: 0 6px; }
  .hub-filter-btn { display: inline-flex; height: 38px; }
  .hub-filter-btn .hub-count { padding: 3px 6px; font-size: 10.5px; }
  .hub-filters-row { display: none; }
  .hub-toolbar.open .hub-filters-row { display: flex; }
  .hub-kpis { gap: 8px; }
  .kpi { padding: 12px; gap: 10px; }
  .kpi-ic { width: 34px; height: 34px; border-radius: 10px; }
  .kpi-val { font-size: 20px; }
  .hub-head { margin-bottom: 16px; }
  .hub-head .hub-btn-primary { width: 100%; }
  .hub-head-actions { width: 100%; }
}
@media (max-width: 380px) { #catSeg .n { display: none; } }
@media (max-width: 719px) {
  .hub-toolbar { padding: 10px; }
  .hub-tb-row { gap: 8px; }
  .hub-filter-lbl { display: none; }
  .hub-filter-btn { padding: 0 10px; gap: 4px; }
  .hub-toolbar .hub-seg button { padding: 0 9px; }
}
.sv-card:focus-within, .sv-card.menu-open { z-index: 6; }

/* =====================================================================
 * Premium layer — Survey Hub (hero, KPI trend tiles, sticky toolbar,
 * cover-photo cards, stage journey, bottom-sheet filters, FAB) and the
 * "back to website" link shared by both hubs.
 * ===================================================================== */
:root, [data-theme="dark"] {
  --hub-hero-bg: linear-gradient(180deg, rgba(20, 37, 63, 0.72), rgba(15, 29, 51, 0.55));
  --hub-hero-a: rgba(228, 176, 74, 0.16);
  --hub-hero-b: rgba(143, 179, 255, 0.13);
  --hub-hero-grid: rgba(158, 178, 210, 0.07);
  --hub-card-hi: rgba(255, 255, 255, 0.025);
  --hub-toolbar-stuck: rgba(11, 23, 40, 0.86);
  --hub-seg-bg: rgba(3, 8, 16, 0.35);
  --hub-seg-on: #1a2d4b;
  --hub-cover: radial-gradient(120% 140% at 0% 0%, rgba(228, 176, 74, 0.22), transparent 55%), linear-gradient(135deg, #10213a, #0a1526 70%);
  --hub-cover-nm: radial-gradient(120% 140% at 0% 0%, rgba(53, 208, 187, 0.22), transparent 55%), linear-gradient(135deg, #0e2433, #0a1526 70%);
  --hub-ok: #34d399; --hub-ok-soft: rgba(52, 211, 153, 0.16);
  --hub-warn: #fbbf24; --hub-warn-soft: rgba(251, 191, 36, 0.16);
}
[data-theme="light"] {
  --hub-hero-bg: linear-gradient(180deg, #ffffff, #fdfbf7);
  --hub-hero-a: rgba(228, 176, 74, 0.18);
  --hub-hero-b: rgba(47, 95, 196, 0.08);
  --hub-hero-grid: rgba(11, 37, 69, 0.045);
  --hub-card-hi: rgba(255, 255, 255, 0);
  --hub-toolbar-stuck: rgba(255, 255, 255, 0.88);
  --hub-seg-bg: rgba(11, 37, 69, 0.05);
  --hub-seg-on: #ffffff;
  --hub-cover: radial-gradient(120% 140% at 0% 0%, rgba(228, 176, 74, 0.3), transparent 55%), linear-gradient(135deg, #17325a, #0e2240 70%);
  --hub-cover-nm: radial-gradient(120% 140% at 0% 0%, rgba(53, 208, 187, 0.3), transparent 55%), linear-gradient(135deg, #123a4a, #0e2240 70%);
  --hub-ok: #0f8a5f; --hub-ok-soft: rgba(15, 138, 95, 0.12);
  --hub-warn: #b45309; --hub-warn-soft: rgba(180, 83, 9, 0.1);
  --hub-card-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 1px rgba(15, 23, 42, 0.03), 0 8px 24px -8px rgba(15, 23, 42, 0.08);
  --hub-card-shadow-hover: 0 2px 4px rgba(15, 23, 42, 0.05), 0 24px 44px -12px rgba(15, 23, 42, 0.2);
}

/* ---------- top bar polish + website link ---------- */
.hub-top::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, rgba(228, 176, 74, 0.35), transparent); pointer-events: none; }
.hub-web {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px 0 10px; border-radius: 10px;
  border: 1px solid var(--border); color: var(--text-secondary); text-decoration: none; font: 600 12.5px var(--font-sans); white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.hub-web:hover { background: var(--hover); color: var(--text-primary); border-color: var(--border-strong); }
.hub-web svg { width: 15px; height: 15px; flex: 0 0 auto; }
@media (max-width: 719px) { .hub-web { width: 38px; padding: 0; justify-content: center; } .hub-web span { display: none; } }
.hub-foot-link { color: var(--text-secondary); text-underline-offset: 2px; }
.hub-foot-link:hover { color: var(--hub-accent); }

/* ---------- hero header ---------- */
.hub-hero {
  position: relative; overflow: hidden; align-items: center; padding: 26px 28px; border-radius: 20px; border: 1px solid var(--border);
  background: radial-gradient(700px 260px at 0% 0%, var(--hub-hero-a), transparent 65%), radial-gradient(640px 280px at 100% 0%, var(--hub-hero-b), transparent 65%), var(--hub-hero-bg);
  box-shadow: var(--hub-card-shadow);
}
.hub-hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--hub-hero-grid) 1px, transparent 1px), linear-gradient(90deg, var(--hub-hero-grid) 1px, transparent 1px);
  background-size: 28px 28px; -webkit-mask-image: linear-gradient(115deg, transparent 30%, #000 85%); mask-image: linear-gradient(115deg, transparent 30%, #000 85%);
}
.hub-hero > * { position: relative; }
.hub-hero .hub-title { font-size: 26px; letter-spacing: -0.7px; line-height: 1.1; }
@media (min-width: 720px) { .hub-hero .hub-title { font-size: 32px; } }
.hub-eyebrow { display: inline-flex; align-items: center; gap: 7px; }
.hub-eyebrow-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--hub-accent); box-shadow: 0 0 0 3px var(--hub-accent-soft); }
.hub-hero .hub-subtitle { font-size: 14px; margin: 8px 0 0; }
.hub-hero-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; font-size: 12.5px; color: var(--text-secondary); }
.hub-hero-meta:empty { display: none; }
.hub-hero-meta span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.hub-hero-meta b { color: var(--text-primary); font-weight: 600; }
.hub-hero-meta svg { width: 13px; height: 13px; color: var(--text-muted); }
.hub-hero .hub-count { font-size: 12.5px; padding: 5px 10px; vertical-align: middle; }
@media (max-width: 719px) {
  .hub-hero { padding: 18px; border-radius: 16px; }
  .hub-hero .hub-head-actions { display: none; }
  .hub-hero-meta { gap: 6px 14px; font-size: 12px; }
}

/* ---------- KPI tiles with 6-month trend bars ---------- */
.kpi.kpi2 {
  position: relative; overflow: hidden; flex-direction: column; align-items: stretch; gap: 14px; padding: 16px 16px 14px; border-radius: 16px;
  background: linear-gradient(180deg, var(--hub-card-hi), transparent 60%), var(--card);
  transition: border-color .18s, transform .18s var(--ease), box-shadow .18s;
}
.kpi.kpi2:hover:not([disabled]) { transform: translateY(-2px); box-shadow: var(--hub-card-shadow-hover); }
.kpi.kpi2[disabled] { cursor: default; }
.kpi.kpi2::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--kc); opacity: 0; transition: opacity .18s; }
.kpi.kpi2.active::before, .kpi.kpi2:hover:not([disabled])::before { opacity: 1; }
.kpi.kpi2.active { border-color: var(--kc); box-shadow: 0 0 0 1px var(--kc) inset, var(--hub-card-shadow); }
.kpi-gold { --kc: var(--hub-accent); } .kpi-info { --kc: var(--hub-info); } .kpi-teal { --kc: var(--hub-teal); } .kpi-warn { --kc: var(--warning); }
.kpi-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.kpi2 .kpi-ic { width: 32px; height: 32px; border-radius: 9px; }
.kpi2 .kpi-ic svg { width: 17px; height: 17px; }
.kpi2 .kpi-lbl { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.kpi-bot { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; min-width: 0; }
.kpi2 .kpi-val { display: block; font-size: 30px; letter-spacing: -0.8px; font-variant-numeric: tabular-nums; }
.kpi-sub { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 6px; white-space: nowrap; }
.kpi-sub b { color: var(--kc); font-weight: 700; }
.kpi-spark { display: flex; align-items: flex-end; gap: 3px; width: 78px; height: 36px; flex: 0 0 auto; color: var(--kc); }
.kpi-spark i { flex: 1; min-height: 3px; border-radius: 3px 3px 1px 1px; background: currentColor; opacity: .32; transition: height .5s var(--ease); }
.kpi-spark i.now { opacity: 1; }
.kpi-spark i.zero { opacity: .14; }
.kpi-spark.is-loading i { height: 40%; color: var(--text-muted); opacity: .15; }
.kpi-spark.is-loading i:nth-child(2n) { height: 65%; }
@media (max-width: 719px) {
  .kpi.kpi2 { padding: 13px 13px 12px; gap: 10px; border-radius: 14px; }
  .kpi2 .kpi-ic { width: 28px; height: 28px; }
  .kpi2 .kpi-ic svg { width: 15px; height: 15px; }
  .kpi2 .kpi-lbl { font-size: 12px; }
  .kpi2 .kpi-val { font-size: 24px; }
  .kpi-spark { width: 52px; height: 28px; gap: 2px; }
  .kpi-sub { font-size: 11px; }
}
@media (max-width: 370px) { .kpi-spark { display: none; } }

/* ---------- sticky toolbar + segmented controls ---------- */
.hub-stick-sentinel { height: 1px; margin-bottom: -1px; }
.hub-toolbar { position: -webkit-sticky; position: sticky; top: 60px; z-index: 20; border-radius: 16px; transition: box-shadow .2s, background .2s, border-color .2s; }
.hub-toolbar.stuck { box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.35); border-color: var(--border-strong); }
[data-theme="light"] .hub-toolbar.stuck { box-shadow: 0 12px 30px -12px rgba(15, 23, 42, 0.18); }
@media (min-width: 720px) {
  .hub-toolbar.stuck { background: var(--hub-toolbar-stuck); -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px); }
}
.hub-search input { height: 42px; border-radius: 11px; transition: border-color .15s, box-shadow .15s; }
.hub-search input:hover { border-color: var(--text-muted); }
.hub-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 600 11px var(--font-mono); color: var(--text-muted); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; pointer-events: none; }
.hub-search input:focus ~ .hub-kbd, .hub-search-clear.show ~ .hub-kbd { display: none; }
@media (max-width: 719px) { .hub-kbd { display: none; } }
.hub-seg { background: var(--hub-seg-bg); border-radius: 11px; }
.hub-seg button { transition: background .18s, color .18s, box-shadow .18s; }
.hub-seg button[aria-pressed="true"], [data-theme="dark"] .hub-seg button[aria-pressed="true"] { background: var(--hub-seg-on); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--border) inset; }
.hub-seg button[aria-pressed="true"] .n { color: var(--hub-accent); }
.hub-select { transition: border-color .15s, box-shadow .15s; }
.hub-select:hover { border-color: var(--text-muted); }
.hub-sheet-h, .hub-sheet-f, .hub-sheet-bd { display: none; }

/* ---------- mobile: bottom-sheet filters + FAB ---------- */
.hub-fab { display: none; }
@media (max-width: 719px) {
  .hub-toolbar { top: 60px; border-radius: 14px; }
  body.hub-sheet-open { overflow: hidden; }
  body.hub-sheet-open .hub-toolbar { z-index: 70; }
  .hub-sheet-bd { display: block; position: fixed; left: 0; top: 0; right: 0; bottom: 0; background: var(--overlay); opacity: 0; pointer-events: none; transition: opacity .22s; z-index: 1; }
  body.hub-sheet-open .hub-sheet-bd { opacity: 1; pointer-events: auto; }
  .hub-filters-row, .hub-toolbar.open .hub-filters-row {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; margin: 0 !important; flex-direction: column; align-items: stretch; gap: 14px;
    max-height: 86vh; overflow-y: auto; padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--border-strong); border-radius: 22px 22px 0 0; box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.35);
    transform: translateY(105%); visibility: hidden; transition: transform .3s var(--ease), visibility 0s linear .3s;
  }
  .hub-toolbar.open .hub-filters-row { transform: none; visibility: visible; transition: transform .3s var(--ease), visibility 0s; }
  .hub-sheet-h { display: flex; align-items: center; justify-content: space-between; position: relative; padding-top: 14px; }
  .hub-sheet-h strong { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
  .hub-sheet-grip { position: absolute; top: 0; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--border-strong); }
  .hub-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .hub-filters .hub-field-lbl:last-child { grid-column: 1 / -1; }
  .hub-filters .hub-select { height: 46px; font-size: 14px; border-radius: 12px; width: 100%; }
  .hub-sheet-f { display: flex; gap: 10px; padding-top: 4px; }
  .hub-sheet-f .hub-btn { flex: 1; min-height: 48px; font-size: 14px; border-radius: 12px; }
  .hub-sheet-f .hub-btn-primary { flex: 2; }
  .hub-fab {
    display: inline-flex; align-items: center; gap: 8px; position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 40;
    height: 52px; padding: 0 20px 0 16px; border-radius: 999px; background: var(--primary); color: var(--text-on-primary); text-decoration: none;
    font: 700 14px var(--font-sans); box-shadow: 0 12px 28px -6px rgba(228, 176, 74, 0.55), 0 2px 6px rgba(0, 0, 0, 0.25); transition: transform .2s var(--ease), opacity .2s;
  }
  [data-theme="light"] .hub-fab { box-shadow: 0 12px 28px -6px rgba(11, 37, 69, 0.45), 0 2px 6px rgba(15, 23, 42, 0.2); }
  .hub-fab svg { width: 20px; height: 20px; }
  .hub-fab:active { transform: scale(.96); }
  body.hub-sheet-open .hub-fab { opacity: 0; pointer-events: none; transform: translateY(20px); }
  .hub-main { padding-bottom: 96px; }
  .hub-grid { gap: 14px; }
}

/* ---------- survey card: cover header ---------- */
.sv-card { border-radius: 18px; transition: transform .22s var(--ease), box-shadow .22s, border-color .22s; }
.sv-card:hover { transform: translateY(-3px); }
[data-theme="dark"] .sv-card:hover, :root:not([data-theme="light"]) .sv-card:hover { border-color: rgba(228, 176, 74, 0.28); }
[data-theme="light"] .sv-card:hover { border-color: var(--border-strong); }
.sv-media { border-radius: 17px 17px 0 0; background: var(--hub-cover); isolation: isolate; }
.sv-media.nm { background: var(--hub-cover-nm); }
.hub-grid .sv-media { height: 176px; }
.sv-card:hover .sv-cover.ready img { transform: scale(1.04); }
.sv-cover { position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden; z-index: 0; }
.sv-cover::before {
  content: ''; position: absolute; left: 0; top: 0; right: 0; bottom: 0; opacity: .5;
  background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 22px 22px; -webkit-mask-image: linear-gradient(200deg, #000, transparent 75%); mask-image: linear-gradient(200deg, #000, transparent 75%);
}
.sv-cover img {
  /* the vehicle photo itself, sharp — only a soft gradient on top keeps the plate & chips readable */
  position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 45%; display: block;
  opacity: 0; transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.sv-cover.ready img { opacity: 1; }
.sv-cover::after { content: ''; position: absolute; left: 0; top: 0; right: 0; bottom: 0; background: linear-gradient(180deg, rgba(4, 10, 20, 0.45) 0%, rgba(4, 10, 20, 0) 32%, rgba(4, 10, 20, 0) 58%, rgba(4, 10, 20, 0.62) 100%); }
.sv-cover.has-img::before { display: none; }
.sv-cover.is-loading { background: linear-gradient(90deg, rgba(255, 255, 255, 0.02) 25%, rgba(255, 255, 255, 0.07) 50%, rgba(255, 255, 255, 0.02) 75%); background-size: 200% 100%; animation: hubShimmer 1.4s linear infinite; }
.hub-grid .sv-ov { z-index: 3; left: 12px; right: 12px; }
.hub-grid .sv-ov.top { top: 12px; }
.hub-grid .sv-ov.bot { bottom: 12px; justify-content: flex-start; }
.sv-ov .pill { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset; }
.sv-glass { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset; }
.sv-date { font-family: var(--font-sans); font-weight: 600; font-size: 11px; }
.sv-media .plate { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.7); max-width: calc(100% - 132px); pointer-events: auto; }
.sv-media .plate-no { font-size: 15px; padding: 5px 10px; }
.sv-media .plate.plate-alt { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.28); color: #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.sv-media .plate.plate-alt .plate-ind { background: rgba(228, 176, 74, 0.9); color: #1a1103; padding: 0 6px; }
.sv-media .plate.plate-alt .plate-no { font-size: 12.5px; }
/* photo stack (grid view) */
.hub-grid .sv-mosaic {
  position: absolute; right: 12px; bottom: 12px; z-index: 2; height: 56px; width: auto; display: flex; flex-direction: row-reverse; gap: 0;
  background: none; grid-template-columns: none; grid-template-rows: none;
}
.hub-grid .sv-mosaic.is-loading { width: 56px; border-radius: 11px; background: rgba(255, 255, 255, 0.08); animation: none; }
.hub-grid .sv-mosaic img {
  width: 56px; height: 56px; border-radius: 11px; border: 2px solid rgba(255, 255, 255, 0.92); box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
  grid-row: auto; grid-column: auto; flex: 0 0 auto; background: #1b2a42; transition: transform .25s var(--ease);
}
.hub-grid .sv-mosaic img + img { margin-right: -30px; }
.hub-grid .sv-mosaic .t0 { z-index: 3; position: relative; }
.hub-grid .sv-mosaic .t1 { z-index: 2; position: relative; transform: rotate(-5deg) scale(.92); }
.hub-grid .sv-mosaic .t2 { z-index: 1; position: relative; transform: rotate(-10deg) scale(.84); }
.hub-grid .sv-card:hover .sv-mosaic .t1 { transform: rotate(-8deg) translateX(-6px) scale(.92); }
.hub-grid .sv-card:hover .sv-mosaic .t2 { transform: rotate(-14deg) translateX(-12px) scale(.84); }
.hub-grid .sv-ov.bot .js-ph { position: absolute; right: -6px; bottom: 44px; z-index: 5; padding: 3px 7px; font-size: 10.5px; }
.hub-grid .sv-noph {
  flex-direction: row; gap: 6px; height: auto; align-self: flex-end; padding: 6px 10px; border-radius: 999px; background: rgba(6, 16, 29, 0.55); background-image: none;
  color: #d5deeb; font-size: 11px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1) inset; white-space: nowrap;
}
.hub-grid .sv-noph svg { width: 14px; height: 14px; }
.hub-grid .sv-noph.err { color: #ffb4bc; }
.sv-plate-row { display: none; }
.hub-list .sv-plate-row { display: flex; }
.hub-list .sv-cover, .hub-list .sv-ov { display: none; }
.hub-list .sv-noph span { display: block; }

/* ---------- survey card: body ---------- */
.hub-grid .sv-body { padding: 15px 16px 12px; gap: 11px; }
.sv-title { font-size: 15.5px; letter-spacing: -0.2px; }
.sv-meta { border-radius: 11px; }
.sv-prog { display: flex; flex-direction: column; gap: 10px; }
.sv-side .sv-prog { display: flex; }
.hub-list .sv-body .sv-prog { display: none; }
.sv-tl { list-style: none; margin: 0; padding: 2px 0 0; display: flex; }
.sv-tl li { --jc: var(--text-muted); --js: transparent; flex: 1 1 0; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 10px; font-weight: 600; color: var(--text-muted); cursor: default; }
.sv-tl li::before { content: ''; position: absolute; top: 5px; left: -50%; right: 50%; height: 2px; margin: 0 8px; border-radius: 2px; background: var(--border-strong); }
.sv-tl li:first-child::before { display: none; }
.sv-tl li.done::before { background: var(--jc); opacity: .5; }
.sv-tl i { position: relative; z-index: 1; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--card); transition: background .3s, border-color .3s, box-shadow .3s; }
.sv-tl li.done i { background: var(--jc); border-color: var(--jc); box-shadow: 0 0 0 3px var(--js); }
.sv-tl li.cur i { box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--jc); }
.sv-tl li.cur:not(.done) i { border-color: var(--jc); }
.sv-tl span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-tl li.done span { color: var(--text-secondary); }
.sv-tl li.cur span { color: var(--text-primary); font-weight: 700; }
.sv-tl .j-spot { --jc: var(--hub-info); --js: var(--hub-info-soft); }
.sv-tl .j-primary { --jc: var(--hub-accent); --js: var(--hub-accent-soft); }
.sv-tl .j-under_repair { --jc: var(--hub-warn); --js: var(--hub-warn-soft); }
.sv-tl .j-reinspection { --jc: var(--hub-teal); --js: var(--hub-teal-soft); }
.sv-tl .j-report { --jc: var(--hub-ok); --js: var(--hub-ok-soft); }
.sv-tl.is-loading li:not(.done) i { animation: hubPulse 1.2s ease-in-out infinite; }
@keyframes hubPulse { 50% { opacity: .35; } }
.sv-counts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--text-secondary); }
.sv-counts span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.sv-counts svg { width: 13px; height: 13px; color: var(--text-muted); }
.sv-counts b { font: 600 11.5px var(--font-mono); color: var(--text-primary); }
.sv-counts .zero { color: var(--text-muted); }
.sv-counts .zero b { color: var(--text-muted); }
.sv-foot { margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--border); }
.sv-upd { display: inline-flex; align-items: center; gap: 6px; }
.sv-live { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); flex: 0 0 auto; }
.sv-live.on { background: var(--hub-ok); box-shadow: 0 0 0 3px var(--hub-ok-soft); }
.sv-actions { grid-template-columns: repeat(3, minmax(0, 1fr)) 46px; }
.sv-act { height: 46px; transition: background .15s, color .15s; }
.sv-more > summary { height: 46px; }
.sv-act.primary { font-weight: 700; }
.sv-act.primary:hover { background: var(--hub-accent-soft); color: var(--hub-accent); }
.sv-act.primary svg { transition: transform .2s var(--ease); }
.sv-act.primary:hover svg { transform: translateX(2px); }
.sv-menu { border-radius: 14px; box-shadow: var(--shadow-xl); }
.hub-list .sv-card { border-radius: 16px; }
.hub-list .sv-card:hover { transform: translateY(-1px); }
@media (min-width: 900px) { .hub-list .sv-side { gap: 10px; } .hub-list .sv-side .sv-counts { display: none; } }
.hub-group-h h2 { font-size: 15px; letter-spacing: -0.2px; }
.hub-group { margin-bottom: 30px; }

/* skeleton on dark covers */
.sk-dark { background: linear-gradient(90deg, rgba(255, 255, 255, 0.06) 25%, rgba(255, 255, 255, 0.14) 50%, rgba(255, 255, 255, 0.06) 75%); background-size: 200% 100%; animation: hubShimmer 1.3s linear infinite; }
.sk-card .sv-media { background: var(--hub-cover); }
.hub-list .sk-card .sv-ov { display: none; }

/* ---------- empty state ---------- */
.hub-empty { padding: 56px 20px; border-style: solid; border-color: var(--border); background: radial-gradient(520px 220px at 50% 0%, var(--hub-accent-soft), transparent 70%), var(--card); box-shadow: var(--hub-card-shadow); }
.hub-empty-art { position: relative; width: 140px; height: 136px; margin: -8px auto 6px; display: flex; align-items: center; justify-content: center; }
.hub-empty-art .r1, .hub-empty-art .r2 { position: absolute; left: 50%; top: 50%; border-radius: 50%; border: 1px dashed var(--border-strong); transform: translate(-50%, -50%); }
.hub-empty-art .r1 { width: 96px; height: 96px; }
.hub-empty-art .r2 { width: 132px; height: 132px; opacity: .5; }
.hub-empty-art .hub-empty-ic { margin: 0; position: relative; box-shadow: 0 10px 24px -8px rgba(228, 176, 74, 0.45); }
.hub-empty h3 { font-size: 20px; letter-spacing: -0.3px; }
.hub-empty-steps { list-style: none; padding: 0; margin: 0 auto 22px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.hub-empty-steps li { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--hover); font-size: 12.5px; color: var(--text-secondary); }
.hub-empty-steps li span { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--card); color: var(--hub-accent); box-shadow: 0 0 0 1px var(--border) inset; }
.hub-empty-steps li span svg { width: 13px; height: 13px; }
.hub-empty-steps li b { font: 700 11px var(--font-mono); color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) {
  .sv-card, .kpi.kpi2, .hub-fab, .hub-filters-row, .sv-cover img, .hub-grid .sv-mosaic img { transition: none !important; }
  .sv-tl.is-loading li i, .sv-cover.is-loading, .sk-dark { animation: none; }
}
/* premium layer — layout refinements */
@media (min-width: 1440px) { .hub-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; } }
@media (min-width: 1640px) { .hub-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.hub-toolbar .hub-tb-row + .hub-tb-row { margin-top: 12px; }
@media (max-width: 719px) {
  .hub-toolbar .hub-tb-row { flex-wrap: wrap; }
  .hub-toolbar #catSeg { flex: 1 1 0; }
  .hub-toolbar .hub-seg button { padding: 0 8px; }
}
@media (max-width: 480px) { #catSeg .n { display: none; } }
@media (min-width: 720px) { .hub-toolbar { top: 72px; } }
