/* ============================================
   TagReaderAI — Modernized Duralux
   Royal blue primary, refined typography, 
   reliability-engineer focused
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Brand */
  --rb-50:  #f4f6fd;
  --rb-100: #e6ebfb;
  --rb-200: #c8d2f5;
  --rb-300: #9aabec;
  --rb-400: #6a7fde;
  --rb-500: #3454d1;     /* primary */
  --rb-600: #2a44a8;
  --rb-700: #213582;
  --rb-800: #182760;
  --rb-900: #0f1a45;

  /* Slate / surface */
  --ink-900: #0c1220;
  --ink-800: #182033;
  --ink-700: #283147;
  --ink-600: #3d4763;
  --ink-500: #5b6680;
  --ink-400: #8591ab;
  --ink-300: #aab4cc;
  --ink-200: #d2d8e6;
  --ink-100: #e9ecf3;
  --ink-50:  #f4f6fb;

  --bg:        #f3f5fb;
  --bg-elev:   #ffffff;
  --bg-sub:    #f8fafd;
  --border:    #e3e7f0;
  --border-strong: #cdd4e4;

  /* Status */
  --ok:       #15a463;
  --ok-50:    #e3f7ec;
  --warn:     #d97706;
  --warn-50:  #fef3e2;
  --bad:      #dc2a47;
  --bad-50:   #fce6ea;
  --info:     #0891b2;
  --info-50:  #e0f5f9;

  /* Type */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Sizing */
  --nav-h: 56px;
  --rail-w: 76px;
  --loc-pane-w: 248px;
  --side-w: calc(var(--rail-w) + var(--loc-pane-w));
  --side-w-collapsed: 64px;

  /* Shadows */
  --sh-1: 0 1px 2px rgba(15, 26, 69, 0.06);
  --sh-2: 0 1px 3px rgba(15, 26, 69, 0.06), 0 4px 12px rgba(15, 26, 69, 0.04);
  --sh-3: 0 4px 12px rgba(15, 26, 69, 0.08), 0 12px 32px rgba(15, 26, 69, 0.06);
  --sh-pop: 0 16px 48px rgba(15, 26, 69, 0.18), 0 4px 12px rgba(15, 26, 69, 0.08);

  /* Radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--ink-700);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

/* ============================================
   APP SHELL
   ============================================ */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topnav {
  height: var(--nav-h);
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 60;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink-900);
  letter-spacing: -0.01em;
  padding-right: 16px;
  border-right: 1px solid var(--border);
  height: 100%;
  min-width: calc(var(--side-w) - 16px);
}
[data-pane="hidden"] .brand { min-width: calc(var(--rail-w) - 16px); }
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--rb-500), var(--rb-700));
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -0.02em;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15), 0 1px 2px rgba(15,26,69,0.18);
}
.brand-thin { font-weight: 400; color: var(--ink-500); }
.brand-suffix {
  margin-left: 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-400);
  background: var(--ink-50);
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.global-search {
  flex: 1;
  max-width: 540px;
  position: relative;
}
.global-search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-sub);
  font-family: var(--font);
  font-size: 13px;
  color: var(--ink-800);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.global-search input::placeholder { color: var(--ink-400); }
.global-search input:focus {
  outline: none;
  border-color: var(--rb-400);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(52, 84, 209, 0.12);
}
.global-search-icon {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-400);
  width: 16px; height: 16px;
}
.kbd {
  position: absolute; right: 8px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-500);
  background: #fff;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 2px 5px;
  pointer-events: none;
}

.nav-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-500);
  cursor: pointer;
  position: relative;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--ink-50); color: var(--ink-800); }
.icon-btn .dot-badge {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--bad);
  border: 2px solid #fff;
}
.icon-btn .num-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--bad);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: grid; place-items: center;
  border: 2px solid #fff;
  font-family: var(--mono);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s;
}
.user-chip:hover { background: var(--ink-50); }
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rb-400), var(--rb-700));
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.02em;
}
.user-chip-info { display: flex; flex-direction: column; line-height: 1.15; }
.user-chip-info .name { font-size: 12.5px; font-weight: 600; color: var(--ink-900); }
.user-chip-info .role { font-size: 10.5px; color: var(--ink-500); }

/* ============================================
   SHELL: SIDEBAR + MAIN
   ============================================ */
.shell {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
}

/* ── Primary rail (icon-first nav) ── */
.rail {
  width: var(--rail-w);
  flex-shrink: 0;
  background: var(--bg-sub);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  overflow-y: auto;
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  align-self: flex-start;
}
.rail::-webkit-scrollbar { width: 0; }
.rail-group { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.rail-group-label {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-400);
  padding: 8px 6px 6px;
}
.rail-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 8px 4px 7px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--ink-500);
  cursor: pointer;
  font: 600 10.5px/1.1 var(--sans);
  letter-spacing: 0.005em;
  transition: background 120ms, color 120ms;
}
.rail-item:hover { background: rgba(15,20,40,0.04); color: var(--ink-900); }
.rail-item.active {
  background: var(--rb-50);
  color: var(--rb-600);
}
.rail-item.active::before {
  content: "";
  position: absolute; left: -8px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--rb-500);
}
.rail-item .rail-label {
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.rail-item .rail-alert {
  position: absolute; top: 4px; right: 12px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  background: var(--bad);
  color: #fff;
  font: 700 9.5px/16px var(--mono);
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--bg-sub);
}
.rail-spacer { flex: 1; min-height: 8px; }

