/* ReUI base-nova, neutral theme (c-sidebar-1 inset shell); series color = SMARTA blue */
:root {
  --background: #ffffff;
  --foreground: #0a0a0a;
  --card: #ffffff;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --border: #e5e5e5;
  --input: #e5e5e5;
  --ring: rgba(10, 10, 10, .1);
  --head: rgba(23, 23, 23, .8);
  --primary: #171717;
  --primary-foreground: #fafafa;
  --accent-foreground: #171717;
  --ring-focus: #a1a1a1;
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-opacity='.5' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --destructive-text: #e7000b;
  --sidebar: #fafafa;
  --sidebar-foreground: #0a0a0a;
  --sidebar-primary: #171717;
  --sidebar-primary-foreground: #fafafa;
  --sidebar-accent: rgba(0,0,0,.03);
  --sidebar-active: rgba(0,0,0,.05);
  --sidebar-accent-foreground: #171717;
  --sidebar-border: #e5e5e5;
  --frame: rgba(245, 245, 245, .5);
  --tab-active: rgba(255,255,255,.8);
  --tabs-list: rgba(0,0,0,.06);
  --tab-active-border: transparent;
  --outline-bg: var(--background);
  --outline-hover: var(--muted);
  --tooltip-shadow: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1);
  color-scheme: light;
  --series: #00a0e3;
  --success: #00bc7d;
  --warning: #fe9a00;
  --destructive: #fb2c36;
  --info: #00a0e3;
  --sidebar-width: 256px;
  --sidebar-width-icon: 64px;  /* ReUI / shadcn inset: 3rem + 1rem; 16 + 32 + 16, center line at 32px */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: #0a0a0a;
    --foreground: #fafafa;
    --card: #171717;
    --muted: #262626;
    --muted-foreground: #a1a1a1;
    --border: rgba(255,255,255,.1);
    --input: rgba(255,255,255,.15);
    --ring: rgba(255,255,255,.1);
    --head: rgba(250,250,250,.8);
    --primary: #e5e5e5;
    --primary-foreground: #171717;
    --accent-foreground: #fafafa;
    --ring-focus: #737373;
    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1a1' stroke-opacity='.5' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --destructive-text: #ff6467;
    --sidebar: #171717;
    --sidebar-foreground: #fafafa;
    --sidebar-primary: #00a0e3;
    --sidebar-primary-foreground: #fafafa;
    --sidebar-accent: rgba(255,255,255,.06);
    --sidebar-active: rgba(255,255,255,.1);
    --sidebar-accent-foreground: #fafafa;
    --sidebar-border: rgba(255,255,255,.1);
    --frame: rgba(38, 38, 38, .5);
  --tab-active: rgba(255, 255, 255, .045);
  --tabs-list: rgba(255,255,255,.06);
  --tab-active-border: rgba(255, 255, 255, .15);
  --outline-bg: rgba(255,255,255,.045);
    --outline-hover: rgba(255,255,255,.075);
    --tooltip-shadow: 0 20px 25px -5px rgba(0,0,0,.4), 0 8px 10px -6px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --background: #0a0a0a;
  --foreground: #fafafa;
  --card: #171717;
  --muted: #262626;
  --muted-foreground: #a1a1a1;
  --border: rgba(255,255,255,.1);
  --input: rgba(255,255,255,.15);
  --ring: rgba(255,255,255,.1);
  --head: rgba(250,250,250,.8);
  --primary: #e5e5e5;
  --primary-foreground: #171717;
  --accent-foreground: #fafafa;
  --ring-focus: #737373;
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1a1' stroke-opacity='.5' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --destructive-text: #ff6467;
  --sidebar: #171717;
  --sidebar-foreground: #fafafa;
  --sidebar-primary: #00a0e3;
  --sidebar-primary-foreground: #fafafa;
  --sidebar-accent: rgba(255,255,255,.06);
  --sidebar-active: rgba(255,255,255,.1);
  --sidebar-accent-foreground: #fafafa;
  --sidebar-border: rgba(255,255,255,.1);
  --frame: rgba(38, 38, 38, .5);
  --tab-active: rgba(255, 255, 255, .045);
  --tabs-list: rgba(255,255,255,.06);
  --tab-active-border: rgba(255, 255, 255, .15);
  --outline-bg: rgba(255,255,255,.045);
  --outline-hover: rgba(255,255,255,.075);
  --tooltip-shadow: 0 20px 25px -5px rgba(0,0,0,.4), 0 8px 10px -6px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--sidebar) url("../img/background.jpg") center / cover no-repeat fixed;
  color: var(--foreground);
  font: 400 14px/20px var(--font-sans);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted-foreground); }

