/* nodedough — ops surfaces: 404, /support, /admin.
   Rewritten 2026-08-07. Layout and interaction grammar modelled on the Resend
   dashboard; palette stays nodedough's.

   What was taken from Resend, and why each one matters at thousands of rows:

     · A ~200px sidebar with a workspace switcher at the top and the signed-in
       identity pinned to the bottom. Destinations are plain text with a small
       monochrome icon; the active one is a soft filled block, not a coloured
       one. It scales by scrolling instead of wrapping.
     · The page title lives in the content, large and unadorned. The top bar
       carries only utilities. Nothing competes with the data.
     · Filters are a search field plus dropdowns on one line. Fewer controls,
       always in the same place.
     · Tables have no outer card and no vertical rules — one hairline between
       rows. Rows are tall (56px) and every row opens with a small rounded icon
       tile, which gives the eye a fixed left rail to track along.
     · Status is a small tinted pill: a low-luminance wash of the hue with the
       saturated hue as the text. Reads at a glance, never shouts.
     · Flat. No shadows except on things that genuinely float.

   Two themes off one set of variables. `sage` is nodedough's own light paper
   palette and is the default. `night` is the near-black Resend feel, with the
   neutrals tinted green so it is still recognisably this product rather than
   a generic dark admin. Toggle by setting data-theme on <html>. */

/* ---------------------------------------------------------------- sage */
:root,
[data-theme="sage"] {
  /* nodedough brand tokens, carried verbatim from styles.css */
  --ink: #24302c;
  --slate: #5f6f68;
  --mute: #87948d;
  --paper: #eef3f0;
  --paper-deep: #e2ebe6;
  --surface: #fbfcfb;
  --gain: #2a6b58;
  --owe: #9a4058;
  --save: #3a628f;
  --dough: #c9952a;
  --accent: #3d6b5e;
  --focus: #2f6a57;
  --sans: "Avenir Next", "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;

  /* semantic ramp — everything below this line is expressed in these */
  --bg: #f4f7f5;
  --bg-nav: #fbfcfb;
  --bg-raise: #ffffff;
  --bg-hover: #eef3f0;
  --bg-active: #e6ece9;
  --border: #dde5e1;
  --border-soft: #e9efec;
  --text: #1c2723;
  --text-2: #5f6f68;
  --text-3: #8b9791;

  --pill-ok-bg: #dcece4;      --pill-ok-fg: #1f6149;
  --pill-info-bg: #e0e9f5;    --pill-info-fg: #2f5580;
  --pill-warn-bg: #f6eed6;    --pill-warn-fg: #7a5a10;
  --pill-bad-bg: #f6e2e8;     --pill-bad-fg: #8d3850;
  --pill-neutral-bg: #e8eeeb; --pill-neutral-fg: #5f6f68;

  --btn-fg: #fbfcfb;
  --shadow-float: 0 8px 30px rgba(28, 39, 35, .13), 0 2px 8px rgba(28, 39, 35, .07);
  --scrim: rgba(28, 39, 35, .32);
}

/* --------------------------------------------------------------- night */
[data-theme="night"] {
  --ink: #e8ede9;
  --slate: #9aa8a1;
  --mute: #6f7d76;
  --paper: #0b0e0d;
  --paper-deep: #000;
  --surface: #101413;
  --gain: #4ec08f;
  --owe: #e08098;
  --save: #7fa9de;
  --dough: #e0b551;
  --accent: #5fbfa0;
  --focus: #5fbfa0;

  --bg: #0a0d0c;
  --bg-nav: #0d100f;
  --bg-raise: #101413;
  --bg-hover: #161b19;
  --bg-active: #1b2220;
  --border: #1e2523;
  --border-soft: #171d1b;
  --text: #edf2ef;
  --text-2: #9aa8a1;
  --text-3: #6b7873;

  --pill-ok-bg: #0e3527;      --pill-ok-fg: #56cd9a;
  --pill-info-bg: #142a41;    --pill-info-fg: #86b4e6;
  --pill-warn-bg: #3a2e0e;    --pill-warn-fg: #dcb75d;
  --pill-bad-bg: #3b1722;     --pill-bad-fg: #e88ba3;
  --pill-neutral-bg: #1a201e; --pill-neutral-fg: #97a49d;

  --btn-fg: #08100d;
  --shadow-float: 0 8px 30px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4);
  --scrim: rgba(0, 0, 0, .62);
}

