/* ============================================================
   Shared component layer — buttons, inputs, badges, panels, tables,
   charts, dialogs and page chrome.

   Loaded AFTER the active theme stylesheet (theme-softfleet.css). It
   consumes ONLY the component variables that file bridges from the
   SoftFleet design tokens — no colour or size is written literally
   here, which is what makes swapping the theme (light ⇄ dark) a
   one-line change and keeps page templates theme-agnostic.

   The app shell itself (top bar, sidebar, content column) is
   deliberately NOT here: it lives in the theme stylesheet.
   ============================================================ */

/* Page header */
.eyebrow{font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--accent);margin-bottom:6px}
.page-header{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;flex-wrap:wrap;margin-bottom:22px}
.page-title{font-size:var(--ui-page-title);font-weight:700;letter-spacing:-.02em;margin:0 0 4px}
.page-sub{font-size:13px;color:var(--muted);margin:0}
.header-actions{display:flex;gap:8px;flex-wrap:wrap}

/* Buttons */
.btn{display:inline-flex;align-items:center;gap:6px;font-family:inherit;font-size:13px;font-weight:600;
  padding:9px 15px;border-radius:var(--radius-sm);border:1px solid transparent;cursor:pointer;
  background:var(--accent);color:var(--on-accent);line-height:1;transition:background .12s}
.btn:hover{text-decoration:none}
.btn-primary{background:var(--accent);color:var(--on-accent)} .btn-primary:hover{background:var(--accent-hover)}
.btn-ghost{background:var(--panel);border-color:var(--border2);color:var(--text)} .btn-ghost:hover{background:var(--panel2)}
.btn-danger{background:var(--error);color:var(--on-accent)} .btn-danger:hover{filter:brightness(.95)}
.btn-sm{padding:6px 11px;font-size:12px} .btn-xs{padding:4px 9px;font-size:11px}

/* Inputs */
.label{display:block;font-size:11px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:var(--muted);margin:0 0 6px}
.input{width:100%;font-family:inherit;font-size:14px;padding:10px 12px;border:1px solid var(--border2);
  border-radius:var(--radius-sm);background:var(--panel);color:var(--text)}
.input:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
.input-sm{padding:7px 10px;font-size:13px}
select.input{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b6b8a' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 12px center;padding-right:30px}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;
  clip:rect(0,0,0,0);white-space:nowrap;border:0}
.skip-link{position:fixed;left:12px;top:12px;z-index:1200;transform:translateY(-140%);
  padding:8px 12px;border-radius:8px;background:var(--accent);color:#fff;font-weight:700;
  box-shadow:var(--shadow-md)}
