/* 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='2' 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;
  --folder: #fe9a00;   /* folders in file lists and trees: ReUI c-tree-5, text-amber-500 (Tailwind 4) */
  --success: #00bc7d;
  --warning: #fe9a00;
  --destructive: #fb2c36;
  --info: #00a0e3;
  --sidebar-width: 256px;
  --sidebar-width-icon: 48px;  /* ReUI echo-chat: 8 + 32 + 8, center line at 24px */
}
@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='2' 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='2' 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?v=6e6719189a") 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, profile; names in tooltips.
   As ReUI echo-chat: the groups' 8px on the sidebar's sides, so buttons stand 8px 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) {
  .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; }
/* Groups as echo-chat: 4px above and below (8px from one group to the next), 8px on the sides; the tabs 12px from
   what is above and under them. */
.sb-group { display: flex; flex-direction: column; padding: 4px 8px; }
.sb-group.sb-tabs-group { 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: 500; 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 { padding: 8px 0; }
.sb-text { display: grid; row-gap: 2px; flex: 1; min-width: 0; line-height: 1.25; }   /* 2px between the lines, as the dashboard */
.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; }
/* Every avatar — the person's in the sidebar and in the chat, the AI's — alike, as ReUI ai-chat-1: 32px, primary
   10% over muted, the 14px icon in the primary color at the usual stroke. */
.sb-avatar, .ai-avatar { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%;
  color: var(--primary); background: linear-gradient(color-mix(in srgb, var(--primary) 10%, transparent) 0 0), var(--muted); }
.sb-avatar svg.i, .ai-avatar svg.i { width: 14px; height: 14px; }

.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);
  border: 1px solid var(--border);   /* as ReUI Flowly's inset: a 1px border, no shadow */
}
.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; }
/* The header's path (app.js pageCrumb), as on the claude dashboard. */
.breadcrumb { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted-foreground); }
.breadcrumb-group { flex: none; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; text-decoration: none; }
a.breadcrumb-group:hover { color: var(--foreground); }
.breadcrumb svg.i { width: 14px; height: 14px; flex: none; }
.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; flex-wrap: wrap; gap: 8px; }
.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), 0 4px 6px -4px rgba(0,0,0,.1);   /* shadow-lg, as a sheet */
  }
  .sidebar.open { transform: none; }
  .inset, .shell.collapsed .inset { margin: 0; border: 0; border-radius: 0; }
  .scrim.open { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.1); }
}
@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; }
.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); }
.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); }
.sheet {
  position: fixed; z-index: 41; top: 8px; right: 8px; bottom: 8px; width: min(480px, calc(100vw - 16px));   /* 8px off the edges, as the main block */
  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);
}
/* The title, and its buttons in a row at the right (a file's «Скачать», «Во весь экран», ×); 56px high as before. */
.sheet-header { display: flex; align-items: center; gap: 8px; min-height: 57px; padding: 12px 12px 12px 24px; border-bottom: 1px solid var(--border); font-size: 16px; line-height: 24px; font-weight: 600; }
.sheet-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-tools { flex: none; display: flex; align-items: center; gap: 4px; }

.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); }
/* The sheet's note (openSheet note) over its buttons, on the body's 24px line; a line through the whole footer between
   them, 16px from both — as the footer's paddings. In a close-only sheet the note is alone. */
.sheet-footer > .hint { grid-column: 1 / -1; margin: 0 4px; }
.sheet-footer > .sheet-sep { grid-column: 1 / -1; height: 1px; margin: 4px -20px; background: var(--border); }
.form-error { color: var(--destructive-text); }

/* Empty state */
.empty-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--muted); }
/* Empty state as ReUI Empty (c-empty-4): a 32px icon tile (radius 10, muted, the 16px icon in the text color), title
   14/20 500 and a muted description 8px apart, the tile 16px above them, the actions 16px under them. */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px;
  text-align: center; height: 100%; white-space: normal; }