/* ── Secondary locations pane ── */
.locations-pane {
  width: var(--loc-pane-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border-right: 1px solid var(--border);
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  align-self: flex-start;
}
.locations-pane-head {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.locations-title {
  font: 700 13px/1.2 var(--sans);
  color: var(--ink-900);
  letter-spacing: -0.005em;
}
.locations-sub {
  font: 500 11px/1.4 var(--sans);
  color: var(--ink-500);
  margin-top: 2px;
}

.side-section {
  padding: 14px 12px 10px;
}
.side-section + .side-section { border-top: 1px solid var(--border); }
.side-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-400);
  padding: 0 8px 8px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-700);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s;
  position: relative;
}
.side-link:hover { background: var(--ink-50); color: var(--ink-900); }
.side-link.active {
  background: var(--rb-50);
  color: var(--rb-600);
  font-weight: 600;
}
.side-link.active::before {
  content: ""; position: absolute; left: -12px; top: 6px; bottom: 6px; width: 3px;
  background: var(--rb-500); border-radius: 0 3px 3px 0;
}
.side-link .ico {
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: currentColor;
  opacity: 0.85;
}
.side-link .count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-500);
  background: var(--ink-50);
  padding: 2px 6px;
  border-radius: 4px;
}
.side-link.active .count {
  background: var(--rb-100);
  color: var(--rb-600);
}
.side-link .alert-badge {
  margin-left: auto;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: var(--bad);
  color: #fff;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  display: grid; place-items: center;
  font-family: var(--mono);
}

.side-locations {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
}
.side-locations::-webkit-scrollbar { width: 6px; }
.side-locations::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.side-locations::-webkit-scrollbar-track { background: transparent; }

.loc-search {
  position: relative;
  margin-bottom: 8px;
}
.loc-search input {
  width: 100%;
  height: 30px;
  padding: 0 10px 0 28px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-sub);
  font-size: 12px;
  font-family: var(--font);
  color: var(--ink-800);
}
.loc-search input:focus {
  outline: none;
  border-color: var(--rb-400);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(52,84,209,0.1);
}
.loc-search-icon { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--ink-400); width: 14px; height: 14px; }

.loc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--ink-700);
}
.loc-row:hover { background: var(--ink-50); }
.loc-row .chev {
  width: 12px; height: 12px;
  color: var(--ink-400);
  transition: transform .15s;
  flex-shrink: 0;
}
.loc-row.open .chev { transform: rotate(90deg); }
.loc-row .loc-code {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--rb-600);
  background: var(--rb-50);
  padding: 1px 5px;
  border-radius: 3px;
}
.loc-row .loc-name { flex: 1; font-weight: 600; color: var(--ink-800); }
.loc-row .loc-count { font-family: var(--mono); font-size: 10px; color: var(--ink-400); }
.loc-children {
  margin-left: 16px;
  border-left: 1px dashed var(--border);
  padding-left: 8px;
  margin-bottom: 4px;
}
.line-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--ink-600);
  cursor: pointer;
}
.line-row:hover { background: var(--ink-50); color: var(--ink-900); }
.line-row.active { background: var(--rb-50); color: var(--rb-600); font-weight: 600; }
.line-row .lr-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-row .lr-cov {
  width: 24px; height: 4px;
  border-radius: 2px;
  background: var(--ink-100);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.line-row .lr-cov::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: var(--pct, 0%);
  background: var(--rb-500);
}
.line-row .lr-cov.warn::after { background: var(--warn); }
.line-row .lr-cov.bad::after { background: var(--bad); }
.line-row .lr-alert {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--bad);
  flex-shrink: 0;
}

.side-bottom {
  border-top: 1px solid var(--border);
  padding: 12px;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 40px;
  overflow-x: hidden;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.crumb {
  font-size: 12px;
  color: var(--ink-500);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.crumb a { color: var(--ink-500); text-decoration: none; }
.crumb a:hover { color: var(--rb-600); }
.crumb .sep { color: var(--ink-300); }
.crumb .here { color: var(--ink-900); font-weight: 600; }

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.02em;
  margin: 0;
  display: flex; align-items: center; gap: 10px;
}
.page-subtitle {
  font-size: 13px;
  color: var(--ink-500);
  margin-top: 4px;
}
.page-actions { display: flex; gap: 8px; align-items: center; }

/* ============================================
   COMPONENTS: BUTTON
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn .ico { width: 14px; height: 14px; }
.btn-primary {
  background: var(--rb-500); color: #fff; border-color: var(--rb-500);
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset, 0 1px 2px rgba(33, 53, 130, 0.25);
}
.btn-primary:hover { background: var(--rb-600); border-color: var(--rb-600); }
.btn-secondary {
  background: #fff; color: var(--ink-800); border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-sub); border-color: var(--ink-300); }
.btn-ghost { background: transparent; color: var(--ink-700); }
.btn-ghost:hover { background: var(--ink-50); color: var(--ink-900); }
.btn-danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-danger:hover { background: #b9203c; border-color: #b9203c; }
.btn-soft-primary { background: var(--rb-50); color: var(--rb-600); border-color: var(--rb-100); }
.btn-soft-primary:hover { background: var(--rb-100); }
.btn-soft-danger { background: var(--bad-50); color: var(--bad); border-color: var(--bad-50); }
.btn-soft-danger:hover { background: #f7d2d8; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 11.5px; gap: 4px; }
.btn-sm .ico { width: 12px; height: 12px; }
.btn-icon { padding: 0; width: 34px; }
.btn-icon.btn-sm { width: 28px; }
.btn-disabled { opacity: 0.4; pointer-events: none; cursor: default; }

/* ============================================
   COMPONENTS: CARD
   ============================================ */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--sh-1);
}
.card-flush { padding: 0; overflow: hidden; }
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-head h3 {
  font-size: 13.5px; font-weight: 700; color: var(--ink-900);
  margin: 0; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 8px;
}
.card-head .sub { font-size: 12px; color: var(--ink-500); font-weight: 500; }
.card-actions { display: flex; gap: 6px; align-items: center; }