.skip-link:focus{transform:translateY(0);outline:3px solid var(--focus,#f6c343);outline-offset:2px}
:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible{
  outline:3px solid var(--focus,#f6c343);outline-offset:2px}

/* Badges */
.badge{display:inline-flex;align-items:center;gap:5px;font-size:11px;font-weight:600;letter-spacing:.02em;
  padding:3px 10px;border-radius:999px;line-height:1.5;text-transform:uppercase}
.badge-success{background:var(--success-soft);color:var(--success-ink)}
.badge-warn{background:var(--warn-soft);color:var(--warn-ink)}
.badge-error{background:var(--error-soft);color:var(--error-ink)}
.badge-info{background:var(--info-soft);color:var(--info-ink)}
.badge-neutral{background:var(--panel2);color:var(--muted)}
.dot-badge::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor;display:inline-block}

/* Panels + KPI cards (flat, no left bar — matches clickdummy) */
.panel{background:var(--panel);border:1px solid var(--border);border-radius:var(--radius);
  box-shadow:var(--shadow);padding:18px 20px;margin-bottom:16px}
.panel h2{font-size:14px;font-weight:700;margin:0 0 14px}
.panel h3{font-size:13px;font-weight:600;color:var(--muted);margin:0 0 8px}
.kpi-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:14px;margin-bottom:18px}
.kpi-card{background:var(--panel);border:1px solid var(--border);border-radius:var(--radius);
  box-shadow:var(--shadow);padding:18px 20px;display:flex;flex-direction:column}
a.kpi-card:hover{box-shadow:var(--shadow-md);text-decoration:none;border-color:var(--border2)}
.kpi-label{font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
/* The grid stretches every card to the tallest, and the value is pinned to the bottom — so a card
   whose label wraps to two lines ("Declined / failed") keeps its number on the SAME baseline as the
   single-line cards next to it, instead of dropping it a line lower. */
.kpi-value{font-size:30px;font-weight:700;letter-spacing:-.02em;margin-top:auto;padding-top:8px;color:var(--text)}
.kpi-card.success .kpi-value{color:var(--success)}

/* Avatars (colored initials — signature of the clickdummy tables) */
.avatar{width:34px;height:34px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;
  font-size:12px;font-weight:700;color:var(--on-accent);flex-shrink:0}
/* Categorical identity palette + payment-scheme marks: these are NOT theme colours —
   an avatar hue distinguishes users and a scheme mark must stay Visa/Mastercard brand
   accurate, so they are deliberately literal and identical in both themes. */
.avatar-a{background:#3c32fa} .avatar-b{background:#0db860} .avatar-c{background:#f59e0b}
.avatar-d{background:#e0457b} .avatar-e{background:#0e9f8e} .avatar-f{background:#7d77ff}
.cell-lead{display:flex;align-items:center;gap:11px}
.cell-lead .nm{font-weight:600} .cell-lead .sub{font-size:12px;color:var(--muted2)}

/* Tables */
.table-wrap{border:1px solid var(--border);border-radius:var(--radius);overflow:auto;background:var(--panel);box-shadow:var(--shadow)}
table,.table{width:100%;border-collapse:collapse;background:var(--panel)}
/* Column headings are 10.5px uppercase on the tinted --panel2, where --muted measures 4.43:1 —
   just under AA. They get their own darker ink rather than the general muted grey. */
th{position:sticky;top:0;background:var(--panel2);text-align:left;font-size:10.5px;font-weight:600;letter-spacing:.06em;
  text-transform:uppercase;color:var(--th-ink);padding:11px 16px;border-bottom:1px solid var(--border)}
td{padding:13px 16px;font-size:13.5px;border-bottom:1px solid var(--border)}
tbody tr:last-child td{border-bottom:none} tbody tr:hover td{background:var(--panel2)}
.cell-name{font-weight:600}
.num{text-align:right;font-variant-numeric:tabular-nums}
.empty{text-align:center;color:var(--muted);padding:34px;font-size:13px}

/* Nav dropdown (grouped menu items) */

/* User menu (top-right) */
.user-drop{position:relative}
.user-drop>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:8px}
.user-drop>summary::-webkit-details-marker{display:none}
.user-menu{position:absolute;top:calc(100% + 10px);right:0;background:var(--panel);border:1px solid var(--border);border-radius:10px;box-shadow:var(--shadow-md);min-width:190px;padding:6px;z-index:30}
.user-menu .who{font-size:12px;color:var(--muted);padding:7px 10px;border-bottom:1px solid var(--border);margin-bottom:4px}
.user-menu a,.user-menu button{display:block;width:100%;text-align:left;padding:8px 11px;border-radius:8px;font-size:13px;color:var(--text);background:none;border:none;font-family:inherit;cursor:pointer}
.user-menu a:hover,.user-menu button:hover{background:var(--panel2);text-decoration:none}

/* Operator command palette: global quick-open for pages and fleet objects. */
.cmdk-trigger{display:inline-flex;align-items:center;gap:8px;height:34px;padding:0 10px;
  border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--panel);
  color:var(--muted);font-family:inherit;font-size:13px;font-weight:600;cursor:pointer}
.cmdk-trigger:hover{background:var(--panel2);color:var(--text)}
.cmdk-trigger svg{width:16px;height:16px;flex:0 0 16px}
.cmdk-trigger kbd{font-family:var(--ui-mono);font-size:10px;font-weight:700;color:var(--muted2);
  border:1px solid var(--border);border-bottom-width:2px;border-radius:5px;padding:1px 5px;background:var(--bg)}
.cmdk{position:fixed;inset:0;z-index:1000;display:flex;align-items:flex-start;justify-content:center;
  padding:12vh 18px 18px;background:rgba(15,18,40,.42)}
.cmdk[hidden]{display:none}
.cmdk-panel{width:min(720px,100%);background:var(--panel);border:1px solid var(--border);
  border-radius:var(--radius);box-shadow:var(--shadow-md);overflow:hidden}
.cmdk-search{display:flex;align-items:center;gap:10px;padding:13px 14px;border-bottom:1px solid var(--border)}
.cmdk-search svg{width:18px;height:18px;color:var(--muted);flex:0 0 18px}
.cmdk-search input{flex:1;min-width:0;border:0;background:transparent;color:var(--text);
  font:inherit;font-size:15px;outline:none}
.cmdk-close{border:1px solid var(--border);border-radius:6px;background:var(--bg);color:var(--muted);
  font-family:var(--ui-mono);font-size:11px;font-weight:700;padding:3px 7px;cursor:pointer}
.cmdk-close:hover{color:var(--text);background:var(--panel2)}
.cmdk-results{max-height:min(62vh,520px);overflow:auto;padding:8px}
.cmdk-group{padding:7px 8px 5px;font-size:10.5px;font-weight:700;letter-spacing:.07em;
  text-transform:uppercase;color:var(--muted)}
.cmdk-item{width:100%;display:flex;align-items:center;gap:10px;padding:10px 11px;border:0;
  border-radius:8px;background:transparent;color:var(--text);font:inherit;text-align:left;cursor:pointer}
.cmdk-item:hover,.cmdk-item.on{background:var(--accent-soft)}
.cmdk-ico{width:28px;height:28px;border-radius:7px;background:var(--panel2);border:1px solid var(--border);
  color:var(--accent);display:inline-flex;align-items:center;justify-content:center;font-size:12px;
  font-weight:800;flex:0 0 28px}
.cmdk-ico svg{width:16px;height:16px;display:block}
.cmdk-main{min-width:0;flex:1}
.cmdk-name{font-size:13.5px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cmdk-sub{font-size:11.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:1px}
.cmdk-go{width:18px;height:18px;color:var(--muted2);display:inline-flex;align-items:center;justify-content:center}
.cmdk-go svg{width:16px;height:16px;display:block}
.cmdk-empty{padding:34px 12px;text-align:center;color:var(--muted);font-size:13px}


.eyebrow{font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--accent);margin-bottom:6px}
.page-header{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;flex-wrap:wrap;margin-bottom:22px}
.page-title{font-size:24px;font-weight:700;letter-spacing:-.02em;margin:0 0 4px}
.page-sub{font-size:13px;color:var(--muted);margin:0}
.header-actions{display:flex;gap:8px;flex-wrap:wrap}

/* Segmented pill toggle (sub-tabs / filter chips) */
.segmented{display:inline-flex;gap:4px;background:var(--panel);border:1px solid var(--border);border-radius:var(--radius-sm);padding:4px;margin-bottom:16px}
.segmented a,.segmented button{font-family:inherit;font-size:13px;font-weight:600;color:var(--muted);
  background:none;border:none;padding:7px 14px;border-radius:8px;cursor:pointer}
.segmented a.active,.segmented button.active{background:var(--accent);color:var(--on-accent)}

/* Filter toolbar */
.filter-toolbar{display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap;background:var(--panel);
  border:1px solid var(--border);border-radius:var(--radius);padding:14px 16px;margin-bottom:16px;box-shadow:var(--shadow)}

/* Embedded location map (OpenStreetMap) */
.map-embed{margin-top:12px}
.map-embed iframe{width:100%;height:220px;border:1px solid var(--border);border-radius:var(--radius-sm);display:block}
.map-embed a{display:inline-block;margin-top:6px}

/* Client-side table pagination (see table-paginate.js) */
.tpager{display:flex;align-items:center;gap:12px;margin-top:10px}
.tpager .page-sub{margin:0}
.tpager button[disabled]{opacity:.45;pointer-events:none}

/* Click-to-zoom image + lightbox (see image-zoom.js) */
img.zoomable{cursor:zoom-in;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--panel)}
.zoom-overlay{position:fixed;inset:0;z-index:1000;display:none;align-items:center;justify-content:center;
  padding:32px;background:rgba(15,15,30,.82);cursor:zoom-out}
.zoom-overlay.open{display:flex}
.zoom-overlay img{max-width:92vw;max-height:92vh;object-fit:contain;border-radius:8px;
  box-shadow:var(--shadow-md);background:var(--panel)}

/* ==== Customizable widget board (gridstack) — shared by the Overview dashboard and the
   terminal detail page. Wrapper carries class `wboard`; init JS lives in each template. ==== */
.board-toolbar{display:flex;align-items:center;gap:10px;margin-bottom:14px;min-height:34px;flex-wrap:wrap}
.board-hint{font-size:12.5px;color:var(--muted);margin-right:auto}
#w-edit svg{margin-right:5px;vertical-align:-2px}
.wboard:not(.editing) .board-hint,
.wboard:not(.editing) #w-reset,
.wboard:not(.editing) #w-cancel,
.wboard:not(.editing) #w-save{display:none}
.wboard.editing #w-edit{display:none}

/* The item-content is a positioning shell; GridStack's size-to-content observer keeps it tall
   enough for the panel. Keep overflow contained so a stale measurement cannot cover later rows. */
.wboard .grid-stack-item > .grid-stack-item-content{overflow:hidden;background:transparent;border:0}
.grid-stack-item-content > .panel{height:auto;margin:0;box-sizing:border-box}
.grid-stack > .panel{margin:0 0 16px}   /* no-JS / pre-init fallback: panels just stack */

/* ApexCharts telemetry charts: fixed height so the widget sizes to content and the chart is never
   clipped (the whole widget still resizes in width via gridstack). */
.apexchart{width:100%;height:220px}

/* Edit-mode affordances */
.wboard.editing .grid-stack-item-content{outline:1.5px dashed var(--accent);outline-offset:-1px;border-radius:var(--radius-sm)}
/* The section header becomes an obvious full-width "grab bar" (grip glyph + tint) so it's clear
   you drag a widget by its header — and only there, so content stays clickable. */
.wboard.editing .sec-h{cursor:grab;user-select:none;position:relative;
  margin:-6px -8px 12px;padding:8px 10px 8px 30px;border-radius:var(--radius-sm);
  background:rgba(60,50,250,.06)}
.wboard.editing .sec-h:active{cursor:grabbing}
.wboard.editing .sec-h::before{content:"⠿";position:absolute;left:10px;top:50%;
  transform:translateY(-50%);color:var(--accent);font-size:16px;line-height:1}
.wboard.editing .grid-stack-item{position:relative}
.wboard.editing .grid-stack-item:hover > .grid-stack-item-content{outline-color:var(--accent);outline-style:solid}
.wboard.editing .grid-stack-item.ui-draggable-dragging{opacity:.85;z-index:20}
.grid-stack-item > .ui-resizable-e{cursor:ew-resize}
.gs-placeholder > .placeholder-content{background:rgba(60,50,250,.1);border:1.5px dashed var(--accent);border-radius:var(--radius-sm)}

/* Per-widget remove (×), shown only in edit mode (dashboard: sends the widget to the palette) */
.w-remove{position:absolute;top:7px;right:7px;z-index:6;width:24px;height:24px;border-radius:50%;
  border:1px solid var(--border);background:var(--panel);color:var(--muted);cursor:pointer;
  display:none;align-items:center;justify-content:center;line-height:1;font-size:15px;box-shadow:var(--shadow)}
.wboard.editing .w-remove{display:flex}
.w-remove:hover{color:var(--error);border-color:var(--error)}

/* Palette of available (hidden) widgets — shown in edit mode; click a chip to add it back */
.dash-palette{border:1px dashed var(--border2);border-radius:var(--radius);padding:12px 14px;margin-bottom:14px;background:var(--panel2)}
.dash-palette .palette-label{font-size:12px;font-weight:600;color:var(--muted);margin-bottom:8px}
.palette-chips{display:flex;flex-wrap:wrap;gap:8px}
.palette-chip{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border:1px solid var(--border);
  border-radius:20px;background:var(--panel);color:var(--text);font-size:13px;cursor:pointer;font-family:inherit}
.palette-chip:hover{border-color:var(--accent);color:var(--accent)}
.palette-chip .pc-plus{font-weight:700;font-size:15px;line-height:1}
.dash-palette .palette-empty{font-size:12.5px;color:var(--muted2)}
.dash-palette:has(.palette-empty){padding-block:9px}

@media (max-width:899px){
  #w-edit{display:none}
  .wboard .grid-stack-item{transition:none}
}

/* Reveal-password toggle (progressive enhancement, see reveal-password.js) */
.pw-wrap{position:relative;display:block}
.pw-wrap > .input{padding-right:40px}
.pw-toggle{position:absolute;top:1px;right:1px;bottom:1px;width:38px;display:flex;align-items:center;
  justify-content:center;background:none;border:0;padding:0;margin:0;cursor:pointer;color:var(--muted);
  border-radius:0 var(--radius-sm) var(--radius-sm) 0}
.pw-toggle:hover{color:var(--text)}
.pw-toggle:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.pw-toggle svg{width:18px;height:18px;display:block}

/* Terminal config form + lifecycle actions */
.cfg-form{display:flex;flex-direction:column;gap:12px}
.cfg-form .label{display:block;margin-bottom:5px}
.cfg-form textarea.input{resize:vertical;font-family:inherit;line-height:1.5}
.cfg-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:12px}
.cfg-locked{background:var(--panel2);border:1px solid var(--border);border-radius:10px;padding:12px 14px}
.cfg-locked-hd{display:flex;align-items:center;gap:7px;font-size:11.5px;font-weight:600;letter-spacing:.02em;color:var(--muted);margin-bottom:10px}
.cfg-locked-hd svg{width:14px;height:14px;color:var(--muted2)}
.cfg-locked-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:10px}
.cfg-locked .litem{display:flex;flex-direction:column;gap:2px}
.cfg-locked .litem .k{font-size:11px;color:var(--muted2)}
.cfg-locked .litem .v{font-size:15px;font-weight:700;color:var(--text)}
.check{display:inline-flex;align-items:center;gap:8px;font-size:13px;color:var(--text);cursor:pointer}
.check input{width:16px;height:16px;accent-color:var(--accent)}
.lifecycle-actions{display:flex;gap:10px;flex-wrap:wrap;align-items:flex-start}
.lifecycle-actions form{margin:0}
.deact{margin:0}
.deact > summary{list-style:none;cursor:pointer;display:inline-flex}
.deact > summary::-webkit-details-marker{display:none}
.deact[open] > summary{margin-bottom:12px}
.deact-form{max-width:420px;padding:14px;border:1px solid var(--error-soft,var(--border));border-radius:8px;background:var(--bg)}
.deact-form .input{width:100%}