.empty .empty-icon { width: 32px; height: 32px; margin-bottom: 8px; color: var(--foreground); }
.empty-title { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--foreground); }
.empty-desc { max-width: 384px; color: var(--muted-foreground); font-size: 14px; line-height: 1.625; text-wrap: pretty; }
.empty > .btn { margin-top: 8px; }
@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; }
@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: 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: 0 1 auto; min-width: 0; }   /* gives way to the chart: the label ends in «…» */
.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. 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); }
@media (max-width: 1279px) {
  .quota { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quota .quota-cell:last-child:nth-child(odd) { grid-column: span 2; }
}
@media (max-width: 639px) {
  .quota { grid-template-columns: minmax(0, 1fr); }
  .quota .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 { color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.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="warning"] i.on { background: oklch(76.9% .188 70.08); }
.meter[data-tone="destructive"] i.on { background: oklch(63.7% .237 25.331); }

/* 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; }

.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. */

/* 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 .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; }

/* ReUI Skeleton: bg-accent, animate-pulse (opacity 1 → .5, 2s), rounded-md. Every loading place shows it in its own shape
   (index.html: the sidebar; app.js: skeletonPage and the pages' boxes), never «Загрузка…». */
.skeleton { display: block; height: 16px; border-radius: 6px; background: var(--muted); animation: skeleton-pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; }
@keyframes skeleton-pulse { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.skel-nav { display: grid; gap: 4px; padding: 8px; }
.skel-nav-row { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; }
.skel-nav-row .skeleton:not(.skel-icon) { height: 12px; }
.skel-icon { width: 16px; height: 16px; flex: none; border-radius: 4px; }
.sidebar .skeleton { background: var(--border); }   /* muted melts into the sidebar's own grey */
/* The first paint, until the menu is there (#nav still holds its skeleton): skeletons only — no logo, name or line. */
.skel-only { display: none; }
.shell:has(#nav > .skel-nav) .skel-only { display: flex; }
.shell:has(#nav > .skel-nav) .sidebar-header > .sb-button:not(.skel-only),
.shell:has(#nav > .skel-nav) #user-btn, .shell:has(#nav > .skel-nav) #tips-link { display: none; }
.shell:has(#nav > .skel-nav) .sb-resize { visibility: hidden; }
.skel-logo { width: 32px; height: 32px; flex: none; border-radius: 8px; }
.skel-avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; }
.skel-text { display: grid; gap: 6px; }
.skel-text .skeleton { height: 10px; }
.skel-lines { flex: 1; min-width: 0; display: grid; gap: 10px; align-content: start; }
.skel-rows { display: grid; }
.skel-row { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 16px; }
.skel-row + .skel-row { border-top: 1px solid var(--border); }
.card-body:has(> .skeleton) { display: grid; gap: 12px; }
.skel-metric { display: grid; gap: 16px; }
.skel-metric-row { display: flex; align-items: flex-end; gap: 16px; }
.skel-user { display: flex; justify-content: flex-end; align-items: flex-end; gap: 8px; }
.skel-ai { display: flex; gap: 12px; }
.skel-composer { max-width: 768px; margin: 0 auto; }

/* 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 */

/* Scrollbars as ReUI Scroll Area (base-nova) everywhere: 10px (w-2.5), no track or arrows, a rounded thumb in --border
   1px off the edges (p-px) and 1px more on the content's side (border-l). Blink and WebKit draw it from these; they
   ignore them where an element sets scrollbar-width/-color, so only the hidden strips (scrollbar-width: none) do.
   Firefox knows only the standard properties: a thin bar in the same colour. */
::-webkit-scrollbar { width: 10px; height: 10px; background: transparent; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; }
::-webkit-scrollbar-thumb { background: var(--border); background-clip: padding-box; border: 1px solid transparent; border-left-width: 2px; border-radius: 9999px; }
::-webkit-scrollbar-thumb:horizontal { border-left-width: 1px; border-top-width: 2px; }
@supports not selector(::-webkit-scrollbar) { * { scrollbar-width: thin; scrollbar-color: var(--border) transparent; } }