/* App shell (ReUI c-sidebar-1: Sidebar variant="inset" + SidebarInset) */
/* Frosted glass over the body photo. The shell's glass sits in ::before: a backdrop-filter on .shell itself
   would stop the inset's glass from reaching the photo. */
.shell { position: relative; isolation: isolate; display: flex; height: 100dvh; overflow: hidden; }
.shell::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: color-mix(in srgb, var(--sidebar) 98%, transparent); backdrop-filter: blur(100px) saturate(1.4); -webkit-backdrop-filter: blur(100px) saturate(1.4);
}
.sidebar {
  width: var(--sidebar-width); flex: none; display: flex; flex-direction: column;
  color: var(--sidebar-foreground); overflow: hidden; transition: width .2s linear;
}
/* Collapsed (768px and wider): an icon rail — brand tile, section icons, server tile; names in tooltips.
   As in ReUI (shadcn sidebar, inset): 8px on the sidebar's sides plus 8px of the group, so buttons stand 16px
   from both edges. Only the width changes: nothing moves; tiles, icons and the active background share one
   center line; a group label becomes a dot of its tone on that line and keeps its height. */
@media (min-width: 768px) {
  .sidebar { padding: 0 8px; }
  .shell.collapsed .sidebar { width: var(--sidebar-width-icon); }
  .shell.collapsed .sb-text, .shell.collapsed .nav .sb-button > span { display: none; }
  .shell.collapsed .sb-group-label { font-size: 0; }
  /* A solid dot in the label color reads darker than thin antialiased letters: 40% matches how the label looks. */
  .shell.collapsed .sb-group-label::before { content: ""; width: 4px; height: 4px; margin-left: 6px; border-radius: 50%;
    background: color-mix(in srgb, var(--sidebar-foreground) 40%, transparent); }
}
.sidebar-header, .sidebar-footer { display: flex; flex-direction: column; gap: 8px; padding: 8px; }
.sidebar-content { flex: 1; min-height: 0; overflow: auto; scrollbar-width: none; }
.sb-group { display: flex; flex-direction: column; padding: 8px; }
.sb-group-label {
  height: 32px; display: flex; align-items: center; padding: 0 8px; border-radius: 8px;
  font-size: 12px; line-height: 16px; font-weight: 600; color: color-mix(in srgb, var(--sidebar-foreground) 70%, transparent);
}
.sb-menu { display: flex; flex-direction: column; gap: 2px; }   /* a hovered item never touches the active one */
.sb-button {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 8px; border-radius: 8px; overflow: hidden;
  color: var(--sidebar-foreground); text-decoration: none; font-size: 14px; line-height: 20px; outline: none;
}
.sb-button > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.sb-button:hover, a.sb-button:active, .sb-button[aria-current="page"] { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); }
.sb-button[aria-current="page"] { font-weight: 400; background: var(--sidebar-active); }
a.sb-button:focus-visible { box-shadow: 0 0 0 2px var(--ring-focus); }
.sb-button.lg { height: 48px; }
/* Brand and server tiles without side padding: centered over the 16px icons, so the rail keeps them in place. */
.sidebar-header .sb-button.lg, .sidebar-footer .sb-button.lg { padding: 8px 0; }
.sb-text { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.sb-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-sub { font-size: 12px; color: color-mix(in srgb, var(--sidebar-foreground) 70%, transparent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-avatar { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--sidebar-active); color: var(--muted-foreground); }
.sb-separator { height: 1px; background: var(--sidebar-border); }

.inset {
  flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
  margin: 8px 8px 8px 0; border-radius: 14px;
  background: color-mix(in srgb, var(--background) 89%, transparent); backdrop-filter: blur(100px) saturate(1.4); -webkit-backdrop-filter: blur(100px) saturate(1.4);
  box-shadow: 0 1px 3px 0 rgba(0,0,0,.1), 0 1px 2px -1px rgba(0,0,0,.1);
}
.inset-header { height: 48px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.btn.trigger { margin-left: -4px; }
.breadcrumb-page { color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.updated { margin-left: auto; color: var(--muted-foreground); white-space: nowrap; }
/* ReUI c-sidebar-1: the panel stays in place and its content scrolls («flex-1 overflow-auto p-4»).
   Full panel width with 16px on both sides; title and cards line up under the header. */
.main { flex: 1; min-height: 0; overflow: auto; }
.page { padding: 16px; display: grid; gap: 16px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-height: 32px; }
.page-actions { display: flex; align-items: center; gap: 8px; }
@media (max-width: 639px) { .page-head > .muted { display: none; } }
.page-head h1 { margin: 0; font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -.5px; }
.scrim { display: none; }
@media (max-width: 767px) {
  .sidebar {
    position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: 288px; background: var(--sidebar);
    transform: translateX(-100%); transition: transform .2s; box-shadow: 0 10px 15px -3px rgba(0,0,0,.1);
  }
  .sidebar.open { transform: none; }
  .inset, .shell.collapsed .inset { margin: 0; border-radius: 0; box-shadow: none; }
  .scrim.open { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.1); backdrop-filter: blur(4px); }
}
@media (max-width: 639px) { .updated { display: none; } .inset-header .btn-sm span { display: none; } .inset-header .btn-sm { width: 28px; padding: 0; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 10px;
  border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 14px; line-height: 20px;
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 90%, transparent); }
.btn-outline { background: var(--outline-bg); border-color: var(--input); color: var(--foreground); }
.btn-outline:hover { background: var(--outline-hover); }
.btn:focus-visible { outline: none; border-color: var(--ring-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring-focus) 50%, transparent); }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--muted); }
.btn-sm { height: 28px; gap: 4px; border-radius: 8px; padding: 0 10px; font-size: 12.8px; }
.btn-sm svg.i { width: 14px; height: 14px; }
.btn-sm:has(> svg:first-child) { padding-left: 6px; }
.btn-icon { width: 28px; height: 28px; padding: 0; border-radius: 8px; }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; }