/* ============================================
   COMPONENTS: KPI
   ============================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--sh-1);
}
.kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-500);
  display: flex; align-items: center; gap: 6px;
}
.kpi-label .ico { width: 12px; height: 12px; color: var(--ink-400); }
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink-900);
  margin-top: 6px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.kpi-value .unit { font-size: 14px; color: var(--ink-400); font-weight: 500; margin-left: 2px; }
.kpi-foot {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--mono);
  padding: 2px 6px;
  border-radius: 4px;
}
.delta.up { background: var(--ok-50); color: var(--ok); }
.delta.down { background: var(--bad-50); color: var(--bad); }
.delta.flat { background: var(--ink-50); color: var(--ink-500); }

.spark {
  height: 32px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
}
.spark .bar {
  flex: 1;
  background: var(--rb-200);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
}
.spark .bar.last { background: var(--rb-500); }

/* Confidence ring */
.ring {
  --pct: 86;
  width: 64px; height: 64px;
  border-radius: 50%;
  background:
    conic-gradient(var(--rb-500) calc(var(--pct) * 1%), var(--ink-100) 0);
  display: grid; place-items: center;
  position: relative;
}
.ring::after {
  content: ""; position: absolute; inset: 6px;
  background: #fff; border-radius: 50%;
}
.ring .label {
  position: relative;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}

/* ============================================
   COMPONENTS: TABLE
   ============================================ */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-500);
  padding: 10px 14px;
  background: var(--bg-sub);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  white-space: nowrap;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--ink-800);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--bg-sub); }
.table tbody tr.selected { background: var(--rb-50); }
.table .checkbox { width: 28px; }
.code-mono {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--rb-700);
}
.muted { color: var(--ink-500); }

/* checkbox */
.cb {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  display: inline-grid; place-items: center;
  cursor: pointer;
  background: #fff;
  transition: background .12s, border-color .12s;
}
.cb svg { width: 10px; height: 10px; color: #fff; opacity: 0; }
.cb.checked { background: var(--rb-500); border-color: var(--rb-500); }
.cb.checked svg { opacity: 1; }

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-50); color: var(--ok); }
.badge-warn { background: var(--warn-50); color: var(--warn); }
.badge-bad { background: var(--bad-50); color: var(--bad); }
.badge-info { background: var(--info-50); color: var(--info); }
.badge-neutral { background: var(--ink-50); color: var(--ink-600); }
.badge-primary { background: var(--rb-50); color: var(--rb-600); }

/* ============================================
   TABS
   ============================================ */
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.tab {
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  display: flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--ink-900); }
.tab.active { color: var(--rb-600); border-bottom-color: var(--rb-500); }
.tab .count {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--ink-50);
  color: var(--ink-600);
  padding: 1px 5px;
  border-radius: 3px;
}
.tab.active .count { background: var(--rb-100); color: var(--rb-600); }

/* segmented */
.segmented {
  display: inline-flex;
  background: var(--ink-50);
  padding: 3px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}
.segmented button {
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-500);
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: flex; align-items: center; gap: 5px;
}
.segmented button.active {
  background: #fff;
  color: var(--ink-900);
  box-shadow: 0 1px 2px rgba(15,26,69,0.12);
}

/* ============================================
   SELECT / FILTER CHIPS
   ============================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sub);
}
.chip-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-700);
  cursor: pointer;
}
.chip-select:hover { border-color: var(--ink-300); }
.chip-select .lbl { color: var(--ink-500); }
.chip-select .val { color: var(--ink-900); font-weight: 600; }
.chip-select .ico { width: 12px; height: 12px; color: var(--ink-400); }

/* ============================================
   COVERAGE HEATMAP — flat tag-cloud matrix
   Cells flex-grow proportionally to the line's tagcode count, wrap
   into rows. Colour = coverage % (royal-blue gradient).
   ============================================ */
.heatmap-wrap { padding: 14px 18px 18px; }

.heat-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: stretch;
}

