/* ============================================================
   StoreLens · design system
   IBM Plex Sans (text) · JetBrains Mono (numbers/codes/dates)
   Dark table headers · alternating rows · bold totals
   Status colours strictly for status · negatives in red brackets
   ============================================================ */

:root {
  /* Palette */
  --ink:        #16202e;   /* dark header / primary text */
  --ink-2:      #24324a;
  --paper:      #f3f5f8;   /* app background */
  --card:       #ffffff;
  --line:       #dde3ec;
  --muted:      #64748b;
  --accent:     #1f4e8c;   /* brand blue — links & primary actions only */
  --accent-soft:#e8f0fb;

  /* Status — used strictly for status */
  --ok:         #0e7a3d;
  --ok-bg:      #e7f5ec;
  --warn:       #b45309;
  --warn-bg:    #fdf1e0;
  --bad:        #b91c1c;
  --bad-bg:     #fdeaea;

  --row-alt:    #f7f9fc;
  --radius:     8px;
  --shadow:     0 1px 2px rgba(22,32,46,.06), 0 4px 14px rgba(22,32,46,.05);

  --font-text:  "IBM Plex Sans", system-ui, sans-serif;
  --font-mono:  "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-text);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

/* All numbers, codes and dates render in JetBrains Mono */
.num, .num * {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.neg { color: var(--bad); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Shell layout ===== */
.shell { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  height: 100vh; overflow-y: auto; flex-shrink: 0;
  width: 248px; flex: 0 0 248px;
  background: #ffffff;
  color: #3f4a5a;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  height: 56px; flex: 0 0 56px; padding: 0 16px; border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 7px;
  background: var(--accent); color: #fff;
  font-family: var(--font-mono); font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.brand-name { color: var(--ink); font-weight: 700; font-size: 15px; }

.nav { padding: 6px 0 16px; flex: 1; }
.nav-group-title {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  color: #8a94a6; font: 600 10.5px/1 var(--font-text);
  letter-spacing: .09em; padding: 15px 16px 6px;
  display: flex; justify-content: space-between; align-items: center;
}
.nav-group-title .chev { transition: transform .15s; display: inline-flex; color: #b6bec9; }
.nav-group.collapsed .nav-group-items { display: none; }
.nav-group.collapsed .chev { transform: rotate(-90deg); }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 16px 7px 14px; color: #3f4a5a; font-size: 13px;
  border-left: 3px solid transparent;
}
.nav-link:hover { background: var(--paper); text-decoration: none; color: var(--ink); }
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent); font-weight: 600;
  border-left-color: var(--accent);
}
.nav-ico { display: inline-flex; color: #98a2b3; }
.nav-link:hover .nav-ico { color: #3f4a5a; }
.nav-link.active .nav-ico { color: var(--accent); }
.sidebar-foot { padding: 10px 16px; font-size: 11px; color: #98a2b3; border-top: 1px solid var(--line); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow-y: auto; }

.topbar {
  background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px; height: 56px; min-height: 56px;
  flex: 0 0 56px;                 /* never compressed by tall page content */
  position: sticky; top: 0; z-index: 20;
}
.burger { display: none; background: none; border: 0; font-size: 18px; cursor: pointer; }
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.bell { position: relative; background: none; border: 0; font-size: 16px; cursor: pointer; }
.bell-dot {
  position: absolute; top: -2px; right: -3px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--bad); border: 2px solid var(--card);
}
.user-chip { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.user-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-role { font-size: 11px; color: var(--muted); }

.content { padding: 22px; flex: 1 0 auto; }
.page-foot { flex-shrink: 0; 
  display: flex; justify-content: space-between;
  padding: 12px 22px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px;
}

/* ===== Cards ===== */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.card-title { font-size: 13.5px; font-weight: 600; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 16px; }

/* ===== Hero band ===== */
.hero {
  background: linear-gradient(120deg, var(--ink) 0%, var(--ink-2) 100%);
  color: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 22px; display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
}
.hero h1 { margin: 0 0 3px; font-size: 19px; font-weight: 600; }
.hero .hero-sub { color: #a9b8cd; font-size: 12.5px; }
.hero .hero-kpi { text-align: right; margin-left: auto; }
.hero .hero-kpi .v { font-family: var(--font-mono); font-size: 26px; font-weight: 700; }
.hero .hero-kpi .l { font-size: 11px; color: #a9b8cd; letter-spacing: .06em; }

/* ===== KPI tiles ===== */
.kpi-grid {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 14px; margin: 16px 0;
}
.kpi {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 13px 15px;
}
.kpi .k-label { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.kpi .k-value { font-family: var(--font-mono); font-size: 21px; font-weight: 700; margin: 4px 0 2px; }
.kpi .k-note  { font-size: 11.5px; color: var(--muted); }
.kpi .k-note .num { font-size: 11.5px; }

/* ===== Grids ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mt { margin-top: 16px; }

/* ===== Tables ===== */
.table-wrap { overflow: auto; max-height: 520px; }
table.data {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
table.data thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--ink); color: #fff;
  font-weight: 600; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase;
  padding: 9px 12px; text-align: left; white-space: nowrap;
}
table.data thead th.r, table.data td.r { text-align: right; }
table.data thead th.c, table.data td.c { text-align: center; }
table.data tbody td { padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data tbody tr:nth-child(even) { background: var(--row-alt); }
table.data tbody tr:hover { background: var(--accent-soft); }
table.data tbody tr.rowlink { cursor: pointer; }
table.data tfoot td {
  padding: 9px 12px; font-weight: 700;
  border-top: 2px solid var(--ink); background: #eef1f6;
}
table.data tfoot .num { font-weight: 700; }

/* ===== Badges — status colours strictly for status ===== */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
}
.badge-ok    { background: var(--ok-bg);   color: var(--ok); }
.badge-warn  { background: var(--warn-bg); color: var(--warn); }
.badge-bad   { background: var(--bad-bg);  color: var(--bad); }
.badge-muted { background: #eef1f6;        color: var(--muted); }

/* ===== Legend footnotes under status tables ===== */
.legend {
  display: flex; gap: 18px; flex-wrap: wrap;
  padding: 10px 16px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted);
}
.legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.dot-ok   { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-bad  { background: var(--bad); }

/* ===== Alert banners ===== */
.banner {
  display: flex; align-items: center; gap: 10px;
  border-radius: var(--radius); padding: 11px 15px; margin-bottom: 16px;
  font-size: 13px; font-weight: 500;
}
.banner-bad  { background: var(--bad-bg);  color: var(--bad);  border: 1px solid #f3c4c4; }
.banner-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #f0d8b0; }
.banner .banner-ico { font-size: 15px; }

/* ===== Buttons & controls ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; border: 0; cursor: pointer;
  padding: 7px 14px; border-radius: 6px; font: 600 12.5px var(--font-text);
}
.btn:hover { background: #173e70; text-decoration: none; color: #fff; }
.btn-ghost {
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--accent-soft); color: var(--ink); }
select.ctl, input.ctl {
  font: 500 13px var(--font-text); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 10px; background: var(--card);
}
input.ctl.num, select.ctl.num { font-family: var(--font-mono); }

/* ===== Utilization bar ===== */
.util { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.util-track {
  flex: 1; height: 8px; border-radius: 999px; background: #e6ebf2; overflow: hidden;
  position: relative;
}
.util-fill { height: 100%; border-radius: 999px; }
.util-fill.ok   { background: var(--ok); }
.util-fill.warn { background: var(--warn); }
.util-fill.bad  { background: var(--bad); }

/* ===== Misc ===== */
.text-muted { color: var(--muted); }
.small { font-size: 12px; }
.exception-list { list-style: none; margin: 0; padding: 0; }
.exception-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.exception-list li:last-child { border-bottom: 0; }
.exception-list .cnt { margin-left: auto; }

/* ===== Responsive ===== */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .burger { display: block; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== SVG icons ===== */
.ico { display: inline-block; vertical-align: -2px; }
.btn .ico, .bell .ico { vertical-align: -3px; }
.banner .banner-ico { display: inline-flex; }
.bell { color: #4b5768; display: inline-flex; }
.burger { color: var(--ink); }

/* ===== Role switcher (View-as RBAC demo control) ===== */
.viewas { display: inline-flex; align-items: center; gap: 7px; }
.viewas select { font-size: 12.5px; padding: 5px 8px; }

/* ===== Access restricted / not built ===== */
.restricted { max-width: 520px; margin: 60px auto; }
.restricted-body { text-align: center; padding: 36px 32px; }
.restricted-ico { color: var(--bad); margin-bottom: 8px; }
.restricted-ico.muted { color: #98a2b3; }
.restricted h2 { margin: 4px 0 8px; font-size: 18px; }
.restricted p { margin: 0 0 18px; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 12px; background: #fbfcfe; border-radius: 8px 8px 0 0; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer;
  padding: 11px 14px; font: 600 13px var(--font-text); color: var(--muted); }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .cnt { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-left: 4px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== Store card grid ===== */
.store-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 1100px){ .store-grid { grid-template-columns: repeat(2,1fr); } }
.store-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; cursor: pointer; }
.store-card:hover { border-color: var(--accent); }
.store-card .sc-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 8px; }
.store-card .sc-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 12.5px; }
.store-card .sc-metrics .lbl { color: var(--muted); }

/* ===== Mini bar chart (CSS only) ===== */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding: 8px 4px 0; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; height: 100%; }
.bars .bar .fill { width: 100%; max-width: 46px; background: var(--accent); border-radius: 4px 4px 0 0; position: relative; }
.bars .bar .fill.under { background: #9db8dc; }
.bars .bar .v { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }
.bars .bar .d { font-size: 11px; color: var(--muted); }
.bar-target { border-top: 2px dashed var(--warn); }

/* ===== Store Passport modal ===== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(22,32,46,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 32px 16px; overflow-y: auto; }
.modal { background: var(--card); border-radius: 10px; width: 100%; max-width: 640px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); max-height: calc(100vh - 64px); display: flex; flex-direction: column; }
#passport-modal .modal { max-width: 860px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-title { font-weight: 600; font-size: 15px; }
.modal-close { margin-left: auto; background: none; border: 0; font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
#passport-modal .modal-body { padding: 0; }
.modal .tab-panel { padding: 16px 18px; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 7px 14px; font-size: 13px; }
.kv .k { color: var(--muted); }

/* ===== Document / feed rows ===== */
.doc-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.doc-row:last-child { border-bottom: 0; }
.doc-ico { color: #98a2b3; display: inline-flex; }
.doc-meta { flex: 1; }
.doc-sub { font-size: 11.5px; color: var(--muted); }
.badge-upd { background: var(--accent-soft); color: var(--accent); }

/* ===== Wizard (Add User) ===== */
.wizard-steps { display: flex; gap: 4px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.wstep { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.wstep .n { width: 20px; height: 20px; border-radius: 50%; background: #e6ebf2; color: var(--muted);
  font-family: var(--font-mono); font-size: 11px; display: flex; align-items: center; justify-content: center; }
.wstep.active { color: var(--accent); font-weight: 600; }
.wstep.active .n { background: var(--accent); color: #fff; }
.wstep.done .n { background: var(--ok); color: #fff; }

/* ===== Form grid ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.form-grid .ctl { width: 100%; }
@media (max-width: 800px){ .form-grid { grid-template-columns: 1fr; } }

/* ===== Toggle ===== */
.toggle { position: relative; display: inline-block; width: 34px; height: 19px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider { position: absolute; inset: 0; background: #cfd7e2; border-radius: 999px; transition: .15s; cursor: pointer; }
.toggle .slider:before { content: ""; position: absolute; width: 15px; height: 15px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; transition: .15s; }
.toggle input:checked + .slider { background: var(--ok); }
.toggle input:checked + .slider:before { transform: translateX(15px); }

/* ===== Source connection cards ===== */
.src-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 1000px){ .src-grid { grid-template-columns: 1fr; } }
.src-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.src-card .sc-title { display: flex; align-items: center; gap: 9px; font-weight: 600; margin-bottom: 10px; }
.src-card .kv { grid-template-columns: 130px 1fr; margin-bottom: 12px; }
.src-actions { display: flex; gap: 8px; }

/* ===== Login ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--paper); }
.login-card { width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 28px; }
.login-card h1 { font-size: 18px; margin: 14px 0 2px; }
.login-field { margin-top: 14px; }
.login-field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.login-field .ctl { width: 100%; }
.modal-backdrop[hidden] { display: none; }

/* ===== Sticky topbar inside scrolling main ===== */
.topbar { position: sticky; top: 0; z-index: 30; }

/* ===== Toast notifications ===== */
#toast-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; font-size: 12.5px; padding: 10px 14px; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 340px; opacity: 0; transform: translateY(6px);
  transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: none; }
.toast .num { color: #9fc1ea; }

/* ---- Notification dropdown ---- */
.bell-wrap { position: relative; }
.bell-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 340px; z-index: 90;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(22,32,46,.14); padding: 8px; max-height: 380px; overflow: auto;
}
.bell-panel[hidden] { display: none; }
.bell-item { display: flex; gap: 8px; align-items: flex-start; padding: 8px 8px; border-radius: 7px; font-size: 12.8px; line-height: 1.45; }
.bell-item + .bell-item { border-top: 1px solid var(--line); }
.bell-item .badge { flex: 0 0 auto; margin-top: 1px; }
.bell-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* ===== Modal footer + generic pieces (form modals) ===== */
.spacer { flex: 1 1 auto; }
.modal-foot {
  display: flex; align-items: center; gap: 10px; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid var(--line); background: #fafbfd;
  border-radius: 0 0 10px 10px;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: 0; border-radius: 7px; background: transparent;
  color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; text-decoration: none;
}
.icon-btn:hover { background: #eef2f7; color: var(--ink); text-decoration: none; }
.topbar-right .icon-btn { border: 1px solid var(--line); }

/* ===== Section headings inside card bodies ===== */
.section-h {
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin: 6px 0 10px;
}
.card-body .section-h:first-child { margin-top: 0; }
.doc-rows { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; overflow: hidden; }

/* ===== Wizard steps / panels ===== */
.wstep .wnum {
  width: 20px; height: 20px; border-radius: 50%; background: #e6ebf2; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
}
.wstep.active .wnum { background: var(--accent); color: #fff; }
.wstep.done .wnum { background: var(--ok); color: #fff; }
.wpanel { display: none; padding-top: 4px; }
.wpanel.active { display: block; }
#wiz-steps { margin: -18px -20px 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: #fafbfd; }

/* ===== Data source cards ===== */
.src-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.src-head strong { font-size: 13.5px; }
.kv .lbl { color: var(--muted); }

/* ===== Newsletters ===== */
.nl { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.nl summary {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer;
  list-style: none; font-size: 13.5px;
}
.nl summary::-webkit-details-marker { display: none; }
.nl summary:hover { background: #f7f9fc; }
.nl .nl-title { font-weight: 600; }
.nl[open] summary { border-bottom: 1px solid var(--line); background: #fafbfd; }
.nl .nl-body { padding: 14px 16px; font-size: 13px; line-height: 1.65; color: #3c4a5c; }

/* ===== Card toolbar (buttons/filters row above a table) ===== */
.card-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 1px solid var(--line); background: #fafbfd;
}
.card-toolbar .ctl { min-width: 200px; }
/* Store filter in the topbar */
.storefilter { display: flex; align-items: center; gap: 7px; }
.storefilter .small { white-space: nowrap; }

/* ===== Store P&L matrix ===== */
.pl-input { width: 110px; max-width: 110px; text-align: right; padding: 5px 8px; font-size: 12.5px; display: none; }
#pl-form.editing .pl-input { display: inline-block; }
#pl-form.editing .pl-view { display: none; }
#pl-form:not(.editing) .pl-editable-row { }
tr.pl-sub td { background: #f4f7fb; border-top: 1px solid var(--line); }
.pl-editable {
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 1px 5px; margin-left: 6px;
  display: none;
}
#pl-form.editing .pl-editable { display: inline-block; }
#tbl-pl td.r { white-space: nowrap; }

/* [hidden] must always win over component display rules */
[hidden] { display: none !important; }

/* ===== Standardized header: one line, fixed height, never distorts ===== */
.topbar { flex-wrap: nowrap; min-width: 0; }
.topbar-title {
  flex: 1 1 auto; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-right { flex: 0 0 auto; flex-wrap: nowrap; gap: 14px; }
.tb-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tb-ctl { height: 34px; font-size: 12.5px; }
.storefilter .tb-ctl { width: 168px; }
.viewas .tb-ctl { width: 178px; }
.tb-ctl:disabled { background: #f2f5f9; color: var(--ink); opacity: 1; cursor: default; }
.user-chip { flex: 0 0 auto; }
.user-chip .user-meta { max-width: 150px; }
.user-chip .user-name, .user-chip .user-role {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 1240px) {
  .tb-label { display: none; }
  .storefilter .tb-ctl { width: 140px; }
  .viewas .tb-ctl { width: 150px; }
  .topbar-right { gap: 10px; }
}
@media (max-width: 980px) {
  .user-chip .user-meta { display: none; }
}
@media (max-width: 820px) {
  .storefilter { display: none; }   /* still available on wide screens; mobile uses page content */
}