/* Form controls */
.field { display: grid; gap: 6px; }
.field label, .field .label { font-weight: 600; }
.rates { display: grid; gap: 16px; }
.input[readonly] { background: var(--muted); color: var(--muted-foreground); }
.input, .select {
  height: 32px; width: 100%; padding: 0 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--card); color: var(--foreground); font-weight: 400; font-size: 14px; line-height: 20px; outline: none;
}
.select {
  /* ReUI Select: own chevron-down 16px, muted at 50%, 8px from the right edge, 6px gap to the text */
  appearance: none; -webkit-appearance: none; padding-right: 30px; text-overflow: ellipsis;
  background-image: var(--select-chevron); background-repeat: no-repeat; background-position: right 8px center; background-size: 16px 16px;
}
.input:focus-visible, .select:focus-visible { border-color: var(--ring-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring-focus) 50%, transparent); }
.input[aria-invalid="true"] { border-color: var(--destructive-text); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }

/* Sheet (surge sheet + sheet-6 footer) */
.sheet-overlay { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.1); backdrop-filter: blur(4px); }
.sheet {
  position: fixed; z-index: 41; top: 16px; right: 16px; bottom: 16px; width: min(480px, calc(100vw - 32px));
  display: flex; flex-direction: column; overflow: hidden; background: var(--card); border-left: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
}
.sheet-header { position: relative; padding: 16px 52px 16px 24px; border-bottom: 1px solid var(--border); font-size: 16px; line-height: 24px; font-weight: 600; }
.sheet-close { position: absolute; top: 12px; right: 12px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 16px 24px; display: grid; gap: 16px; align-content: start; }
.sheet-footer { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px 20px; border-top: 1px solid var(--border); background: var(--muted); }
.form-error { color: var(--destructive-text); }

/* Empty state */
.empty { display: grid; justify-items: center; align-content: center; gap: 12px; padding: 32px 16px; text-align: center; height: 100%; }
.empty-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--muted); }
.empty-title { font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } }
svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Alert */
.alerts { display: grid; gap: 8px; }
.alerts:empty { display: none; }
.alert {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--card);
}
.alert svg { color: var(--warning); }
.alert.destructive svg { color: var(--destructive); }