/* Flash */
.flash{border:1px solid;border-radius:var(--radius-sm);padding:11px 14px;font-size:13px;margin-bottom:14px}
.flash-success{background:var(--success-soft);border-color:var(--flash-ok-line);color:var(--success-ink)}
.flash-error{background:var(--error-soft);border-color:var(--flash-err-line);color:var(--error-ink)}
.flash-warning{background:var(--warn-soft);border-color:var(--flash-warn-line);color:var(--warn-ink)}
.flash-info{background:var(--info-soft);border-color:var(--flash-info-line);color:var(--info-ink)}

/* Detail rows */
.detail-row{display:flex;justify-content:space-between;gap:16px;padding:9px 0;border-bottom:1px solid var(--border);font-size:13.5px}
.detail-row:last-child{border-bottom:none}
.detail-row .dk{color:var(--muted)} .detail-row .dv{font-weight:600;text-align:right}
.split-panels{display:grid;grid-template-columns:1.2fr 1fr;gap:16px}
@media(max-width:820px){.split-panels{grid-template-columns:1fr}}

/* Charts */
.chart-svg{width:100%;display:block}   /* fill the widget — never render at the intrinsic viewBox width (mobile overflow) */
.chart-card .chart-svg{height:150px}
.chart-connection .chart-svg{height:34px}
.chart-x{display:flex;justify-content:space-between;font-size:10px;color:var(--muted2);font-family:var(--ui-mono);margin-top:2px}
.chart-legend{display:flex;gap:14px;font-size:11px;color:var(--muted);margin-top:8px}
.dot{display:inline-block;width:9px;height:9px;border-radius:2px;vertical-align:middle;margin-right:4px}