.heat-line-cell {
  position: relative;
  flex: 1 1 130px;
  min-width: 120px;
  min-height: 96px;
  border-radius: 8px;
  padding: 10px 12px 8px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: transform .15s, box-shadow .15s, filter .15s;
  cursor: pointer;
}
.heat-line-loc {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.55;
  margin-bottom: 2px;
}
.heat-line-cell.on-dark .heat-line-loc { opacity: 0.65; }
.heat-line-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 26, 69, 0.18);
  filter: brightness(1.05);
}
.heat-line-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.005em;
  opacity: 0.85;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.heat-line-pct {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin: 4px 0 2px;
  line-height: 1;
}
.heat-line-pct-unit {
  font-size: 12px;
  font-weight: 500;
  margin-left: 1px;
  opacity: 0.7;
}
.heat-line-stats {
  font-size: 10.5px;
  opacity: 0.78;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.heat-line-bar {
  height: 3px;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.heat-line-cell[style*="rgba(15,26,69,0.6)"] .heat-line-bar,
.heat-line-cell[style*="rgba(15,26,69,0.85)"] .heat-line-bar {
  background: rgba(15, 26, 69, 0.12);
}
.heat-line-bar span {
  display: block;
  height: 100%;
  background: currentColor;
  border-radius: 2px;
}
.heat-line-alert {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 10px;
  color: var(--bad);
  background: #fff;
  width: 14px; height: 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.heat-empty {
  flex: 1;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--ink-400);
  font-style: italic;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 16px;
}

.heat-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-500);
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.heat-legend-bar {
  display: inline-flex;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.heat-legend-bar span {
  display: block;
  width: 18px;
  height: 10px;
}

/* ============================================
   MAP (fleet overview, fake)
   ============================================ */
.fleet-map {
  position: relative;
  background:
    radial-gradient(circle at 30% 20%, #1a2a52 0%, #0c1734 50%, #060c20 100%);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  height: 360px;
  overflow: hidden;
}
.fleet-map.embedded { border-radius: 0; height: 320px; }
.fleet-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.fleet-map .map-grid line { stroke: rgba(255,255,255,0.05); stroke-width: 1; }
.fleet-map .map-coast { stroke: rgba(154, 171, 236, 0.5); stroke-width: 1.5; fill: rgba(52, 84, 209, 0.08); }
.fleet-map .map-pt {
  cursor: pointer;
}
.fleet-map .map-pt-glow { fill: var(--rb-400); opacity: 0.18; }
.fleet-map .map-pt-core { fill: var(--rb-400); }
.fleet-map .map-pt.warn .map-pt-core { fill: var(--warn); }
.fleet-map .map-pt.warn .map-pt-glow { fill: var(--warn); }
.fleet-map .map-pt.bad .map-pt-core { fill: var(--bad); }
.fleet-map .map-pt.bad .map-pt-glow { fill: var(--bad); }

.map-legend {
  position: absolute; bottom: 14px; left: 14px;
  display: flex; align-items: center; gap: 10px;
  background: rgba(12, 18, 32, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  color: rgba(255,255,255,0.85);
}
.map-legend-item { display: flex; align-items: center; gap: 5px; }
.map-legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.map-stat-overlay {
  position: absolute; top: 14px; left: 14px;
  background: rgba(12, 18, 32, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 10px 14px;
  border-radius: 8px;
  color: white;
}
.map-stat-overlay .lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.7; }
.map-stat-overlay .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.map-zoom {
  position: absolute; right: 14px; top: 14px;
  display: flex; flex-direction: column;
  background: rgba(12,18,32,0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  overflow: hidden;
}
.map-zoom button {
  width: 30px; height: 30px;
  border: none; background: transparent; color: white;
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 14px;
}
.map-zoom button:hover { background: rgba(255,255,255,0.1); }
.map-zoom button + button { border-top: 1px solid rgba(255,255,255,0.1); }

/* ============================================
   INBOX (smart triage)
   ============================================ */
.inbox-list {
  display: flex; flex-direction: column;
}
.inbox-row {
  display: grid;
  grid-template-columns: 28px 56px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.inbox-row:hover { background: var(--bg-sub); }
.inbox-row:last-child { border-bottom: none; }
.inbox-row.selected { background: var(--rb-50); }
.inbox-thumb {
  width: 56px; height: 42px;
  border-radius: 6px;
  background: var(--ink-100);
  position: relative;
  overflow: hidden;
  display: grid; place-items: center;
  color: var(--ink-400);
  border: 1px solid var(--border);
}
.inbox-thumb svg { width: 24px; height: 24px; }
.inbox-thumb .conf-corner {
  position: absolute;
  bottom: 2px; right: 2px;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  padding: 1px 3px;
  border-radius: 2px;
  text-transform: uppercase;
}
.inbox-meta { min-width: 0; }
.inbox-meta-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.inbox-meta .code {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-900);
}
.inbox-meta .where {
  font-size: 11.5px;
  color: var(--ink-500);
}
.inbox-meta .note {
  font-size: 12px;
  color: var(--ink-700);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.inbox-when {
  font-size: 11px;
  color: var(--ink-500);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.inbox-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .12s;
}
.inbox-row:hover .inbox-actions { opacity: 1; }

/* ============================================
   ACTIVITY FEED
   ============================================ */
.activity-list { padding: 4px 0; }
.activity-item {
  display: flex;
  gap: 10px;
  padding: 10px 18px;
  font-size: 12.5px;
  border-left: 2px solid transparent;
}
.activity-item:hover { background: var(--bg-sub); border-left-color: var(--rb-300); }
.activity-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--ink-100);
  color: var(--ink-700);
  font-size: 10px;
  font-weight: 700;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.activity-text { color: var(--ink-700); flex: 1; min-width: 0; }
.activity-text strong { color: var(--ink-900); font-weight: 600; }
.activity-text .target { font-family: var(--mono); color: var(--rb-600); font-weight: 600; }
.activity-time { color: var(--ink-400); font-size: 11px; flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* ============================================
   TAGCODE REVIEW (split view)
   ============================================ */
.review-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  min-height: calc(100vh - var(--nav-h) - 100px);
}
@media (max-width: 1280px) {
  .review-layout { grid-template-columns: 1fr; }
}

.review-stage {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.review-stage-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.review-counter {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-500);
}
.review-counter .cur { color: var(--ink-900); font-weight: 700; }

.review-photo-area {
  flex: 1;
  background:
    linear-gradient(135deg, #0e1a35 0%, #050a1c 100%);
  display: grid; place-items: center;
  position: relative;
  min-height: 480px;
  overflow: hidden;
}
.review-photo {
  width: 86%;
  max-width: 720px;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: linear-gradient(135deg, #d6cfc1 0%, #a89e8a 50%, #6a624f 100%);
  position: relative;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  overflow: hidden;
}
.review-photo::before {
  /* Plate-like nameplate */
  content: "";
  position: absolute;
  inset: 18%;
  background:
    repeating-linear-gradient(90deg, transparent 0 6px, rgba(0,0,0,0.04) 6px 7px),
    linear-gradient(170deg, #cbc4b3 0%, #968b76 100%);
  border-radius: 4px;
  border: 6px solid rgba(40,30,20,0.4);
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.3),
    inset 0 -4px 8px rgba(0,0,0,0.18);
}
.review-photo-text {
  position: absolute;
  inset: 22% 22%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: rgba(20,15,10,0.85);
  font-family: var(--mono);
  z-index: 2;
}
.review-photo-text .pl-row {
  display: flex; gap: 10px; font-size: 9px;
}
.review-photo-text .pl-row .lbl { width: 70px; color: rgba(20,15,10,0.55); text-transform: uppercase; letter-spacing: 0.06em; }
.review-photo-text .brand-name {
  font-family: var(--font);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: rgba(20,15,10,0.9);
  margin-bottom: 4px;
}

.review-thumbs {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-sub);
  overflow-x: auto;
}
.review-thumb {
  width: 64px; height: 48px;
  border-radius: 6px;
  border: 2px solid transparent;
  background: linear-gradient(135deg, #c0b69e 0%, #7a6f55 100%);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  display: grid; place-items: center;
  color: rgba(20,15,10,0.6);
  font-size: 9px;
}
.review-thumb.active { border-color: var(--rb-500); box-shadow: 0 0 0 3px rgba(52,84,209,0.18); }
.review-thumb.edited::before {
  content: "✎";
  position: absolute;
  top: 2px; right: 4px;
  color: var(--rb-500);
  background: #fff;
  border-radius: 3px;
  padding: 0 3px;
  font-size: 10px;
  font-family: var(--font);
}

.review-toolbar {
  position: absolute;
  bottom: 14px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  background: rgba(12, 18, 32, 0.78);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 4px;
  border-radius: 8px;
  z-index: 3;
}
.review-toolbar button {
  background: transparent;
  color: rgba(255,255,255,0.85);
  border: none;
  width: 30px; height: 30px;
  border-radius: 5px;
  cursor: pointer;
  display: grid; place-items: center;
}
.review-toolbar button:hover { background: rgba(255,255,255,0.12); }

.review-side {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: sticky;
  top: calc(var(--nav-h) + 16px);
  max-height: calc(100vh - var(--nav-h) - 32px);
  align-self: flex-start;
}
.review-side-head { padding: 14px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.review-side-head h3 {
  margin: 0; font-size: 13.5px; font-weight: 700; color: var(--ink-900);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

/* Scrollable interior so a long extracted-data list doesn't push the layout */
.review-side-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.review-side-scroll::-webkit-scrollbar { width: 6px; }
.review-side-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.review-side-scroll::-webkit-scrollbar-track { background: transparent; }

.kv-list { padding: 6px 16px 12px; }
.kv-list.dense { padding: 4px 14px 8px; }
.kv-list.dense .kv-row {
  grid-template-columns: 96px 1fr;
  gap: 8px;
  padding: 5px 0;
  font-size: 11.5px;
  border-bottom: 1px dashed var(--border);
}
.kv-list.dense .kv-row .k {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-500);
  font-weight: 700;
}
.kv-list.dense .kv-row .v {
  font-size: 11.5px;
  line-height: 1.4;
}
.review-side-section.dense { padding: 10px 14px; }
.review-side-section.dense h4 {
  font-size: 9.5px;
  margin: 0 0 6px;
}
.review-side-section.dense .capture-strip-item {
  padding: 5px 8px;
  font-size: 11px;
  gap: 6px;
}
.review-side-section.dense .capture-strip-item .when { font-size: 11px; }
.review-side-section.dense .capture-strip-item .who { font-size: 10px; }
.kv-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 8px 0;
  font-size: 12.5px;
  border-bottom: 1px dashed var(--border);
}
.kv-row:last-child { border-bottom: none; }
.kv-row .k {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kv-row .v {
  color: var(--ink-900);
  font-weight: 500;
  word-break: break-word;
}
.kv-row .v.mono { font-family: var(--mono); }
.kv-row .v.empty { color: var(--ink-400); font-style: italic; }

.review-side-section {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.review-side-section h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-500);
  margin: 0 0 10px;
}

/* Capture history strip */
.capture-strip {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.capture-strip-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .12s, border-color .12s;
  font-size: 12px;
}
.capture-strip-item:hover { background: var(--bg-sub); border-color: var(--ink-300); }
.capture-strip-item.active {
  background: var(--rb-50);
  border-color: var(--rb-300);
}
.capture-strip-item .when {
  font-weight: 600; color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}
.capture-strip-item .who {
  margin-left: auto;
  color: var(--ink-500);
  font-size: 11px;
}

/* ============================================
   ALERTS GRID
   ============================================ */
.alerts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}
.alert-card {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex; flex-direction: column;
  gap: 8px;
}
.alert-card.high { border-left-color: var(--bad); }
.alert-card.low { border-left-color: var(--ink-300); }
.alert-card.selected { box-shadow: 0 0 0 2px var(--rb-200); }
.alert-card .head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.alert-card .code { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--ink-900); }
.alert-card .where { font-size: 11.5px; color: var(--ink-500); }
.alert-card .note { font-size: 12.5px; color: var(--ink-700); }
.alert-card .meta {
  font-size: 11px;
  color: var(--ink-500);
  display: flex; align-items: center; gap: 6px;
}
.alert-card .actions {
  display: flex; gap: 6px;
  margin-top: 4px;
}

/* ============================================
   LOGIN — centered card with image left, form right
   ============================================ */
.login-screen {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 26, 69, 0.55), rgba(15, 26, 69, 0.35)),
    url('/static/portal/images/background.jpg') center / cover no-repeat;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}
.login-card-wrap {
  width: 100%;
  max-width: 760px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(15, 26, 69, 0.32), 0 6px 18px rgba(15, 26, 69, 0.18);
  padding: 22px;
}
.login-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
}
@media (max-width: 820px) {
  .login-card-grid { grid-template-columns: 1fr; }
  .login-card-left { display: none; }
}

.login-card-left {
  display: flex;
  flex-direction: column;
  text-align: center;
}
.login-image-frame {
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, #1a2660 0%, #0c1734 100%);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-image-frame img {
  max-width: 65%;
  max-height: 65%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.login-card-left h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.01em;
  margin: 18px 0 6px;
}
.login-card-left p {
  font-size: 12.5px;
  color: var(--ink-500);
  margin: 0;
  line-height: 1.55;
  padding: 0 8px;
}

.login-card-right {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
}
.login-card-right-inner {
  width: 100%;
  max-width: 320px;
  padding: 8px 12px;
}
.login-brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 22px;
}
.login-card-right-inner h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.login-card-right-inner .subtitle {
  font-size: 13px;
  color: var(--ink-500);
  margin-bottom: 22px;
}
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--ink-900);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  outline: none;
  border-color: var(--rb-500);
  box-shadow: 0 0 0 3px rgba(52,84,209,0.12);
}
.btn-block { width: 100%; height: 40px; font-size: 13px; }
.login-foot {
  margin-top: 20px;
  font-size: 11.5px;
  color: var(--ink-400);
  text-align: center;
  font-family: var(--mono);
}