* { box-sizing: border-box; }

/* ================================================================
   1. Shared ops chrome — 404 and /support keep these class names.
   ================================================================ */

.ops-page {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 64px 16px;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

.ops-card {
  background: var(--bg-raise);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 30px;
  max-width: 440px;
  width: 100%;
}
.ops-card-wide { max-width: 620px; }
.ops-card h1 { font-size: 1.4rem; margin: 12px 0 6px; letter-spacing: -.025em; font-weight: 600; }
.ops-card p { color: var(--text-2); }
.ops-card a { color: var(--accent); }
.ops-muted { color: var(--text-3); font-weight: 400; font-size: .87em; }

/* Buttons. Resend's primary is a solid high-contrast block with a small
   radius; secondary is a hairline outline on transparent. */
.ops-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--text);
  color: var(--btn-fg);
  border: 1px solid var(--text);
  border-radius: 7px;
  padding: 7px 13px;
  font: inherit;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .12s ease, background .12s ease, border-color .12s ease;
}
.ops-btn:hover { opacity: .85; }
.ops-btn:disabled { opacity: .38; cursor: default; }
.ops-btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.ops-btn-ghost:hover { background: var(--bg-hover); border-color: var(--text-3); opacity: 1; }
.ops-btn-warn { background: var(--dough); border-color: var(--dough); color: var(--btn-fg); }
.ops-btn-danger { background: var(--owe); border-color: var(--owe); color: #fff; }
[data-theme="night"] .ops-btn-danger { color: #2a0e16; }
.ops-btn-sm { padding: 4px 10px; font-size: .8rem; border-radius: 6px; }

.ops-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.ops-status { min-height: 1.4em; color: var(--gain); }
.ops-error { color: var(--owe); }

form label { display: block; margin: 14px 0 4px; font-weight: 500; font-size: .875rem; }
form input[type="text"], form input[type="email"], form textarea, form select {
  width: 100%;
  background: var(--bg-raise);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  font: inherit;
  font-size: .9rem;
}
form textarea { resize: vertical; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* ================================================================
   2. Admin shell
   ================================================================ */

body.ops-admin-body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.ops-shell {
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
  min-height: 100vh;
}

/* ---- sidebar ---- */
.ops-nav {
  background: var(--bg-nav);
  border-right: 1px solid var(--border);
  padding: 10px 8px 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
}

/* Workspace switcher — mark, name, environment badge, chevron. */
.ops-ws {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  margin-bottom: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.ops-ws:hover { background: var(--bg-hover); }
.ops-ws-mark {
  width: 22px; height: 22px; flex: 0 0 22px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--btn-fg);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; letter-spacing: -.04em;
}
.ops-ws-name { font-size: .875rem; font-weight: 600; letter-spacing: -.01em; }
.ops-ws-badge {
  font-size: .65rem; font-weight: 600; letter-spacing: .02em;
  padding: 1px 6px; border-radius: 5px;
  background: var(--pill-neutral-bg); color: var(--pill-neutral-fg);
}
.ops-ws-chev { margin-left: auto; color: var(--text-3); width: 13px; height: 13px; }

.ops-nav-group {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--text-3);
  padding: 14px 9px 5px;
}

.ops-nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 6px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: .875rem;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  position: relative;
}
.ops-nav-item:hover { background: var(--bg-hover); color: var(--text); }
.ops-nav-item.active { background: var(--bg-active); color: var(--text); font-weight: 500; }
.ops-nav-item svg { width: 15px; height: 15px; flex: 0 0 15px; opacity: .75; }
.ops-nav-item.active svg { opacity: 1; }

.ops-nav-count {
  margin-left: auto;
  font-size: .7rem;
  font-weight: 600;
  padding: 0 6px;
  border-radius: 5px;
  background: var(--pill-neutral-bg);
  color: var(--pill-neutral-fg);
}
.ops-nav-count.attn { background: var(--pill-bad-bg); color: var(--pill-bad-fg); }
.ops-nav-count.warn { background: var(--pill-warn-bg); color: var(--pill-warn-fg); }

.ops-nav-foot {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
}
.ops-nav-me {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 8px; border: 0; border-radius: 8px; background: transparent;
  color: var(--text-2); font: inherit; font-size: .82rem; cursor: pointer; text-align: left;
}
.ops-nav-me:hover { background: var(--bg-hover); }
.ops-nav-avatar {
  width: 21px; height: 21px; flex: 0 0 21px; border-radius: 50%;
  background: var(--pill-neutral-bg); color: var(--text-2);
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
}
.ops-nav-me span.who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ops-nav-me .dots { margin-left: auto; color: var(--text-3); }

/* ---- main ---- */
.ops-main { min-width: 0; display: flex; flex-direction: column; }

/* Top bar carries utilities only — never the page title. */
.ops-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 14px 26px;
  min-height: 52px;
}
.ops-head a, .ops-head .linkish {
  color: var(--text-2); text-decoration: none; font-size: .86rem;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.ops-head a:hover, .ops-head .linkish:hover { color: var(--text); }

.ops-body { padding: 8px 26px 72px; flex: 1; min-width: 0; }
.ops-body-inner { max-width: 1440px; }

.ops-title {
  margin: 0 0 22px;
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -.032em;
  color: var(--text);
}
.ops-title small {
  display: block; margin-top: 5px;
  font-size: .87rem; font-weight: 400; letter-spacing: 0; color: var(--text-3);
}

.ops-panel { display: none; }
.ops-panel.active { display: block; }

h2.ops-h {
  font-size: .95rem; font-weight: 600; letter-spacing: -.01em;
  margin: 28px 0 10px; color: var(--text);
}
h2.ops-h:first-child { margin-top: 0; }

/* ================================================================
   3. Toolbar — search + dropdowns on one line, as Resend does it
   ================================================================ */

.ops-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; }