/* Grid */
.stats { display: grid; gap: 16px; align-items: stretch; grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* Two stacked columns (wide + narrow): every card is as tall as its content, gaps 16px (ReUI blocks: gap-4) */
.cols { display: grid; gap: 16px; align-items: start; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.col { display: grid; gap: 16px; min-width: 0; }
.row { display: grid; gap: 16px; align-items: start; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1279px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1365px) { .cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1023px) { .row, .row.two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 639px) { .stats { grid-template-columns: minmax(0, 1fr); } }

/* Metric card = ReUI dashboard-2 (shadcn Card): title, then label + value on the left and a 64px area sparkline
   (max 160 wide) on the right. Spec: docs/reui/dashboard-2-metric-card.md */
/* Border like the Frame cards, so outer edges line up; 1 + 15 / 1 + 19 = text 16px from the top, 20px from the sides */
.metric-card { min-width: 0; padding: 15px 19px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.metric-title { margin-bottom: 20px; font-size: 14px; line-height: 20px; font-weight: 400; }
.metric-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.metric-text { display: flex; flex-direction: column; gap: 1px; padding-bottom: 8px; flex: none; }
.metric-label, .metric-value { overflow: hidden; text-overflow: ellipsis; }
.metric-label { font-size: 12px; line-height: 16px; color: var(--muted-foreground); white-space: nowrap; }
.metric-value { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric-chart { position: relative; height: 64px; flex: 1 1 0; max-width: 160px; min-width: 0; }
.metric-chart svg { display: block; width: 100%; height: 64px; }
.metric-chart.ring-slot { display: flex; align-items: center; justify-content: flex-end; flex: none; width: auto; }
/* Progress ring (dashboard-2 module grid): r18 / 3.25 in a 44 viewBox, round cap, track muted-fg/20.
   ReUI draws it at 40px with a 9px label; in the metric card it fills the 64px chart height (label scaled to 14px). */
.ring { position: relative; width: 40px; height: 40px; flex: none; color: var(--series); }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { stroke: color-mix(in srgb, var(--muted-foreground) 20%, transparent); }
.ring-value { stroke: currentColor; transition: stroke-dashoffset .3s; }
.ring-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 9px; line-height: 1; font-weight: 600; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.ring-slot .ring { width: 64px; height: 64px; }
.ring-slot .ring-label { font-size: 14px; }
/* Fill level: project blue below 70 %, amber-500 from 70 %, red-500 from 90 %. Green is kept for status dots. */
.ring.warning { color: oklch(76.9% .188 70.08); }
.ring.destructive { color: oklch(63.7% .237 25.331); }
/* Quota cells = ReUI stats-18: one panel, cells divided by 1px lines (a 1px grid gap over the border color),
   all in one row (as many columns as cells), 2 on tablets (an odd last cell spans both), 1 on phones or in a narrow
   column (.quota.stack). Cell padding 15 + panel border 1 = text 20px from the card edge like every other block;
   gaps from stats-18 (24 / 12 / 3). */
.quota { display: grid; gap: 1px; background: var(--border); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.quota.stack { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1279px) {
  .quota:not(.stack) { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quota:not(.stack) .quota-cell:last-child:nth-child(odd) { grid-column: span 2; }
}
@media (max-width: 639px) {
  .quota:not(.stack) { grid-template-columns: minmax(0, 1fr); }
  .quota:not(.stack) .quota-cell:last-child:nth-child(odd) { grid-column: auto; }
}
.quota-cell { display: flex; flex-direction: column; gap: 24px; min-width: 0; padding: 15px; background: var(--card); }
.quota-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.icon-tile {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 8px;
  background: var(--muted); color: var(--accent-foreground); border: 2px solid var(--card); box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .14);
}
.icon-tile svg.i { width: 18px; height: 18px; }
.quota-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.quota-title { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quota-sub { font-size: 12px; line-height: 16px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quota-body { display: flex; flex-direction: column; gap: 12px; }
.quota-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.quota-value { display: flex; align-items: baseline; gap: 6px; min-width: 0; margin: 0; font-variant-numeric: tabular-nums; }
.quota-value b { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -.5px; white-space: nowrap; }
.quota-value span, .quota-pct { color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.quota-pct { color: var(--foreground); font-weight: 600; overflow: visible; }
.meter { display: flex; gap: 3px; height: 20px; }
.meter i { flex: 1; min-width: 0; border-radius: 9999px; background: var(--muted); }
.meter[data-tone="series"] i.on { background: var(--series); }
.meter[data-tone="info"] i.on { background: var(--info); }
.meter[data-tone="warning"] i.on { background: oklch(76.9% .188 70.08); }
.meter[data-tone="destructive"] i.on { background: oklch(63.7% .237 25.331); }

/* Stat tile = ReUI stats-1 (Frame card, KPI without a chart): muted title, 24px value, separator, 12px footer */
.card-body.stat-tile { display: flex; flex-direction: column; gap: 20px; }
.stat-title { font-weight: 600; color: var(--muted-foreground); }
.stat-block { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.stat-value { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-sep { height: 1px; background: var(--border); }
.stat-foot { font-size: 12px; line-height: 16px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-foot b { font-weight: 600; color: var(--foreground); }

/* Card = ReUI Frame: muted frame (r14, 3px inset) with the header on it and white panels inside
   (concentric r10 = 14 - 3 - 1, shadow-xs, 16px padding); frame-panel-header 8px 16px. */
.card {
  display: flex; flex-direction: column; gap: 3px; padding: 3px; min-width: 0;
  border: 1px solid var(--border); border-radius: 14px; background: var(--frame); background-clip: padding-box;
}
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; min-height: 40px; padding: 8px 16px; }
/* Every header is 40px: with a 28px control (button, segmented toggle) the padding is 6px, with tabs 4px (below) */
.card-header:has(.btn, .seg) { padding-top: 6px; padding-bottom: 6px; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 14px; line-height: 20px; font-weight: 600; }
.card-body {
  /* Text 20px from the card's outer edge, like the header: card border 1 + inset 3 + panel border 1 + 15 (16 inside the panel on every side) */
  position: relative; flex: 1; min-width: 0; overflow: hidden; padding: 15px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--card); background-clip: padding-box;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .05);
}
.card-body + .card-body { margin-top: 4px; }
.card-body.flush { padding: 0; }
.card-body.fill { display: flex; flex-direction: column; }
.card-body.fill > .empty { flex: 1; }

.seg { display: inline-flex; height: 28px; }
.seg button {
  height: 28px; padding: 0 8px; border: 1px solid var(--border); margin-left: -1px; background: transparent;
  color: var(--muted-foreground); font-weight: 600; font-size: 12.8px; line-height: 18px; cursor: pointer;
}
.seg button:first-child { border-radius: 10px 0 0 10px; margin-left: 0; }
.seg button:last-child { border-radius: 0 10px 10px 0; }
.seg button:only-child { border-radius: 10px; }
.seg button[aria-pressed="true"] { background: var(--muted); color: var(--foreground); }
.header-tools { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
/* Phones: the services summary repeats the tab, so it goes and headers stay 40px (only «Нагрузка» takes two rows: title, then toggles) */
@media (max-width: 639px) { .header-tools { gap: 8px; } #services-summary { display: none; } }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--series); flex: none; }

/* Bar chart */
.chart { height: 220px; position: relative; }
.chart svg { display: block; width: 100%; height: 220px; overflow: visible; }
.chart text { font-weight: 400; font-size: 12px; fill: var(--muted-foreground); }
.chart .track { fill: var(--muted); }
.chart .bar { fill: url(#hatch); }
.chart g.col.active .bar { fill: var(--series); }

/* Tooltip */
.tooltip {
  position: fixed; z-index: 10; pointer-events: none; width: 224px; display: none; gap: 6px;
  background: var(--card); border: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  border-radius: 10px; padding: 6px 10px; box-shadow: var(--tooltip-shadow); font-size: 12px; line-height: 16px;
}
.tooltip.show { display: grid; }
/* Chart tooltip as a small card (dashboard-2): r14, ring + shadow-md, 6px 8px, gap 4 */
.tooltip.tooltip-card {
  width: auto; min-width: 96px; gap: 4px; padding: 6px 8px; border: 0; border-radius: 14px;
  box-shadow: 0 0 0 1px var(--ring), 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
}
.tc-label { font-size: 10px; line-height: 1; font-weight: 600; color: var(--muted-foreground); }
.tc-value { font-size: 12px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.tt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tt-head { font-weight: 600; }
.tt-label { display: flex; align-items: center; gap: 6px; color: var(--muted-foreground); }
.tt-value { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Key/value list (ReUI: flex-col gap-2, muted label, no dividers) */
.kv { display: flex; flex-direction: column; gap: 8px; }
.svc { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kv-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 20px; }
.kv-row .muted { white-space: nowrap; }
.kv-row > :last-child { text-align: right; }
.kv-sep { height: 1px; margin: 4px 0; background: var(--border); }

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 2px 5px; border-radius: 6px;
  border: 1px solid var(--border); font-size: 12px; line-height: 16px; font-weight: 600; white-space: nowrap; color: var(--foreground);
}
.badge .dot { width: 6px; height: 6px; }
.badge.secondary { background: var(--muted); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* In a table the tags stay on one line: the column takes their width, the name column gives way. */
td .chips { flex-wrap: nowrap; }

/* Table (ReUI data-grid) */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; text-align: left; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 15px; }
/* The name column takes the spare width and truncates long names instead of widening the table. */
th:first-child, td:first-child { width: 100%; }
td:first-child { max-width: 0; min-width: 120px; }
th:last-child, td:last-child { padding-right: 15px; }
th { height: 40px; padding-top: 0; padding-bottom: 0; font-weight: 400; color: var(--head); border-bottom: 1px solid var(--border); }
td { border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--muted) 50%, transparent); }
.r { text-align: right; }
/* Pagination under a table (ReUI data-grid pagination): range on the left, prev / next outline icon buttons. */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 8px 15px; border-top: 1px solid var(--border); }
.pager-info { margin-right: auto; color: var(--muted-foreground); }
.pager .btn:disabled { opacity: .5; cursor: default; pointer-events: none; }
/* Sortable header: ReUI DataGridColumnHeader ghost button, h24 px8 r10, label aligned with the cell text. */
.th-sort { display: inline-flex; align-items: center; gap: 6px; height: 24px; margin-left: -8px; padding: 0 8px; border: 0; border-radius: 10px; background: transparent; color: inherit; font: inherit; cursor: pointer; transition: background .15s, color .15s; }
th.r .th-sort { margin-left: 0; margin-right: -8px; }
.th-sort:hover { background: var(--muted); color: var(--foreground); }
.th-sort svg.i { width: 13px; height: 13px; margin-top: 1px; }
.th-sort:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring-focus) 50%, transparent); }
.cell-main { display: block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.cell-sub { display: block; overflow: hidden; text-overflow: ellipsis; font-size: 12px; line-height: 16px; color: var(--muted-foreground); }
.cell-sub.time { font-size: 14px; line-height: 20px; }

.loading { padding: 48px 16px; text-align: center; color: var(--muted-foreground); }

/* Tabs (ReUI Tabs, default variant): muted list r10 / 3px, triggers 26px r8, active = card + shadow-sm, others 60% */
.tabs { display: inline-flex; align-items: center; height: 32px; padding: 3px; border-radius: 10px; background: var(--tabs-list); }
.tabs [role=tab] {
  height: 26px; padding: 2px 6px; border: 1px solid transparent; border-radius: 8px; background: none; cursor: pointer;
  font-weight: 600; font-size: 14px; line-height: 20px; color: color-mix(in srgb, var(--foreground) 60%, transparent);
}
.tabs [role=tab]:hover { color: var(--foreground); }
.tabs [role=tab][aria-selected="true"] {
  background: var(--tab-active); border-color: var(--tab-active-border); color: var(--foreground);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .1), 0 1px 2px -1px rgba(0, 0, 0, .1);
}
.tabs [role=tab]:focus-visible { outline: none; border-color: var(--ring-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring-focus) 50%, transparent); }
/* Header with tabs keeps the 40px frame header: 4 + 32 + 4 */
.card-header:has(> .tabs) { padding-top: 4px; padding-bottom: 4px; }
[role=tabpanel][hidden] { display: none; }
.card-body[hidden] + .card-body { margin-top: 0; }

/* Commands to copy */
.cmd { display: flex; align-items: center; gap: 4px; min-width: 0; padding: 2px 2px 2px 10px; border-radius: 8px; background: var(--muted); }
.cmd code { font: 12px/16px var(--font-mono); flex: 1; min-width: 0; padding: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.steps summary { cursor: pointer; font-weight: 600; }
.steps ol { display: grid; gap: 8px; margin: 8px 0 0; padding: 0; list-style: none; }
.steps li { display: grid; gap: 2px; min-width: 0; }

/* Collapsible group rows in tables (ReUI collapsible): chevron turns down when open, children indented under the title */
.group-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.group-cell > div { min-width: 0; }
.row-toggle { width: 24px; height: 24px; display: inline-grid; place-items: center; flex: none; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted-foreground); cursor: pointer; }
.row-toggle:hover { background: var(--muted); color: var(--foreground); }
.row-toggle:focus-visible { outline: 2px solid var(--ring-focus); outline-offset: 1px; }
.row-toggle svg.i { transition: transform .2s ease; }
.row-toggle[aria-expanded="true"] svg.i { transform: rotate(90deg); }
td.child-cell { padding-left: 47px; }