.ai-health {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 6px auto 0;
  font-size: 11px;
  color: var(--ink-500);
  width: 100%;
  justify-content: center;
}
.ai-health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-300);
  flex-shrink: 0;
  transition: background .2s;
}
.ai-health.checking .ai-health-dot {
  background: var(--ink-300);
  animation: ai-pulse 1.4s ease-in-out infinite;
}
.ai-health.healthy .ai-health-dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(21, 164, 99, 0.18);
}
.ai-health.healthy .ai-health-text { color: var(--ok); }
.ai-health.degraded .ai-health-dot {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18);
}
.ai-health.degraded .ai-health-text { color: var(--warn); }
.ai-health.unhealthy .ai-health-dot {
  background: var(--bad);
  box-shadow: 0 0 0 3px rgba(220, 42, 71, 0.15);
}
.ai-health.unhealthy .ai-health-text { color: var(--bad); }
@keyframes ai-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.login-right {
  background: #0c1734;
  position: relative;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: white;
  padding: 0;
}
.login-hero {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.login-right::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.08) 1px, transparent 1px) 0 0 / 24px 24px;
  opacity: 0.4;
}
.login-right-content {
  position: relative;
  text-align: center;
  max-width: 440px;
}
.login-right h2 {
  font-size: 30px; font-weight: 700; letter-spacing: -0.02em;
  margin: 0 0 12px;
}
.login-right p {
  font-size: 15px;
  color: rgba(255,255,255,0.75);
  line-height: 1.55;
  margin: 0 0 28px;
}
.login-stat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  text-align: left;
}
.login-stat {
  background: rgba(255,255,255,0.07);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 12px 14px;
}
.login-stat .v { font-size: 22px; font-weight: 700; }
.login-stat .l { font-size: 10px; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.07em; margin-top: 2px; }