/* Ops layout: main + sibling-terminals side panel */
.ops-layout{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:16px;align-items:start}
@media(max-width:1000px){.ops-layout{grid-template-columns:1fr}}
.ops-side .panel{position:sticky;top:16px}
.trow{display:flex;align-items:center;gap:10px;padding:9px 8px;border-radius:9px;text-decoration:none;color:var(--text)}
.trow:hover{background:var(--panel2);text-decoration:none}
.trow.active{background:var(--accent-soft)}
.dot2{width:9px;height:9px;border-radius:50%;flex-shrink:0}
.dot2.on{background:var(--success);box-shadow:0 0 0 3px var(--success-soft)}
.dot2.off{background:var(--muted2)}
.trow .grow{flex:1;min-width:0}
.trow .tid{font-size:12.5px;font-weight:600}
.trow .meta{font-size:11px;color:var(--muted2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.trow .bat-mini{font-size:12px;font-weight:600;color:var(--muted);font-variant-numeric:tabular-nums;flex-shrink:0}

/* Device header */

/* Rail tooltip (nav-tooltip.js). Fixed-positioned, so `.cs-nav`'s scroll cannot clip it. */
.nav-tip{position:fixed;z-index:60;pointer-events:none;opacity:0;transform:translateX(-4px);
  transition:opacity .1s ease,transform .1s ease;
  background:var(--th-ink,#1a1a2e);color:#fff;font-size:12px;font-weight:600;line-height:1;
  padding:7px 10px;border-radius:6px;white-space:nowrap;box-shadow:0 4px 14px rgba(0,0,0,.18)}
.nav-tip.is-on{opacity:1;transform:none}

/* Fleet-health tiles: number ON TOP, caption underneath. `.stat` is a horizontal card (icon +
   text) used elsewhere, so these four tiles override the direction rather than changing it for
   everyone — side-by-side put a 28px figure and a lower-case word on the same baseline, which read
   as a sentence fragment instead of a metric. */
.stat-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:10px}
/* Top-aligned, not centred: one caption wraps to two lines ("Low battery") and centring would
   then lift that tile's figure above the others — four numbers that should read as one row. */
.stat-row .stat{flex-direction:column;align-items:center;justify-content:flex-start;gap:3px;
  padding:14px 15px;min-width:0;text-align:center}
.stat-n{font-size:26px;font-weight:700;letter-spacing:-.02em;line-height:1.1}
.stat-l{font-size:11px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;
  color:var(--muted);line-height:1.3}

/* Stat cards (hero row) */
.stat{display:flex;gap:14px;align-items:center;background:var(--panel);border:1px solid var(--border);border-radius:var(--radius);padding:15px 17px;box-shadow:var(--shadow)}
.stat .k{font-size:10.5px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:var(--muted)}
.stat .v{font-size:21px;font-weight:700;letter-spacing:-.01em;margin-top:2px;display:flex;align-items:center;gap:6px}
.stat .v.sm{font-size:15px}
.bat{height:6px;border-radius:99px;background:var(--border);margin-top:7px;width:96px;overflow:hidden}
.bat > i{display:block;height:100%;border-radius:99px}
.sig{display:inline-flex;align-items:flex-end;gap:3px;height:18px;margin-top:6px}
.sig i{width:5px;border-radius:1px;background:var(--border)}
.sig i.on{background:var(--accent)}

/* Share bars (breakdowns) */
.barrow{display:flex;align-items:center;gap:10px;padding:6px 0;font-size:13px}
.barrow .lbl{width:96px;color:var(--muted);text-transform:capitalize;flex-shrink:0}
.barrow .track{flex:1;height:8px;background:var(--border);border-radius:99px;overflow:hidden}
.barrow .track > i{display:block;height:100%;border-radius:99px}
.barrow .n{width:96px;text-align:right;color:var(--muted);flex-shrink:0}

/* Card-scheme brand marks (see _schemes.html) */
.scheme-chip{display:inline-flex;align-items:center;gap:8px;vertical-align:middle;line-height:1}
/* Every scheme sits on an identical fixed-size white acceptance card; the logo is scaled to
   FIT inside it (contain), so marks with very different aspect ratios (Visa/Discover wordmarks
   vs the Mastercard circles) all read as the same badge size instead of each taking its own width. */
.scheme-mark-wrap{display:inline-flex;align-items:center;justify-content:center;width:44px;height:28px;
  flex:0 0 44px;padding:3px 5px;background:#fff;border:1px solid var(--border);border-radius:5px;
  box-shadow:0 1px 1px rgba(16,24,40,.04)}
.scheme-mark{max-width:100%;max-height:18px;width:auto;height:auto;display:block}
/* Wide wordmarks (Visa, Discover, girocard) fit by width; cap their height a touch lower so a
   long wordmark doesn't optically outweigh the squarer symbols. */
.scheme-mark--wide{max-height:13px}
.scheme-mark--box{max-height:20px}
/* Official media-kit assets (Visa/Mastercard/Amex/Maestro/Cirrus) — fill the card a touch more than
   the inline marks; contain keeps each brand's own aspect ratio inside the fixed 44×28 card. */
.scheme-mark--official{max-height:22px;object-fit:contain}
.scheme-name{font-weight:600;color:var(--ink,inherit);white-space:nowrap}
.scheme-empty{color:var(--muted2)}
.barrow--scheme .lbl{width:180px;text-transform:none}
.barrow--scheme .lbl .scheme-name{font-weight:600;color:var(--muted)}

/* Section heading with icon */
.sec-h{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:700;margin:0 0 14px}
.sec-h svg{width:16px;height:16px;color:var(--muted)}

/* Two-column definition list */
.dl{display:grid;grid-template-columns:1fr 1fr;gap:0 30px}
@media(max-width:640px){.dl{grid-template-columns:1fr}}
.dl .drow{display:flex;justify-content:space-between;gap:12px;padding:10px 0;border-bottom:1px solid var(--border);font-size:13.5px}
.dl .drow .k{color:var(--muted)} .dl .drow .v{font-weight:600;text-align:right}

/* Device spec grid (Ops console) */

/* Color swatch (merchant theme) */
.swatch{width:34px;height:34px;border-radius:var(--radius-xs);border:1px solid var(--border)}

/* App footer (legal) */
.app-footer{padding:18px 28px 30px;color:var(--muted2);font-size:11px;text-align:center}
.app-footer a{color:var(--muted2)} .app-footer a:hover{color:var(--accent)}

/* Auth screens */
.authwrap{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;background:var(--bg)}
.auth-card{width:400px;max-width:92vw;background:var(--panel);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow-md);padding:32px}
.auth-brand{font-size:18px;font-weight:700;color:var(--accent)}
.auth-sub{font-size:13px;color:var(--muted);margin:2px 0 18px}
.auth-legal{font-size:11px;color:var(--muted2)} .auth-legal a{color:var(--muted2)}
/* IP-blocked / access-restricted page */
.blocked-icon{width:64px;height:64px;margin:18px auto 6px;display:flex;align-items:center;justify-content:center;border-radius:50%;background:var(--error-bg,#fdecec);color:var(--error,#c0392b)}
.blocked-title{font-size:20px;font-weight:700;text-align:center;margin:6px 0 10px}
.blocked-body{font-size:13px;color:var(--muted);line-height:1.5;text-align:center;margin:0 0 12px}
.blocked-ip{margin-top:16px;padding:12px 14px;background:var(--bg);border:1px solid var(--border);border-radius:8px;text-align:center}
.blocked-ip-label{display:block;font-size:10px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--muted2);margin-bottom:4px}
.blocked-ip-value{font-size:15px;font-weight:600;color:var(--ink,inherit)}
.form-grid{display:flex;gap:10px;flex-wrap:wrap;align-items:flex-end}

/* Confirmation modal (confirm-dialog.js) — replaces native window.confirm() */
.cdlg-backdrop{position:fixed;inset:0;z-index:1000;display:flex;align-items:center;justify-content:center;
  background:rgba(15,18,40,.48);padding:20px;animation:cdlg-fade .12s ease-out}
.cdlg-backdrop[hidden]{display:none}
.cdlg-panel{background:var(--panel);border:1px solid var(--border);border-radius:var(--radius);
  box-shadow:var(--shadow-md,0 20px 60px rgba(0,0,0,.25));max-width:440px;width:100%;padding:22px 22px 18px;
  animation:cdlg-pop .14s ease-out}
.cdlg-title{margin:0 0 8px;font-size:17px;font-weight:700;color:var(--text)}
.cdlg-body{margin:0 0 18px;font-size:14px;line-height:1.55;color:var(--muted);white-space:pre-wrap}
.cdlg-actions{display:flex;gap:8px;justify-content:flex-end}
@keyframes cdlg-fade{from{opacity:0}to{opacity:1}}
@keyframes cdlg-pop{from{opacity:0;transform:translateY(6px) scale(.98)}to{opacity:1;transform:none}}

/* Tabbed detail (merchant detail, and any page that groups sections into tabs) */
.tabbar{display:flex;gap:2px;border-bottom:1px solid var(--border);margin:0 0 16px;overflow-x:auto}
.tabbar .tab{appearance:none;background:transparent;border:0;border-bottom:2px solid transparent;
  font-family:inherit;font-size:13.5px;font-weight:600;color:var(--muted);padding:9px 14px;cursor:pointer;white-space:nowrap;text-decoration:none}
.tabbar .tab:hover{color:var(--text)}
.tabbar .tab[aria-selected="true"]{color:var(--accent);border-bottom-color:var(--accent)}
.tabbar .tab .badge{margin-left:6px}
.tabpane[hidden]{display:none}

/* Search typeahead / autocomplete menu (shared by the merchant + terminal + tx live search) */
.ac-menu{position:absolute;top:100%;left:0;z-index:60;min-width:280px;max-width:440px;margin-top:4px;
  background:var(--panel);border:1px solid var(--border);border-radius:9px;box-shadow:var(--shadow-md,0 10px 30px rgba(20,20,50,.16));
  max-height:340px;overflow:auto;padding:4px}
.ac-menu[hidden]{display:none}
.ac-item{display:flex;align-items:baseline;gap:8px;padding:7px 10px;border-radius:6px;cursor:pointer}
.ac-item:hover,.ac-item.on{background:var(--panel2)}
.ac-name{font-size:13.5px;font-weight:600;color:var(--text);white-space:nowrap}
.ac-sub{font-size:11.5px;color:var(--muted)}
.ac-mid{font-size:11.5px;color:var(--muted);margin-left:auto;white-space:nowrap}

/* Re-auth modal (webauthn.js getReauthGrant) — reuses the .cdlg-* chrome, adds a form */
.cdlg-panel.rauth{max-width:420px}
.cdlg-panel.rauth .rauth-body{margin-bottom:16px}
.cdlg-panel.rauth .label{margin-top:14px}
.cdlg-panel.rauth .rauth-hint{font-size:var(--text-sm);color:var(--muted);margin-top:5px}

/* Theme picker (account → Appearance) */
.theme-opt{display:flex;gap:10px;align-items:flex-start;padding:10px 12px;margin-bottom:8px;
  border:1px solid var(--border);border-radius:var(--radius-sm);cursor:pointer}
.theme-opt:hover{background:var(--accent-soft2)}
.theme-opt.on{border-color:var(--accent);background:var(--accent-soft)}
.theme-opt input{margin-top:3px;accent-color:var(--accent)}
.theme-opt strong{display:block;font-size:var(--ui-text)}
.theme-opt em{display:block;font-style:normal;font-size:var(--text-sm);color:var(--muted);margin-top:2px}

/* --- Narrow screens ------------------------------------------------------
   Shared by both themes: every class touched here (.topbar*, .cs-nav, .nav-*,
   .side-foot) has the same name in both shells — only the outer containers
   differ, and those are handled in the theme stylesheets.

   The sidebar is an off-canvas DRAWER on mobile (styled in theme-softfleet.css): the hamburger in
   the top bar slides it in over a backdrop, and the nav renders normally inside it — vertical, with
   working collapsible groups. This replaced the old horizontal-scroll strip, which forced sideways
   scrolling to reach half the menu. */
@media (max-width: 760px) {
  .topbar { padding: 0 10px; gap: 8px; height: auto; min-height: var(--topbar-h) }
  /* Without the clamp the three-word product name wraps to three lines and the header
     eats a third of a phone screen. min-width:0 is what lets the flex child shrink. */
  .topbar-left { min-width: 0 }
  .topbar-title { font-size: var(--text-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
  .topbar-sub { display: none }
  .topbar .who { display: none }        /* the avatar still identifies the session */
  .topbar-right { gap: 8px }
  .cmdk-trigger span,.cmdk-trigger kbd { display: none }
  .cmdk-trigger { width: 34px; justify-content: center; padding: 0 }
  .cmdk { padding-top: 8vh }

  .side-foot { display: none }          /* collapse-to-rail is meaningless in the drawer */

  .content { padding: 14px }
  .page-header { margin-bottom: 14px }
}

/* MCC catalogue admin (Configuration → Business categories) */
.mcc-cathead{display:flex;flex-wrap:wrap;gap:8px;align-items:end;padding-bottom:10px;
  border-bottom:1px solid var(--border);margin-bottom:8px}
.mcc-catkey{flex:0 0 150px;font-size:12px;color:var(--muted);align-self:center}
/* Direct children only: `flex-basis` resolves along the container's own axis, so a
   `flex: 1 1 150px` meant for this row becomes a 150px *height* on the number input nested
   inside the column-direction .mcc-sort label. */
.mcc-cathead > .input{min-width:0;flex:1 1 150px}
.mcc-sort{display:flex;flex-direction:column;gap:3px;flex:0 0 92px}
.mcc-sort .input{width:100%;flex:0 0 auto}
.mcc-row{display:flex;gap:8px;align-items:center;margin-bottom:6px}
.mcc-edit{display:flex;gap:8px;align-items:center;flex:1 1 auto;flex-wrap:wrap}
.mcc-edit > .input{min-width:0;flex:1 1 140px}
.mcc-code{flex:0 0 82px}
.mcc-cat{flex:0 0 170px}
.mcc-act{display:flex;gap:5px;align-items:center;font-size:12px;color:var(--muted);white-space:nowrap}
.mcc-act input{accent-color:var(--accent)}
/* Deactivating is the soft-delete here, so hard Delete is the rare action — a wall of solid
   red buttons down a 50-row catalogue reads as the primary thing to do, which it is not. */
.mcc-row .btn-danger{background:transparent;border-color:var(--border);color:var(--error)}
.mcc-row .btn-danger:hover{background:var(--error-soft);border-color:var(--error);filter:none}
.mcc-addrow{border-top:1px dashed var(--border);margin-top:10px;padding-top:10px}
.mcc-uncat{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
/* Users page: filter bar, identity cell, and the per-row action disclosure. The actions used to
   sit open in every row — five forms wide, a password box among them — so the table read as a
   form, not as a list. */
.userbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:12px}
.usertable td{vertical-align:middle}
.uid{display:flex;align-items:center;gap:10px;min-width:0}
.uid-txt{min-width:0}
.uid-name{font-weight:600;font-size:13.5px;display:flex;align-items:center;gap:6px}
.uid-sub{font-size:11.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:280px}
/* A row that needs a human: locked out, disabled, or an invitation that has expired. */
.usertable tr.row-attention td{background:var(--warn-soft,rgba(180,120,0,.05))}
/* The actions row. Full width, in flow — never absolutely positioned, because `.table-wrap`
   scrolls and would clip it. */
.uactions > td{background:var(--bg);padding:0}
.rowmenu-body{padding:14px 16px;border-left:3px solid var(--accent)}
.rowmenu-row{display:flex;gap:10px;align-items:flex-end;flex-wrap:wrap;margin-bottom:12px}
.rowmenu-f{display:flex;flex-direction:column;gap:3px;flex:0 1 240px;min-width:0}
.rowmenu-f .afl{font-size:11px;color:var(--muted)}
.rowmenu-f .input{width:100%}
/* Destructive actions sit in their own compartment — a Delete button one tab away from Save is
   how an account gets removed by muscle memory. */
.rowmenu-danger{border-top:1px solid var(--border);margin-top:2px;padding-top:12px;
  display:flex;flex-direction:column;gap:12px;align-items:flex-start}
.js-manage.is-on{background:var(--accent);color:var(--on-accent);border-color:var(--accent)}

/* Country catalogue (Configuration → Countries). One row per country, laid out on a grid so the
   label columns line up down the list — a flex row would let each country size its own inputs and
   the page would read as a stack of unrelated forms. */
.ctry-row{border-bottom:1px solid var(--border);padding:8px 0}
.ctry-row:last-child{border-bottom:0}
.ctry-row.is-off{opacity:.55}          /* deactivated = the soft-delete, still visible and fixable */
.ctry-grid{display:grid;gap:8px 12px;align-items:end;
  grid-template-columns:96px repeat(2, minmax(120px, 1fr)) minmax(150px, 1.4fr) 88px auto}
.ctry-grid .cf{display:flex;flex-direction:column;gap:3px;min-width:0}
.ctry-grid .afl{font-size:11px;color:var(--muted)}
.ctry-grid .input{width:100%}
.ctry-code{display:inline-flex;align-items:center;gap:6px;height:32px;font-size:13px}
.ctry-grid .act{flex-direction:row;align-items:center;gap:10px;white-space:nowrap}
.ctry-grid .check{display:flex;align-items:center;gap:5px;font-size:12px;color:var(--muted)}
.ctry-grid .check input{accent-color:var(--accent)}
@media(max-width:860px){.ctry-grid{grid-template-columns:1fr 1fr}}

/* Grouped MCC pickers (campaign + merchant master data) */
.mcc-select{max-width:420px}
/* `select.input` strips the native appearance and paints its own chevron — correct for a
   single select, wrong for a multi-select, where it hides the list and leaves a dead arrow. */
/* `select.mcc-multi`, not `.mcc-multi`: the rule it overrides is `select.input`, which
   is more specific than a bare class and would otherwise keep winning. */
select.mcc-multi{appearance:auto;background-image:none;height:auto;padding:6px;font-size:13px}
.mcc-multi optgroup{font-weight:700;color:var(--muted)}
.mcc-multi option{padding:3px 6px}

/* Sidebar section order editor (account → Navigation) */
.navord{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.navord-row{display:flex;align-items:center;gap:9px;padding:8px 10px;background:var(--panel);
  border:1px solid var(--border);border-radius:var(--radius-sm);cursor:grab}
.navord-row.is-dragging{opacity:.45;cursor:grabbing}
.navord-grip{width:15px;height:15px;flex:0 0 15px;color:var(--muted2)}
.navord-name{font-size:var(--ui-text);font-weight:600}
.navord-count{font-size:var(--text-xs);font-weight:600;color:var(--muted);
  background:var(--panel2);border-radius:var(--radius-full);padding:1px 8px}
.navord-btns{margin-left:auto;display:flex;gap:4px}
.navord-btns .btn{line-height:1;padding:3px 8px}
.navord-btns .btn:disabled{opacity:.35;cursor:not-allowed}

/* MCC catalogue: sub-categories nest one level under their parent */
.mcc-sub{border-left:2px solid var(--border);margin:10px 0 10px 6px;padding-left:12px}
.mcc-cathead.is-sub{border-bottom-style:dashed;padding-bottom:8px;margin-bottom:6px}
.mcc-cathead.is-sub .mcc-catkey{font-size:11.5px}
.mcc-addsub{border-top:1px dashed var(--border);border-bottom:0;margin:10px 0 0;padding:10px 0 0}
.mcc-addsub .mcc-catkey{color:var(--muted);text-transform:uppercase;font-size:10.5px;letter-spacing:.05em}
.mcc-empty{margin:8px 0 0}

/* Language switcher for translation-editor pages (MCC, countries): edit one language at a time. */
.lang-switch{display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin:0 0 14px}
.lang-switch-label{font-size:12.5px;color:var(--muted);margin-right:2px}