.ops-search { position: relative; flex: 1 1 320px; min-width: 200px; max-width: 470px; }
.ops-search input {
  width: 100%;
  padding: 8px 30px 8px 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-raise);
  color: var(--text);
  font: inherit;
  font-size: .875rem;
}
.ops-search input::placeholder { color: var(--text-3); }
.ops-search input:focus { border-color: var(--text-3); outline: none; }
.ops-search-ico {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--text-3); pointer-events: none;
  display: block; line-height: 0;
}
.ops-search-ico svg { width: 14px; height: 14px; display: block; }
.ops-search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--text-3);
  cursor: pointer; font-size: 1rem; line-height: 1; padding: 3px 5px; border-radius: 5px;
}
.ops-search-clear:hover { background: var(--bg-hover); color: var(--text); }

/* Select styled as a Resend dropdown: hairline, chevron, no native arrow. */
.ops-select {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-raise);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 28px 8px 11px;
  font: inherit;
  font-size: .875rem;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) calc(50% + 1px), calc(100% - 11px) calc(50% + 1px);
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.ops-select:hover { border-color: var(--text-3); }
.ops-spacer { margin-left: auto; }

/* Sub-navigation inside a section (Campaigns / Pages, Audit / 404s). Underline
   tabs, same grammar as the drawer, so a second level of nav never looks like
   a second sidebar. */
.ops-subtabs {
  display: flex; gap: 2px; margin: -6px 0 16px;
  border-bottom: 1px solid var(--border);
}
.ops-subtab {
  border: 0; background: transparent; color: var(--text-2);
  padding: 8px 11px; font: inherit; font-size: .88rem; cursor: pointer;
  border-bottom: 1.5px solid transparent; margin-bottom: -1px;
}
.ops-subtab:hover { color: var(--text); }
.ops-subtab.active { color: var(--text); border-bottom-color: var(--text); font-weight: 500; }
.ops-subtab b {
  font-weight: 600; font-size: .74rem; margin-left: 6px;
  background: var(--pill-neutral-bg); color: var(--pill-neutral-fg);
  border-radius: 5px; padding: 0 5px;
}