/* ============================================
   COMMAND PALETTE
   ============================================ */
.cmdk-overlay {
  position: fixed; inset: 0;
  background: rgba(12, 18, 32, 0.45);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: grid; place-items: flex-start center;
  padding-top: 12vh;
}
.cmdk {
  width: 92%;
  max-width: 580px;
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--sh-pop);
  overflow: hidden;
  border: 1px solid var(--border);
}
.cmdk-input-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.cmdk-input-wrap input {
  flex: 1; border: none; outline: none;
  font-family: var(--font); font-size: 15px;
  color: var(--ink-900);
}
.cmdk-input-wrap input::placeholder { color: var(--ink-400); }
.cmdk-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.cmdk-group-label {
  padding: 8px 12px 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-400);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.cmdk-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-700);
}
.cmdk-item:hover, .cmdk-item.selected {
  background: var(--rb-50);
  color: var(--rb-600);
}
.cmdk-item .ico { width: 14px; height: 14px; color: var(--ink-400); }
.cmdk-item.selected .ico, .cmdk-item:hover .ico { color: var(--rb-500); }
.cmdk-item .meta { margin-left: auto; font-size: 11px; color: var(--ink-400); font-family: var(--mono); }

/* ============================================
   UTILS
   ============================================ */
.hstack { display: flex; align-items: center; gap: 8px; }
.vstack { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.text-mono { font-family: var(--mono); }
.dim { color: var(--ink-500); }
.dim-strong { color: var(--ink-400); }

/* Scrollbars */
.main::-webkit-scrollbar { width: 8px; }
.main::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.main::-webkit-scrollbar-track { background: transparent; }

/* Two-column dashboard */
.dash-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
}
@media (max-width: 1200px) { .dash-grid { grid-template-columns: 1fr; } }

/* Confidence stacked bar */
.conf-stack {
  display: flex; gap: 2px;
  height: 80px;
  align-items: flex-end;
  padding: 0 6px;
}
.conf-bar {
  flex: 1;
  display: flex;
  flex-direction: column-reverse;
  border-radius: 3px 3px 0 0;
  overflow: hidden;
  min-height: 4px;
  position: relative;
}
.conf-bar .seg-h { background: var(--rb-500); }
.conf-bar .seg-m { background: var(--warn); }
.conf-bar .seg-l { background: var(--bad); }

.legend-row { display: flex; gap: 14px; padding: 10px 18px 14px; font-size: 11px; color: var(--ink-500); }
.legend-row .lg-item { display: flex; align-items: center; gap: 5px; }
.legend-row .lg-dot { width: 10px; height: 10px; border-radius: 2px; }

/* Photo edit-stack thumb */
.thumb-stack {
  position: relative;
  width: 64px; height: 48px;
  flex-shrink: 0;
}
.thumb-stack .ts-back, .thumb-stack .ts-front {
  position: absolute;
  width: 56px; height: 42px;
  border-radius: 5px;
  background: linear-gradient(135deg, #b9af96 0%, #7a6e54 100%);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.thumb-stack .ts-back { left: 0; top: 6px; opacity: 0.7; }
.thumb-stack .ts-front { right: 0; top: 0; }

/* ============================================
   CMDK PALETTE
   ============================================ */
.cmdk-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 18, 28, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
  animation: cmdk-in 140ms ease-out;
}
.cmdk-backdrop[hidden] { display: none; }
@keyframes cmdk-in { from { opacity: 0; } to { opacity: 1; } }
.cmdk {
  width: min(640px, calc(100vw - 32px));
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 60px -8px rgba(15,20,40,0.35), 0 0 0 1px rgba(0,0,0,0.02);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}
.cmdk-input {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--ink-500);
}
.cmdk-input input {
  flex: 1;
  border: none; outline: none; background: transparent;
  font: 500 15px/1.4 var(--sans);
  color: var(--ink-900);
}
.cmdk-input input::placeholder { color: var(--ink-400); font-weight: 400; }
.cmdk-list {
  overflow-y: auto;
  padding: 6px;
}
.cmdk-empty {
  padding: 32px 18px;
  text-align: center;
  color: var(--ink-400);
  font-size: 13px;
}
.cmdk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink-700);
}
.cmdk-item:hover, .cmdk-item:focus { background: var(--rb-50); color: var(--rb-700); }
.cmdk-item-text { flex: 1; min-width: 0; }
.cmdk-item-text > div:first-child {
  font-size: 13.5px; font-weight: 500; color: var(--ink-900);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cmdk-item-sub { font-size: 11.5px; color: var(--ink-500); margin-top: 2px; }
.cmdk-kind {
  font-family: var(--mono);
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-500);
  background: var(--ink-100);
  padding: 3px 7px; border-radius: 5px;
}
.cmdk-foot {
  display: flex; gap: 14px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-sub);
  font-size: 11px; color: var(--ink-500);
}

