/*
 * Tenant console theme — the same dark palette dashboard.html defines, lifted
 * into a file so devices.html and database.html cannot drift from it.
 *
 * NO @import AND NO WEBFONT. database.html displays a live credential at
 * rotation time, and a page holding one should not also be making third-party
 * requests; since these two pages share a stylesheet, neither loads one. The
 * font stack falls through to Inter when the browser already has it and to the
 * system UI font otherwise.
 *
 * Tables rather than cards for anything list-shaped, following the operator
 * console's preference — a device inventory is a table.
 */

:root {
  --bg-canvas: #090d16;
  --bg-surface: #111827;
  --bg-card: #1f293d;
  --bg-card-hover: #28354f;
  --border-subtle: #1e293b;
  --border-default: #334155;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background-color: var(--bg-canvas);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky; top: 0; z-index: 100;
  padding: 0.85rem 2rem;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.brand-logo { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: var(--text-main); }
.brand-icon { width: 36px; height: 36px; flex: none; filter: drop-shadow(0 0 10px var(--primary-glow)); }
.brand-icon .mark-tile { fill: rgba(99, 102, 241, 0.12); stroke: rgba(99, 102, 241, 0.45); stroke-width: 1.5; }
.brand-icon .mark-loop { fill: none; stroke: url(#pf-mark-grad); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.brand-name {
  font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em;
  background: linear-gradient(90deg, #ffffff, #cbd5e1);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.nav-links { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; }
.nav-btn {
  background: transparent; border: 1px solid transparent; color: var(--text-muted);
  padding: 0.45rem 0.9rem; border-radius: 6px; font-size: 0.88rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s ease; text-decoration: none;
  display: inline-block; font-family: var(--font-sans);
}
.nav-btn:hover { color: var(--text-main); background: var(--bg-card); }
.nav-btn.current { color: var(--text-main); background: var(--bg-card); border-color: var(--border-default); }

main { flex: 1; max-width: 1040px; width: 100%; margin: 0 auto; padding: 2rem 1.5rem; }

.crumb { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 0.75rem; }
.crumb a { color: var(--text-muted); text-decoration: none; }
.crumb a:hover { color: var(--text-main); text-decoration: underline; }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.page-head h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.25rem; }
.page-head .subtle { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-muted); }
.head-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.btn {
  background: var(--primary); color: #fff; border: none;
  padding: 0.55rem 1.1rem; border-radius: 6px; font-weight: 600; font-size: 0.88rem;
  cursor: pointer; transition: background 0.2s ease; font-family: var(--font-sans);
}
.btn:hover { background: var(--primary-hover); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.secondary { background: transparent; border: 1px solid var(--border-default); color: var(--text-main); }
.btn.secondary:hover { background: var(--bg-card-hover); }
.btn.danger { background: var(--accent-red); }
.btn.danger:hover { background: #dc2626; }
.btn.small { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
a.btn { text-decoration: none; display: inline-block; }

.panel {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem;
}
.panel-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.25rem; gap: 1rem; flex-wrap: wrap;
}
.panel-title { font-size: 1.15rem; font-weight: 700; }
.panel-note { font-size: 0.85rem; color: var(--text-muted); margin-top: -0.5rem; margin-bottom: 1rem; }

.banner {
  display: flex; flex-direction: column; gap: 0.2rem;
  border-radius: 10px; padding: 0.9rem 1.1rem; margin-bottom: 1rem;
  border: 1px solid; font-size: 0.9rem;
  overflow-wrap: anywhere; /* API error strings arrive verbatim */
}
.banner strong { font-size: 0.95rem; }
.banner a { color: inherit; font-weight: 600; }
.banner code {
  font-family: var(--font-mono); font-size: 0.82em;
  background: rgba(0,0,0,0.3); padding: 0.05rem 0.3rem; border-radius: 4px;
}
.banner .banner-note { display: block; margin-top: 0.4rem; opacity: 0.85; font-size: 0.85rem; }
.banner.red { color: #fecaca; background: rgba(239, 68, 68, 0.1); border-color: rgba(239,68,68,0.4); }
.banner.amber { color: #fde68a; background: rgba(245, 158, 11, 0.1); border-color: rgba(245,158,11,0.4); }
.banner.green { color: #a7f3d0; background: rgba(16, 185, 129, 0.1); border-color: rgba(16,185,129,0.4); }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th {
  text-align: left; font-size: 0.75rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border-default); white-space: nowrap;
}
tbody td { padding: 0.7rem 0.75rem; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
td.mono, .mono { font-family: var(--font-mono); }
td.right, th.right { text-align: right; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn { margin-left: 0.35rem; }
.table-scroll { overflow-x: auto; }
.dim { color: var(--text-dim); }
.empty { text-align: center; color: var(--text-muted); padding: 2.5rem 1rem; }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1.1rem; }
.kv .kv-label {
  font-size: 0.75rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.2rem;
}
.kv .kv-value { font-size: 1rem; font-weight: 600; font-family: var(--font-mono); word-break: break-all; }

.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.15rem 0.55rem; border-radius: 9999px;
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.green { color: #6ee7b7; background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16,185,129,0.3); }
.badge.amber { color: #fcd34d; background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245,158,11,0.3); }
.badge.red   { color: #fca5a5; background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239,68,68,0.3); }
.badge.grey  { color: var(--text-muted); background: var(--bg-card); border: 1px solid var(--border-default); }

label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.3rem; font-weight: 600; }
input[type="text"], input[type="search"], select {
  width: 100%; background: var(--bg-canvas); color: var(--text-main);
  border: 1px solid var(--border-default); border-radius: 6px;
  padding: 0.5rem 0.7rem; font-size: 0.9rem; font-family: var(--font-sans);
}
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
input.mono { font-family: var(--font-mono); }
.field { margin-bottom: 0.9rem; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.9rem; }
.hint { font-size: 0.78rem; color: var(--text-dim); margin-top: 0.3rem; }

pre.snippet {
  background: var(--bg-canvas); border: 1px solid var(--border-subtle); border-radius: 8px;
  padding: 0.75rem 0.9rem; font-family: var(--font-mono); font-size: 0.82rem;
  overflow-x: auto; white-space: pre; color: #cbd5e1;
}
.snippet-row { display: flex; align-items: flex-start; gap: 0.6rem; margin-bottom: 0.9rem; }
.snippet-row pre { flex: 1; min-width: 0; }

/* Modals. Every destructive action goes through one, and each asks the user to
   type the thing being destroyed rather than to click "yes". */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 500; background: rgba(2, 6, 16, 0.75);
  display: flex; justify-content: center; padding: 1rem;
  /* Every modal here auto-focuses a typed-confirmation field, so on a phone
     the keyboard opens with the dialog. `safe center` centres when the box
     fits and top-anchors when it does not; plain flex-start is the fallback
     for engines without the keyword. The backdrop scrolls so the action row
     can never be clipped out of reach. */
  align-items: flex-start;
  align-items: safe center;
  overflow-y: auto; overscroll-behavior: contain;
}
.modal {
  background: var(--bg-surface); border: 1px solid var(--border-default);
  border-radius: 12px; padding: 1.5rem; max-width: 560px; width: 100%;
  max-height: 90vh; overflow-y: auto;
}
.modal h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.6rem; }
.modal p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.9rem; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.2rem; flex-wrap: wrap; }
.modal-error { color: #fca5a5; font-size: 0.85rem; margin-top: 0.6rem; min-height: 1.2em; overflow-wrap: anywhere; }

.spinner {
  width: 28px; height: 28px; border: 3px solid var(--border-default);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto 1rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }

footer {
  border-top: 1px solid var(--border-subtle); padding: 1.5rem 2rem; text-align: center;
  font-size: 0.85rem; color: var(--text-dim); background: var(--bg-surface);
}

#impersonation-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .4rem 1rem;
  padding: .6rem 1rem; font-size: .85rem;
  background: #7a4b00; color: #fff; border-bottom: 2px solid #ffb020;
}

@media (max-width: 640px) {
  header { padding: 0.75rem 1rem; flex-wrap: wrap; }
  main { padding: 1.25rem 1rem; }
  .panel { padding: 1.1rem; }
  footer { padding: 1.25rem 1rem; }

  /* Tables become cards, the same shape the operator console uses: the header
     row hides and each cell carries its column name in data-label. Rows are
     written with the attribute in the page scripts. */
  .table-scroll:not(.no-stack) thead { display: none; }
  .table-scroll:not(.no-stack) table,
  .table-scroll:not(.no-stack) tbody,
  .table-scroll:not(.no-stack) tr { display: block; width: 100%; }

  .table-scroll:not(.no-stack) tbody tr {
    border: 1px solid var(--border-default);
    border-radius: 10px;
    margin-bottom: 0.6rem;
    padding: 0.2rem 0.75rem;
    background: var(--bg-card);
  }
  .table-scroll:not(.no-stack) tbody tr:hover { background: var(--bg-card); }

  .table-scroll:not(.no-stack) tbody td {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 1rem;
    border-bottom: 1px dotted var(--border-subtle);
    padding: 0.45rem 0;
    text-align: right;
    overflow-wrap: anywhere;
  }
  .table-scroll:not(.no-stack) tbody tr td:last-child { border-bottom: none; }

  .table-scroll:not(.no-stack) tbody td::before {
    content: attr(data-label);
    flex: none; text-align: left;
    color: var(--text-muted);
    font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
  }
  .table-scroll:not(.no-stack) tbody td:not([data-label])::before { content: none; }

  /* The trend sparkline is decoration; the latest value is the information.
     Same call the operator console makes about its quota gauge. */
  .spark-cell { display: none; }

  /* The action buttons read better as a full-width row than a label/value pair. */
  .table-scroll:not(.no-stack) tbody td.actions {
    display: flex; justify-content: flex-end; white-space: normal; text-align: right;
  }
}

/* Hit targets and input sizing follow the pointer, not the width: a tablet
   needs 44px buttons at any width, a narrow desktop window does not. */
@media (pointer: coarse) {
  .btn { padding: 0.7rem 1.1rem; min-height: 44px; }
  .btn.small { padding: 0.55rem 0.8rem; min-height: 44px; }
  .nav-btn { padding: 0.65rem 0.9rem; min-height: 44px; }
  td.actions .btn { margin-top: 0.15rem; margin-bottom: 0.15rem; }
  /* 16px is the iOS no-zoom floor. */
  input[type="text"], input[type="search"], select, textarea { font-size: 16px; }
}

/* ------------------------------------------------------------- workbench
   One working surface for entities, types and the database: a persistent
   rail on the left, hash-routed views on the right. The rail is the type
   family made navigational. Same collapse behavior as the operator console:
   below 900px it becomes a wrapping link row above the content. */
.wb-shell { display: flex; flex: 1; align-items: stretch; width: 100%; }
.wb-rail {
  width: 230px; flex: none;
  border-right: 1px solid var(--border-subtle);
  padding: 1rem 0.6rem 2rem;
  background: var(--bg-surface);
}
.wb-rail .rail-label {
  font-size: 0.72rem; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.07em;
  margin: 0.9rem 0.5rem 0.35rem;
}
.wb-rail a {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  padding: 0.42rem 0.55rem; border-radius: 6px;
  color: var(--text-muted); text-decoration: none; font-size: 0.88rem;
}
.wb-rail a:hover { color: var(--text-main); background: var(--bg-card); }
.wb-rail a.active { color: var(--text-main); background: var(--bg-card); font-weight: 600; }
.wb-rail .count { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-dim); }
.wb-rail .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.wb-rail .dot.strict { background: var(--accent-amber); }
.wb-rail .dot.open { background: var(--border-default); }
.wb-rail .rail-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.wb-main { flex: 1; min-width: 0; padding: 1.2rem 1.4rem 3rem; max-width: 1100px; }
.wb-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.wb-toolbar h1 { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }
.wb-toolbar .sub { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-dim); }
.wb-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

.metric-chip {
  display: inline-block; padding: 0.3rem 0.7rem; border-radius: 9999px;
  border: 1px solid var(--border-default); background: transparent;
  color: var(--text-muted); font-family: var(--font-mono); font-size: 0.8rem;
  cursor: pointer;
}
.metric-chip:hover { color: var(--text-main); background: var(--bg-card); }
.metric-chip.active { color: var(--text-main); border-color: var(--primary); background: var(--bg-card); }

.wb-back { color: var(--text-muted); text-decoration: none; font-size: 0.85rem; }
.wb-back:hover { color: var(--text-main); }

@media (max-width: 900px) {
  .wb-shell { flex-direction: column; }
  .wb-rail {
    width: 100%; border-right: none; border-bottom: 1px solid var(--border-subtle);
    display: flex; flex-wrap: wrap; gap: 0.15rem; padding: 0.5rem;
  }
  .wb-rail .rail-label { display: none; }
  .wb-rail a { padding: 0.5rem 0.65rem; }
  .wb-main { padding: 1rem 1rem 2.5rem; }
}
@media (pointer: coarse) {
  .wb-rail a { min-height: 44px; }
  .metric-chip { min-height: 44px; padding: 0.6rem 0.9rem; }
}

/* Overview usage meters (console shell). */
.meter { height: 8px; border-radius: 9999px; background: var(--bg-canvas); border: 1px solid var(--border-subtle); overflow: hidden; margin-top: 0.45rem; }
.meter > span { display: block; height: 100%; background: var(--primary); }
.meter.warn > span { background: var(--accent-amber); }
.meter.full > span { background: var(--accent-red); }

/* Sparklines (console entity view). */
.spark { color: var(--primary); display: block; }
.spark-cell { width: 130px; }
.series-spark { color: var(--primary); margin: 0.5rem 0 0.75rem; }
.series-spark svg { width: 100%; height: 70px; display: block; }

/* Identity chip + toasts. */
.id-chip {
  display: inline-flex; align-items: center;
  padding: 0.35rem 0.7rem; border-radius: 9999px;
  border: 1px solid var(--border-default); background: var(--bg-card);
  color: var(--text-muted); font-family: var(--font-mono); font-size: 0.78rem;
  max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#toast-stack {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 9000;
  display: flex; flex-direction: column; gap: 0.5rem; max-width: min(24rem, 90vw);
}
.toast {
  padding: 0.7rem 1rem; border-radius: 8px; font-size: 0.88rem;
  border: 1px solid; overflow-wrap: anywhere;
}
.toast.err { color: #fca5a5; background: rgba(239,68,68,0.14); border-color: rgba(239,68,68,0.5); }
.toast.ok  { color: #6ee7b7; background: rgba(16,185,129,0.14); border-color: rgba(16,185,129,0.5); }

/* Category children in the rail. */
.wb-rail a.rail-sub { padding-left: 1.7rem; }
@media (max-width: 900px) { .wb-rail a.rail-sub { padding-left: 0.65rem; } }

/* Entity graph (console #graph view). */
.graph-svg { width: 100%; height: auto; display: block; margin-top: 0.4rem; }
.graph-svg .g-edge line { stroke: var(--border-default); stroke-width: 1.2; }
.graph-svg #g-arrow path { fill: var(--border-default); }
.graph-svg .g-edge text {
  font-size: 9.5px; fill: var(--text-dim); text-anchor: middle;
  paint-order: stroke; stroke: var(--bg-surface); stroke-width: 3px;
}
.graph-svg .g-node { cursor: pointer; }
.graph-svg .g-node circle { stroke: var(--bg-surface); stroke-width: 1.5; }
.graph-svg .g-node:hover circle, .graph-svg .g-node:focus circle { stroke: var(--primary); stroke-width: 2; }
.graph-svg .g-node:focus { outline: none; }
.graph-svg .g-node text {
  font-size: 10.5px; fill: var(--text-muted); text-anchor: middle;
  paint-order: stroke; stroke: var(--bg-surface); stroke-width: 3px;
}
.graph-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-top: 0.7rem; }
.graph-legend .lg {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.8rem; color: var(--text-muted); font-family: var(--font-mono);
}
.graph-legend .lg i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Connect form (entity Connections panel). */
.edge-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-top: 0.9rem; }
.edge-form select, .edge-form input { width: auto; max-width: 100%; }
.edge-form input { flex: 1 1 9rem; min-width: 8rem; }
@media (max-width: 640px) {
  .edge-form { flex-direction: column; align-items: stretch; }
  .edge-form select, .edge-form input { width: 100%; }
}

/* Help tips: the circled ? that explains a concept in place. */
.help-tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.05rem; height: 1.05rem; padding: 0; margin-left: 0.45rem;
  appearance: none; border-radius: 50%;
  border: 1px solid var(--border-default); background: transparent;
  color: var(--text-dim); font-family: var(--font-sans);
  font-size: 0.7rem; font-weight: 600; line-height: 1;
  cursor: help; vertical-align: middle; flex: 0 0 auto;
}
.help-tip:hover, .help-tip:focus-visible, .help-tip[aria-expanded="true"] {
  color: var(--primary); border-color: var(--primary); background: var(--primary-glow);
}
.help-tip:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
#help-pop {
  position: fixed; z-index: 8500; max-width: 300px;
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: 8px; padding: 0.7rem 0.85rem;
  font-size: 0.82rem; line-height: 1.55; color: var(--text-muted);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  display: none; overflow-wrap: anywhere;
}
#help-pop .mono, #help-pop code {
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-main);
}
#help-pop strong { color: var(--text-main); }
#help-pop p { margin: 0 0 0.5rem; }
#help-pop p:last-child { margin-bottom: 0; }
#help-pop .dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 0.2rem; vertical-align: baseline;
}
#help-pop .dot.strict { background: var(--accent-amber); }
#help-pop .dot.open { background: var(--border-default); }