/* Wrapping text cell — used for ticket bodies and 404 paths, where truncating
   to one line loses the thing you opened the row to read. */
.ops-table td.wrap { white-space: normal; max-width: 460px; line-height: 1.4; }
code.ops-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .82em; background: var(--bg-hover); border-radius: 5px; padding: 1px 5px;
  word-break: break-all;
}

/* ================================================================
   4. Table — no outer card, no column rules, one hairline per row
   ================================================================ */

.ops-tablewrap { border-top: 1px solid var(--border); }
.ops-tablescroll { overflow-x: auto; }
.ops-table { width: 100%; border-collapse: collapse; font-size: .875rem; }

.ops-table thead th {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  color: var(--text-3);
  font-weight: 500;
  font-size: .8rem;
  text-align: left;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
.ops-table thead th.sortable { cursor: pointer; }
.ops-table thead th.sortable:hover { color: var(--text); }
.ops-table thead th .arrow { opacity: 0; margin-left: 4px; font-size: .62rem; }
.ops-table thead th.sorted { color: var(--text); }
.ops-table thead th.sorted .arrow { opacity: 1; }

.ops-table tbody td {
  padding: 0 14px;
  height: 56px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
  color: var(--text);
}
.ops-table tbody tr.ops-row-click { cursor: pointer; }
.ops-table tbody tr.ops-row-click:hover td { background: var(--bg-hover); }
.ops-table tbody tr.selected td { background: var(--bg-active); }
.ops-table tbody tr.cursor td:first-child { box-shadow: inset 2px 0 0 var(--accent); }

.ops-table td.dim { color: var(--text-3); }
.ops-table td.num { text-align: right; }
.ops-table .ops-primary { font-weight: 450; color: var(--text); }
.ops-table .ops-sub { color: var(--text-3); font-size: .8rem; margin-top: 1px; }

/* The rounded icon tile that opens every Resend row. It is not decoration —
   it gives the eye a fixed rail to scan down, and a slot to carry state. */
.ops-tile {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-raise);
  display: grid; place-items: center;
  color: var(--text-3);
}
.ops-tile svg { width: 14px; height: 14px; }
.ops-tile.ok { border-color: transparent; background: var(--pill-ok-bg); color: var(--pill-ok-fg); }
.ops-tile.bad { border-color: transparent; background: var(--pill-bad-bg); color: var(--pill-bad-fg); }
.ops-tile.warn { border-color: transparent; background: var(--pill-warn-bg); color: var(--pill-warn-fg); }
.ops-cell-lead { display: flex; align-items: center; gap: 11px; min-width: 0; }
.ops-cell-lead > div { min-width: 0; overflow: hidden; }
.ops-cell-lead .ops-primary,
.ops-cell-lead .ops-sub { overflow: hidden; text-overflow: ellipsis; }

.ops-check-cell { width: 36px; padding-right: 0 !important; }
.ops-check-cell input { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }

/* Per-row overflow menu, revealed on hover like Resend's ··· */
.ops-rowmenu {
  border: 0; background: transparent; color: var(--text-3);
  cursor: pointer; padding: 4px 7px; border-radius: 6px; font-size: 1rem; line-height: 1;
  opacity: 0;
}
tr:hover .ops-rowmenu, .ops-rowmenu:focus-visible { opacity: 1; }
.ops-rowmenu:hover { background: var(--bg-active); color: var(--text); }

.ops-shell.compact .ops-table tbody td { height: 40px; }
.ops-shell.compact .ops-tile { width: 24px; height: 24px; flex-basis: 24px; border-radius: 6px; }
.ops-shell.compact .ops-sub { display: none; }

/* ================================================================
   5. Status pills — low-luminance wash, saturated text, 6px radius
   ================================================================ */