/* ============================================
   LOGIN FAB
   ============================================ */
.login-fab {
  position: fixed; right: 20px; bottom: 80px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--ink-900);
  color: #fff;
  border: none;
  border-radius: 999px;
  font: 600 12px/1 var(--sans);
  cursor: pointer;
  box-shadow: 0 6px 16px -4px rgba(15,20,40,0.4);
  z-index: 90;
  opacity: 0.85;
  transition: opacity 150ms, transform 150ms;
}
.login-fab:hover { opacity: 1; transform: translateY(-1px); }

/* ============================================
   PORTAL ADDITIONS — server-side template helpers
   ============================================ */

/* Flash alerts (server messages) */
.alert {
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 13px;
  border: 1px solid transparent;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.alert-success { background: var(--ok-50); color: var(--ok); border-color: rgba(21,164,99,0.18); }
.alert-error,
.alert-danger { background: var(--bad-50); color: var(--bad); border-color: rgba(220,42,71,0.18); }
.alert-info { background: var(--info-50); color: var(--info); border-color: rgba(8,145,178,0.18); }

/* Forms (used by users/locations/login forms) */
.form-grid { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 160px 1fr; gap: 14px; align-items: center; }
.form-row label { font-size: 12.5px; font-weight: 600; color: var(--ink-700); }
.form-row input,
.form-row select,
.form-row textarea {
  height: 36px; padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font); font-size: 13px;
  color: var(--ink-900); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form-row textarea { height: auto; padding: 8px 12px; resize: vertical; }
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none; border-color: var(--rb-500);
  box-shadow: 0 0 0 3px rgba(52,84,209,0.12);
}
.form-row input[type="checkbox"] { height: auto; width: auto; }

/* Modal (used by photo viewer) */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(12,18,32,0.65);
  backdrop-filter: blur(4px);
  z-index: 150;
  display: none;
  align-items: center; justify-content: center;
  padding: 4vh 4vw;
}
.modal-backdrop.open,
.modal-backdrop.active { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--sh-pop);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 1100px;
  max-height: 92vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.modal-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; color: var(--ink-900); }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot {
  padding: 12px 18px; border-top: 1px solid var(--border);
  background: var(--bg-sub);
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
}
.modal-close {
  background: transparent; border: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 6px;
  color: var(--ink-500);
  display: grid; place-items: center;
}
.modal-close:hover { background: var(--ink-50); color: var(--ink-900); }

/* Photo grid (tagcode review on existing data — preserves multi-photo capture layout) */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.photo-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--ink-100);
  cursor: pointer;
  transition: box-shadow .15s, transform .15s;
}
.photo-thumb:hover { box-shadow: var(--sh-2); transform: translateY(-1px); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb .badge { position: absolute; top: 6px; left: 6px; }
.photo-thumb .photo-meta {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 6px 8px;
  background: linear-gradient(to top, rgba(12,18,32,0.85), transparent);
  color: #fff;
  font-size: 11px; font-family: var(--mono);
  display: flex; justify-content: space-between; gap: 6px;
}
.photo-thumb .deleted-overlay {
  position: absolute; inset: 0;
  background: rgba(220,42,71,0.4);
  display: grid; place-items: center;
  color: #fff; font-weight: 700;
}

/* Capture card (groups photos by capture on tagcode page) */
.capture-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--sh-1);
}
.capture-card-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-sub);
}
.capture-card-head .left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.capture-card-head .when { font-family: var(--mono); font-size: 12px; color: var(--ink-700); font-weight: 600; }
.capture-card-head .who { font-size: 12px; color: var(--ink-500); }
.capture-card-body { padding: 14px 16px; }

/* Empty state */
.empty-state {
  padding: 60px 24px;
  text-align: center;
  color: var(--ink-500);
}
.empty-state .empty-icon { color: var(--ink-300); margin-bottom: 14px; }
.empty-state .empty-title { font-size: 15px; font-weight: 600; color: var(--ink-700); margin-bottom: 6px; }
.empty-state .empty-sub { font-size: 13px; color: var(--ink-500); }

/* Login feature card (mini hero on login screen) */
.login-feature-card {
  background: rgba(255,255,255,0.07);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 18px;
  text-align: left;
}

/* ============================================
   TAGCODES PANEL — slides out from beside the locations pane
   when a production line is in context (route /portal/production-line/X
   or /portal/tagcode/X).
   ============================================ */
:root {
  --tc-pane-w: 260px;
}
.tagcodes-pane {
  width: 0;
  flex-shrink: 0;
  background: #fff;
  border-right: 0 solid var(--border);
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-self: flex-start;
  transition: width 240ms cubic-bezier(0.4, 0, 0.2, 1), border-right-width 240ms;
}
.tagcodes-pane.open {
  width: var(--tc-pane-w);
  border-right-width: 1px;
}