/* Forecast chart (console #forecasts view). */
.fc-chart svg { width: 100%; height: auto; display: block; }
.fc-chart .fc-actual { stroke: var(--text-main); stroke-width: 1.9; fill: none; }
.fc-chart .fc-grid { stroke: var(--border-subtle); stroke-width: 1; }
.fc-chart .fc-axis-label { font-size: 10px; fill: var(--text-dim); font-family: var(--font-mono); }
.fc-chart .fc-now { stroke: var(--accent-amber); stroke-width: 1; stroke-dasharray: 4 3; }
.fc-chart .fc-now-label { font-size: 9.5px; fill: var(--accent-amber); font-family: var(--font-mono); }
.fc-chart .fc-future { fill: var(--primary-glow); opacity: 0.35; }
.fc-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.2rem 0 0.5rem; }
.fc-tab {
  padding: 0.25rem 0.6rem; border: 1px solid var(--border-default); border-radius: 6px;
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted);
  background: transparent; cursor: pointer;
}
.fc-tab.active { color: var(--primary); border-color: var(--primary); background: var(--primary-glow); }
.fc-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; margin: 0.6rem 0 0.9rem; }
.fc-legend .lg, td .lg {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.8rem; color: var(--text-muted); font-family: var(--font-mono);
}
.fc-legend .lg i, td .lg i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.fc-legend .lg.toggle { background: none; border: 0; padding: 0; cursor: pointer; }
.fc-legend .lg.toggle.off { opacity: 0.4; text-decoration: line-through; }