.ops-pill {
  display: inline-block;
  border-radius: 6px;
  padding: 3px 9px;
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  background: var(--pill-neutral-bg);
  color: var(--pill-neutral-fg);
}
.ops-pill.paid, .ops-pill.active, .ops-pill.solved, .ops-pill.closed, .ops-pill.sent, .ops-pill.ok {
  background: var(--pill-ok-bg); color: var(--pill-ok-fg);
}
.ops-pill.trialing, .ops-pill.pending, .ops-pill.info {
  background: var(--pill-info-bg); color: var(--pill-info-fg);
}
.ops-pill.open, .ops-pill.draft, .ops-pill.queued, .ops-pill.warn, .ops-pill.past_due {
  background: var(--pill-warn-bg); color: var(--pill-warn-fg);
}
.ops-pill.blocked, .ops-pill.cancelled, .ops-pill.canceled, .ops-pill.danger, .ops-pill.deleted {
  background: var(--pill-bad-bg); color: var(--pill-bad-fg);
}
.ops-pill.admin { background: var(--pill-info-bg); color: var(--pill-info-fg); }

/* ================================================================
   6. Pagination
   ================================================================ */

.ops-pager {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 0;
  font-size: .84rem; color: var(--text-3); flex-wrap: wrap;
}
.ops-pager .ops-range b { color: var(--text); font-weight: 500; }
.ops-pager-controls { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.ops-page-btn {
  border: 1px solid var(--border); background: var(--bg-raise); color: var(--text);
  border-radius: 7px; padding: 4px 9px; font: inherit; font-size: .84rem;
  cursor: pointer; min-width: 30px;
}
.ops-page-btn:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--text-3); }
.ops-page-btn:disabled { opacity: .35; cursor: default; }
.ops-page-btn.current { background: var(--text); border-color: var(--text); color: var(--btn-fg); font-weight: 500; }
.ops-page-gap { color: var(--text-3); padding: 0 1px; }

/* ================================================================
   7. Bulk action bar
   ================================================================ */

.ops-bulkbar {
  position: sticky; bottom: 20px; z-index: 30;
  margin: 18px auto 0; width: fit-content; max-width: 100%;
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px 8px 15px;
  border-radius: 10px;
  background: var(--bg-raise);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-float);
  font-size: .85rem; color: var(--text);
  animation: ops-rise .16s ease-out;
}
@keyframes ops-rise { from { transform: translateY(6px); opacity: 0; } }
.ops-bulkbar b { font-weight: 600; }
.ops-bulkbar .ops-btn { padding: 5px 11px; font-size: .82rem; }
.ops-bulkbar-x {
  border: 0; background: transparent; color: var(--text-3);
  cursor: pointer; font-size: 1.05rem; line-height: 1; padding: 3px 6px; border-radius: 6px;
}
.ops-bulkbar-x:hover { background: var(--bg-hover); color: var(--text); }

/* ================================================================
   8. Detail drawer
   ================================================================ */

.ops-scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); animation: ops-fade .14s ease-out; }
@keyframes ops-fade { from { opacity: 0; } }

.ops-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(560px, 100%);
  background: var(--bg-nav);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  animation: ops-slide .18s cubic-bezier(.2, .8, .3, 1);
}
@keyframes ops-slide { from { transform: translateX(22px); opacity: .5; } }

.ops-drawer-head { padding: 18px 20px 14px; display: flex; align-items: flex-start; gap: 12px; }
.ops-drawer-head h2 { margin: 0 0 3px; font-size: 1.15rem; font-weight: 600; letter-spacing: -.025em; }
.ops-drawer-head .ops-muted { margin: 0; font-size: .84rem; }
.ops-drawer-x {
  margin-left: auto; border: 0; background: transparent; color: var(--text-3);
  font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 3px 7px; border-radius: 6px;
}
.ops-drawer-x:hover { background: var(--bg-hover); color: var(--text); }

.ops-drawer-tabs { display: flex; gap: 2px; padding: 0 20px; border-bottom: 1px solid var(--border); }
.ops-drawer-tab {
  border: 0; background: transparent; color: var(--text-2);
  padding: 9px 10px; font: inherit; font-size: .86rem; cursor: pointer;
  border-bottom: 1.5px solid transparent; margin-bottom: -1px;
}
.ops-drawer-tab:hover { color: var(--text); }
.ops-drawer-tab.active { color: var(--text); border-bottom-color: var(--text); font-weight: 500; }
.ops-drawer-body { padding: 18px 20px 48px; overflow-y: auto; flex: 1; }