.tagcodes-pane-head {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  width: var(--tc-pane-w);
}
.tagcodes-title {
  display: flex; align-items: center;
  font: 700 13px/1.2 var(--sans);
  color: var(--ink-900);
  letter-spacing: -0.005em;
}
.tagcodes-sub {
  font: 500 11px/1.4 var(--sans);
  color: var(--ink-500);
  margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tagcodes-pane .loc-search input {
  height: 30px;
  font-size: 12px;
}

.tagcodes-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 14px;
  width: var(--tc-pane-w);
  display: flex; flex-direction: column; gap: 2px;
}
.tagcodes-list::-webkit-scrollbar { width: 6px; }
.tagcodes-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.tagcodes-list::-webkit-scrollbar-track { background: transparent; }

.tagcode-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  text-decoration: none;
  color: var(--ink-700);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  transition: background .12s, color .12s;
  cursor: pointer;
}
.tagcode-pill:hover {
  background: var(--ink-50);
  color: var(--ink-900);
}
.tagcode-pill.active {
  background: var(--rb-50);
  color: var(--rb-700);
  font-weight: 700;
}
.tagcode-pill .tc-code {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tagcode-pill .tc-alert {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--bad);
  flex-shrink: 0;
}
.tagcode-pill .tc-count {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--ink-500);
  background: var(--ink-50);
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}
.tagcode-pill.active .tc-count {
  background: var(--rb-100);
  color: var(--rb-700);
}
.tagcodes-empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--ink-400);
  font-size: 11.5px;
  line-height: 1.5;
}

/* Photo wall — every photo for a tagcode in one tiled view (capture grouping
   collapsed; each tile carries its own caption with date + photographer). */
.photo-wall {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #0e1a35 0%, #050a1c 100%);
  align-content: start;
  overflow-y: auto;
  min-height: 420px;
}
.photo-tile {
  margin: 0;
  position: relative;
  background: #1a2545;
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  display: flex;
  flex-direction: column;
}
.photo-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
.photo-tile img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #0c1220;
}
.photo-tile figcaption {
  padding: 6px 8px;
  background: rgba(12, 18, 32, 0.92);
  color: rgba(255,255,255,0.85);
  font: 600 10.5px/1.2 var(--mono);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}
.photo-tile figcaption .when {
  color: rgba(255,255,255,0.95);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.photo-tile figcaption .who {
  color: rgba(255,255,255,0.6);
  text-align: right;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  max-width: 110px;
}
.photo-tile-edited {
  position: absolute; top: 6px; right: 6px;
}
.photo-tile-conf {
  position: absolute; top: 6px; left: 6px;
}

/* Photo modal info rows (used by photo-editor.js) */
.info-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 14px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.info-row:last-child { border-bottom: none; }
.info-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-500);
}
.info-value {
  color: var(--ink-900);
  font-weight: 500;
  font-family: var(--mono);
  word-break: break-word;
}
.modal-body h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-700);
  margin: 18px 0 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.modal-body h3:first-child { margin-top: 0; }

.info-collapsible { margin: 0; }
.info-collapsible > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.info-collapsible > summary::-webkit-details-marker { display: none; }
.info-collapsible > summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid var(--ink-500);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.15s ease;
  margin-top: 14px;
}
.info-collapsible[open] > summary::before { transform: rotate(90deg); }
.info-collapsible > summary > h3 {
  flex: 1;
  margin: 18px 0 6px;
}
.info-collapsible[open] > summary > h3 {
  border-bottom-color: transparent;
}
.info-collapsible-body {
  border-top: 1px solid var(--border);
  margin-top: -1px;
}
.modal-body h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-500);
  margin: 12px 0 4px;
}
.confidence-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.confidence-high   { background: var(--ok-50);   color: var(--ok); }
.confidence-medium { background: var(--warn-50); color: var(--warn); }
.confidence-low    { background: var(--bad-50);  color: var(--bad); }
.confidence-unknown{ background: var(--ink-50);  color: var(--ink-600); }

/* Banner (component alert) */
.banner {
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.banner.warn {
  background: var(--warn-50);
  color: var(--warn);
  border-color: rgba(217,119,6,0.18);
}
.banner.bad {
  background: var(--bad-50);
  color: var(--bad);
  border-color: rgba(220,42,71,0.18);
}
.banner .banner-text { flex: 1; min-width: 0; }
.banner .banner-text strong { color: var(--ink-900); }
.banner .banner-text small { color: var(--ink-500); display: block; margin-top: 2px; font-size: 11.5px; }

/* Density tweaks */
[data-density="compact"] .table td { padding: 8px 12px; font-size: 12px; }
[data-density="compact"] .kpi { padding: 12px 14px; }
[data-density="spacious"] .table td { padding: 16px 16px; font-size: 13px; }
[data-density="spacious"] .kpi { padding: 22px 22px; }

/* Make the inbox row layout work without checkboxes too (server tables use a similar look) */
.inbox-row.no-cb { grid-template-columns: 56px 1fr auto auto; }

/* Small helpers used in templates */
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-18 { margin-bottom: 18px; }
.mt-8 { margin-top: 8px; }
.mt-18 { margin-top: 18px; }
.mt-auto { margin-top: auto; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.fw-700 { font-weight: 700; }
.no-underline { text-decoration: none; color: inherit; }
.cursor-pointer { cursor: pointer; }
.w-full { width: 100%; }


/* Capture media categories (O1 / D2 / V1) and video clips */
.photo-tile-cat {
  position: absolute; left: 6px; bottom: 34px;
  font-family: var(--mono);
}
.photo-tile-video .video-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid; place-items: center;
  background: #0c1220;
  color: rgba(255,255,255,0.55);
  font: 600 12px/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.photo-tile-video .video-play {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -60%);
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(12, 18, 32, 0.78);
  color: #fff; font-size: 18px;
  pointer-events: none;
}