.ops-kv { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 0; font-size: .87rem; }
.ops-kv dt { color: var(--text-3); padding: 8px 0; border-bottom: 1px solid var(--border-soft); }
.ops-kv dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--border-soft); word-break: break-word; }

.ops-panel-inset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 15px 16px;
  margin: 16px 0;
  background: var(--bg-raise);
}
.ops-panel-inset .ops-h { margin-top: 0; }
.ops-panel-inset.danger { border-color: var(--pill-bad-bg); }
.ops-panel-inset.danger .ops-h { color: var(--owe); }

.ops-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.ops-field { display: flex; flex-direction: column; gap: 5px; min-width: 150px; flex: 1; }
.ops-label { font-size: .76rem; font-weight: 500; color: var(--text-3); }
.ops-input {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: .875rem;
}
.ops-input:focus { border-color: var(--text-3); outline: none; }
.ops-form-grid { display: grid; gap: 10px; margin-bottom: 14px; }
.ops-check { display: inline-flex !important; align-items: center; gap: 8px; font-weight: 400; }
.ops-check input { width: auto; accent-color: var(--accent); }

.ops-event { padding: 9px 0; border-bottom: 1px solid var(--border-soft); font-size: .85rem; }
.ops-event time { color: var(--text-3); font-size: .78rem; display: block; margin-bottom: 2px; }

/* ================================================================
   9. Command palette
   ================================================================ */

.ops-cmdk-scrim {
  position: fixed; inset: 0; z-index: 60; background: var(--scrim);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 13vh 16px 16px; animation: ops-fade .12s ease-out;
}
.ops-cmdk {
  width: min(560px, 100%); background: var(--bg-nav);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-float); overflow: hidden;
}
.ops-cmdk input {
  width: 100%; border: 0; border-bottom: 1px solid var(--border);
  padding: 14px 17px; font: inherit; font-size: .95rem;
  background: transparent; color: var(--text);
}
.ops-cmdk input::placeholder { color: var(--text-3); }
.ops-cmdk input:focus { outline: none; }
.ops-cmdk-list { max-height: 340px; overflow-y: auto; padding: 5px; }
.ops-cmdk-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 11px; border: 0; border-radius: 7px; background: transparent;
  font: inherit; font-size: .88rem; text-align: left; cursor: pointer; color: var(--text);
}
.ops-cmdk-item:hover, .ops-cmdk-item.active { background: var(--bg-active); }
.ops-cmdk-item .ops-muted { margin-left: auto; }
.ops-cmdk-group {
  font-size: .68rem; font-weight: 600; letter-spacing: .04em;
  color: var(--text-3); padding: 9px 11px 4px;
}
kbd {
  font: inherit; font-size: .7rem;
  border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 5px; background: var(--bg); color: var(--text-3);
}
.ops-kbd-hint {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); background: var(--bg-raise);
  border-radius: 8px; padding: 5px 9px; color: var(--text-3);
  font: inherit; font-size: .83rem; cursor: pointer;
}
.ops-kbd-hint:hover { border-color: var(--text-3); color: var(--text-2); }

/* ================================================================
   10. Metrics, states, toasts
   ================================================================ */

/* Fixed four across rather than auto-fit: eight tiles then fill two whole rows
   instead of leaving a ragged empty cell at the end of the first. */
.ops-health {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px; margin: 0 0 22px;
  background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.ops-health-item {
  background: var(--bg-raise); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 3px;
  text-align: left; font: inherit; border: 0; cursor: default; color: var(--text);
}
button.ops-health-item { cursor: pointer; }
button.ops-health-item:hover { background: var(--bg-hover); }
.ops-health-item strong { font-size: 1.5rem; font-weight: 600; letter-spacing: -.035em; line-height: 1.15; }
.ops-health-item span { color: var(--text-3); font-size: .8rem; }
.ops-health-item.attn strong { color: var(--owe); }
.ops-health-item.good strong { color: var(--gain); }

.ops-skel {
  background: linear-gradient(90deg, var(--border-soft) 25%, var(--bg-hover) 37%, var(--border-soft) 63%);
  background-size: 400% 100%; animation: ops-shimmer 1.2s ease-in-out infinite;
  border-radius: 5px; height: 9px;
}
@keyframes ops-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) {
  .ops-skel, .ops-drawer, .ops-bulkbar, .ops-scrim, .ops-cmdk-scrim { animation: none; }
}

.ops-empty { padding: 64px 24px; text-align: center; color: var(--text-3); }
.ops-empty strong { display: block; color: var(--text); font-size: 1rem; margin-bottom: 6px; font-weight: 500; }
.ops-empty p { margin: 0 0 16px; font-size: .88rem; }

.ops-banner {
  display: flex; align-items: center; gap: 10px;
  border-radius: 9px; padding: 10px 14px; margin: 0 0 16px;
  font-size: .86rem; border: 1px solid var(--border); background: var(--bg-raise);
}
.ops-banner.warn { background: var(--pill-warn-bg); color: var(--pill-warn-fg); border-color: transparent; }
.ops-banner.danger { background: var(--pill-bad-bg); color: var(--pill-bad-fg); border-color: transparent; }
.ops-banner.info { background: var(--pill-info-bg); color: var(--pill-info-fg); border-color: transparent; }
.ops-banner .ops-btn { margin-left: auto; }
.ops-banner.warn .ops-btn-ghost,
.ops-banner.danger .ops-btn-ghost,
.ops-banner.info .ops-btn-ghost { border-color: currentColor; color: currentColor; }

.ops-toasts { position: fixed; right: 20px; bottom: 20px; z-index: 70; display: flex; flex-direction: column; gap: 8px; }
.ops-toast {
  background: var(--bg-raise); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 10px 14px; font-size: .86rem;
  box-shadow: var(--shadow-float); max-width: 340px;
  animation: ops-rise .16s ease-out;
}
.ops-toast.err { background: var(--pill-bad-bg); color: var(--pill-bad-fg); border-color: transparent; }

.ops-spark { display: block; width: 100%; height: 44px; }
.ops-spark path.line { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.ops-spark path.area { fill: var(--accent); opacity: .12; stroke: none; }

/* ================================================================
   11. Responsive
   ================================================================ */

/* Three date columns will not fit a laptop. Joined is the first to go: when the
   list is sorted newest-first its value is already implied by row order, and
   the exact date is one click away in the drawer. */
@media (max-width: 1560px) { .ops-hide-md { display: none !important; } }

@media (max-width: 1000px) {
  .ops-shell { grid-template-columns: 60px minmax(0, 1fr); }
  .ops-ws-name, .ops-ws-badge, .ops-ws-chev,
  .ops-nav-item span.label, .ops-nav-group,
  .ops-nav-me span.who, .ops-nav-me .dots { display: none; }
  .ops-nav-item { justify-content: center; padding: 8px; }
  .ops-nav-count { position: absolute; margin: 0; transform: translate(13px, -11px); font-size: .6rem; padding: 0 4px; }
  .ops-ws, .ops-nav-me { justify-content: center; }
}

@media (max-width: 720px) {
  .ops-shell { grid-template-columns: 1fr; }
  .ops-nav {
    position: static; height: auto; flex-direction: row; align-items: center;
    overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 7px 8px;
  }
  .ops-nav-foot, .ops-ws { display: none; }
  .ops-body { padding: 6px 14px 56px; }
  .ops-head { padding: 11px 14px; }
  .ops-title { font-size: 1.35rem; }
  .ops-health { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-drawer { width: 100%; }
  .ops-hide-sm { display: none !important; }
  .ops-table tbody td { height: 50px; }
}

@media print {
  .ops-nav, .ops-head, .ops-toolbar, .ops-pager, .ops-bulkbar { display: none !important; }
}
