/* TRF portal theme (Tiho, 14.11.2026): the ALPI app's colours and layout
   on the portal's glass. Loaded after style.css and changes only how things
   look: every rule here overrides tokens or surfaces, never what a page does.

   Tiho chose two mockups on 14.11.2026 ("супер е"):
   Light "ALPI светла": a #f4f5f4 page with soft teal and sand light behind
          it, the charcoal ALPI sidebar (#2e2e2e, the active item marked by a
          3px mint bar), a frosted top bar, frosted white cards (72%, blur
          20px), teal #3d8f78 buttons, #276554 links (the mockup's #2f7a65
          gave 3.42:1 where the page light is darkest).
   Dark  "ALPI тъмна": a #151816 page with teal light, a #1d1f1e sidebar,
          frosted dark cards (72%, blur 22px), #4fae92 buttons with dark text,
          #7fd0b4 links, the active segment inverted (light pill, dark text).
   No orange anywhere (Tiho: "не ми харесва оранжевото"). Teal is the action
   colour; green and red stay for status and change; waiting is a muted
   yellow, never orange. Every text pair meets WCAG AA (4.5:1 text, muted
   text and links over the darkest spot of the page light; 3:1 buttons);
   the numbers are in the PR that made this change.
   Headings, card titles, section titles and the logo are Montserrat; text
   is Inter. Both are served from fonts/v1 (style.css).

   The dark blocks are written twice, like style.css: once for the system
   setting (unless the page is forced light) and once for data-theme="dark".
   Edit both copies alike. */

/* ------------------------------------------------------------------ tokens */

:root {
  --bg: #f4f5f4; --surface: rgb(255 255 255 / .72); --surface-solid: #fff; --chrome: rgb(255 255 255 / .6); --float: rgb(255 255 255 / .94);
  --ink: #262626; --ink-2: #3c4240; --ink-3: #565c58;
  --line: rgb(0 0 0 / .08); --line-2: rgb(0 0 0 / .15); --input: rgb(0 0 0 / .12); --field: rgb(255 255 255 / .8); --opt: rgb(255 255 255 / .6);
  --card-line: rgb(255 255 255 / .9);
  --muted: rgb(61 143 120 / .07); --secondary: rgb(0 0 0 / .05); --accent: rgb(61 143 120 / .12); --accent-ink: #2d6b5a;
  --primary: #3d8f78; --primary-hover: #347c68; --primary-ink: #276554; --primary-fg: #fff; --ring: #3d8f78;
  --seg-track: rgb(255 255 255 / .55); --seg-on: #fff; --seg-on-ink: var(--ink);
  --bar: #3d8f78; --pill: var(--primary); --pill-ink: var(--primary-fg);
  --gray-bg: rgb(0 0 0 / .05); --gray-ink: #3c4240;
  --green: #03684c; --red: #b21b1b; /* style.css's #047857 and #c81e1e, a shade darker for AA on the page light */
  --side-bg: #2e2e2e; --side-fg: #d9d9d9; --side-active: #6cc7a8; --side-accent: #3d3d3d;
  --side-hover: #363636; --side-border: rgb(255 255 255 / .08); --side-muted: #a3a3a3; --side-field: #383838;
  --side-count: #38826d; --side-count-ink: #fff;
  --shadow-sm: none; --shadow-md: none;
  --card-shadow: 0 8px 28px rgb(30 60 50 / .08), inset 0 1px 0 rgb(255 255 255 / .8);
  --shadow-lg: 0 18px 40px -12px rgb(20 40 34 / .25), 0 0 0 1px rgb(0 0 0 / .06);
  --radius: 12px; --radius-md: 8px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --glass-blur: blur(20px) saturate(1.4); --chrome-blur: blur(18px);
  /* soft teal and sand light behind the glass, drawn in CSS (nothing to load) */
  --wallpaper:
    radial-gradient(40% 50% at 85% 10%, rgb(61 143 120 / .28), transparent 70%),
    radial-gradient(35% 45% at 30% 90%, rgb(61 143 120 / .18), transparent 70%),
    radial-gradient(30% 35% at 60% 55%, rgb(200 170 110 / .14), transparent 70%),
    #f4f5f4;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #151816; --surface: rgb(32 36 34 / .72); --surface-solid: #202422; --chrome: rgb(20 23 22 / .6); --float: rgb(30 34 32 / .94);
  --ink: #ecefed; --ink-2: #cfd5d2; --ink-3: #a9b2ae;
  --line: rgb(255 255 255 / .09); --line-2: rgb(255 255 255 / .16); --input: rgb(255 255 255 / .12); --field: rgb(0 0 0 / .3); --opt: rgb(255 255 255 / .04);
  --card-line: rgb(255 255 255 / .09);
  --muted: rgb(255 255 255 / .06); --secondary: rgb(255 255 255 / .08); --accent: rgb(108 199 168 / .14); --accent-ink: #8fd9be;
  --primary: #4fae92; --primary-hover: #5dbb9f; --primary-ink: #7fd0b4; --primary-fg: #0c1311; --ring: #7fd0b4;
  --seg-track: rgb(255 255 255 / .05); --seg-on: #ecefed; --seg-on-ink: #151816;
  --bar: #4fae92; --pill: var(--primary); --pill-ink: var(--primary-fg);
  --gray-bg: rgb(255 255 255 / .1); --gray-ink: #cfd5d2;
  --side-bg: #1d1f1e; --side-fg: #cfd3d1; --side-active: #6cc7a8; --side-accent: #2a2d2c;
  --side-hover: #252827; --side-border: rgb(255 255 255 / .06); --side-muted: #8f9894; --side-field: #252827;
  --side-count: #4fae92; --side-count-ink: #0c1311;
  --shadow-sm: none; --shadow-md: none;
  --card-shadow: 0 10px 30px rgb(0 0 0 / .35), inset 0 1px 0 rgb(255 255 255 / .05);
  --shadow-lg: 0 24px 60px -16px rgb(0 0 0 / .65), 0 0 0 1px rgb(255 255 255 / .1);
  --glass-blur: blur(22px) saturate(1.3); --chrome-blur: blur(18px);
  --wallpaper:
    radial-gradient(40% 50% at 85% 5%, rgb(61 143 120 / .35), transparent 70%),
    radial-gradient(35% 45% at 25% 95%, rgb(61 143 120 / .22), transparent 70%),
    radial-gradient(30% 35% at 65% 60%, rgb(190 150 90 / .1), transparent 70%),
    #151816;
  color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151816; --surface: rgb(32 36 34 / .72); --surface-solid: #202422; --chrome: rgb(20 23 22 / .6); --float: rgb(30 34 32 / .94);
  --ink: #ecefed; --ink-2: #cfd5d2; --ink-3: #a9b2ae;
  --line: rgb(255 255 255 / .09); --line-2: rgb(255 255 255 / .16); --input: rgb(255 255 255 / .12); --field: rgb(0 0 0 / .3); --opt: rgb(255 255 255 / .04);
  --card-line: rgb(255 255 255 / .09);
  --muted: rgb(255 255 255 / .06); --secondary: rgb(255 255 255 / .08); --accent: rgb(108 199 168 / .14); --accent-ink: #8fd9be;
  --primary: #4fae92; --primary-hover: #5dbb9f; --primary-ink: #7fd0b4; --primary-fg: #0c1311; --ring: #7fd0b4;
  --seg-track: rgb(255 255 255 / .05); --seg-on: #ecefed; --seg-on-ink: #151816;
  --bar: #4fae92; --pill: var(--primary); --pill-ink: var(--primary-fg);
  --gray-bg: rgb(255 255 255 / .1); --gray-ink: #cfd5d2;
  --side-bg: #1d1f1e; --side-fg: #cfd3d1; --side-active: #6cc7a8; --side-accent: #2a2d2c;
  --side-hover: #252827; --side-border: rgb(255 255 255 / .06); --side-muted: #8f9894; --side-field: #252827;
  --side-count: #4fae92; --side-count-ink: #0c1311;
  --shadow-sm: none; --shadow-md: none;
  --card-shadow: 0 10px 30px rgb(0 0 0 / .35), inset 0 1px 0 rgb(255 255 255 / .05);
  --shadow-lg: 0 24px 60px -16px rgb(0 0 0 / .65), 0 0 0 1px rgb(255 255 255 / .1);
  --glass-blur: blur(22px) saturate(1.3); --chrome-blur: blur(18px);
  --wallpaper:
    radial-gradient(40% 50% at 85% 5%, rgb(61 143 120 / .35), transparent 70%),
    radial-gradient(35% 45% at 25% 95%, rgb(61 143 120 / .22), transparent 70%),
    radial-gradient(30% 35% at 65% 60%, rgb(190 150 90 / .1), transparent 70%),
    #151816;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ surfaces */
/* The page light sits fixed behind everything; cards, the top bar and the
   floating panels are frosted glass over it; the sidebar is solid charcoal. */
body::before { content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none; background: var(--wallpaper); }
body, body:has(> .side:not([hidden])) { background: var(--bg); }
.frame { background: transparent; }
.bar, .btabs { background-color: var(--chrome); -webkit-backdrop-filter: var(--chrome-blur); backdrop-filter: var(--chrome-blur); }
.bar { border-bottom-color: rgb(0 0 0 / .06); }
.btabs { background-color: rgb(255 255 255 / .86); }
.side:not([hidden]) { background-color: var(--side-bg); }
.group, body:not(.running) #main > .q, .kn-page, .proj-row, .status-progress, .machine, .tile, .weeks, .table-wrap, .days, .howto-card, .blocked-line, .smoke-item, .health, .lane-box, .status-list, .hist-list, .client-row {
  background-color: var(--surface); border-color: var(--card-line); box-shadow: var(--card-shadow);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.sheet, .me-menu, .toast, .pal { background: var(--float); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); color: var(--ink); border-color: var(--line-2); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
.group, body:not(.running) #main > .q, .kn-page, .proj-row, .status-progress, .machine, .tile, .weeks, .table-wrap, .days, .howto-card, .blocked-line, .smoke-item, .health, .lane-box, .status-list, .hist-list, .client-row, .sheet, .me-menu, .toast, .pal { background-color: var(--surface-solid); }
.bar, .btabs { background-color: var(--surface-solid); }
}
.opt { background: var(--opt); }
.filters, .tabs { background: var(--seg-track); border: 1px solid var(--line); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.filters button[aria-pressed="true"], .tabs button[aria-current="true"] { background: var(--seg-on); color: var(--seg-on-ink); box-shadow: 0 1px 3px rgb(0 0 0 / .1); }

/* ALPI sidebar: the active item is a lighter row with a mint bar on its left;
   its count is a teal pill. The logo mark is mint. */
.side-nav button[aria-current="true"] { background: var(--side-accent); color: #fff; box-shadow: inset 3px 0 0 var(--side-active); }
.side-nav button[aria-current="true"] .side-count { background: var(--side-count); color: var(--side-count-ink); }
.brand-name { color: #fff; }

/* Project chips on cards: teal tint, like ALPI's badges. */
.chip { background: var(--accent); color: var(--accent-ink); border-radius: 6px; }

/* Montserrat for what names a page, a section or a card; Inter for the rest. */
.page-title, .hello, .card-title, .group-head .card-title, .q-title, .kn-title, .proj-name, .brand-name, .sheet h2 { font-family: var(--display); }
.group-head .card-title, .q-title, .kn-title { letter-spacing: -.005em; }

/* The mockups' shapes: 12px on fields, options, segments and the main buttons. */
textarea, .opt, .act, .new-btn, .filters, .tabs { border-radius: var(--radius); }
.filters button, .tabs button { border-radius: 9px; }
.act.primary { box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 35%, transparent); }
/* On a phone the cards keep the 16px gutter (they bled 4px into it). */
@media (max-width: 520px) { .group { margin-left: 0; margin-right: 0; } }

/* Dark: the same surfaces, darker glass. */
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) body, :root:not([data-theme="light"]) body:has(> .side:not([hidden])) { background: var(--bg); color: var(--ink); }
:root:not([data-theme="light"]) .bar { border-bottom-color: rgb(255 255 255 / .07); }
:root:not([data-theme="light"]) .btabs { background-color: rgb(20 23 22 / .88); } /* small labels: less of the page shows through */
:root:not([data-theme="light"]) .side:not([hidden]) { border-right: 1px solid var(--side-border); }
:root:not([data-theme="light"]) .pal-item[aria-selected="true"] kbd { background: rgb(255 255 255 / .1); }
:root:not([data-theme="light"]) .project select option, :root:not([data-theme="light"]) .side .project select option { background: var(--surface-solid); color: var(--ink); }
:root:not([data-theme="light"]) .mc-status { background: rgb(255 255 255 / .05); }
}
:root[data-theme="dark"] body, :root[data-theme="dark"] body:has(> .side:not([hidden])) { background: var(--bg); color: var(--ink); }
:root[data-theme="dark"] .bar { border-bottom-color: rgb(255 255 255 / .07); }
:root[data-theme="dark"] .btabs { background-color: rgb(20 23 22 / .88); } /* small labels: less of the page shows through */
:root[data-theme="dark"] .side:not([hidden]) { border-right: 1px solid var(--side-border); }
:root[data-theme="dark"] .pal-item[aria-selected="true"] kbd { background: rgb(255 255 255 / .1); }
:root[data-theme="dark"] .project select option, :root[data-theme="dark"] .side .project select option { background: var(--surface-solid); color: var(--ink); }
:root[data-theme="dark"] .mc-status { background: rgb(255 255 255 / .05); }

/* ------------------------------------------------------------------ type */
/* Few sizes, clear weights: page titles stay; every small label over a number
   is the same uppercase, spaced line; times and counters in lists are mono. */
.section-label, .side-label, .dash-k, .mc-tok .k, .mc-money .k, .mc-sec-h h3, .pal-group {
  font: 600 10.5px/1.4 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3);
}
.side-label { color: var(--side-muted); }
.dash-v, .mc-tok .v, .mc-money .v { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.mc-time, .mc-signal, .mc-meta, .side-foot, .dash-total b, .card-meta .age { font-family: var(--mono); font-size: 12px; letter-spacing: 0; }
.mc-time { font-size: 12.5px; }
kbd {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px;
  font: 500 11px/1 var(--mono); color: var(--ink-3); background: var(--muted); border: 1px solid var(--line);
}

/* ------------------------------------------------------------------ one card style */
/* Same radius, one 1px border and one shadow wherever a card sits. */
.group:hover, .proj-row:hover { border-color: var(--line-2); }
.machine, .dash-row, .acct, .mc-row { border-radius: var(--radius); }

/* ------------------------------------------------------------------ actions */
/* One filled primary per screen, the rest quiet outlines; the primary lifts
   a little under the pointer. */
.new-btn, .act.primary, .fab, .dash .open {
  transition: background-color .15s, transform .15s ease, box-shadow .15s ease, filter .15s;
}
.new-btn:hover, .act.primary:hover, .fab:hover {
  transform: translateY(-1px); filter: brightness(1.05);
  box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--primary) 70%, transparent);
}
.new-btn:active, .act.primary:active { transform: translateY(0); filter: none; box-shadow: none; }
.act:not(.primary) { background: transparent; }
@media (prefers-reduced-motion: reduce) { .new-btn:hover, .act.primary:hover, .fab:hover { transform: none; } }

/* ------------------------------------------------------------------ sidebar groups */
.side-nav { gap: 0; }
.side-group { margin-top: 14px; padding-top: 12px; }
.side-group.first { margin-top: 0; padding-top: 0; border-top: 0; }
.side-group .side-label { margin: 2px 0 6px; }

/* ------------------------------------------------------------------ ⌘K */
.cmdk-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 10px; margin-right: 4px;
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--field); color: var(--ink-3);
  font-size: 13px; cursor: pointer; transition: border-color .15s, color .15s;
}
.cmdk-btn:hover { border-color: var(--line-2); color: var(--ink); }
.cmdk-btn .cmdk-text { min-width: 7em; text-align: left; }
.cmdk-btn[hidden] { display: none; }
@media (max-width: 760px) {
  .cmdk-btn { width: 36px; padding: 0; justify-content: center; }
  .cmdk-btn .cmdk-text, .cmdk-btn kbd { display: none; }
}

body.pal-open { overflow: hidden; }
.pal-wrap {
  position: fixed; inset: 0; z-index: 40; display: grid; justify-items: center; align-items: start; padding: 12vh 16px 16px;
  background: rgb(8 14 12 / .4); animation: fade .12s ease-out;
}
.pal {
  width: min(580px, 100%); border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface-solid, var(--surface));
  box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .14s ease-out;
}
.pal-search { display: flex; align-items: center; gap: 10px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); }
.pal-icon { flex: none; color: var(--ink-3); }
.pal-search input {
  flex: 1; min-width: 0; height: 54px; border: 0; background: transparent; outline: none; font-size: 16px; color: var(--ink);
}
.pal-search input::placeholder { color: var(--ink-3); }
.pal-list { list-style: none; margin: 0; padding: 6px; max-height: min(52vh, 420px); overflow-y: auto; }
.pal-group { padding: 10px 10px 4px; }
.pal-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: 8px;
  cursor: pointer; font-size: 14px; color: var(--ink-2);
}
.pal-item[aria-selected="true"] { background: var(--accent); color: var(--ink); }
.pal-item[aria-selected="true"] kbd { color: var(--accent-ink); border-color: transparent; background: rgb(255 255 255 / .12); }
.pal-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-empty { padding: 18px 12px; color: var(--ink-3); font-size: 13.5px; }
.pal-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
.pal-foot kbd { margin-right: 2px; }
@media (max-width: 520px) {
  .pal-wrap { padding-top: 10px; }
  .pal-foot span:last-child { display: none; }
}
.pal-icon { display: grid; }

/* „Машини“: its buttons were the browser's own grey; now quiet outlines like
   every secondary action, the dangerous one stays red. */
.machine button:not(.danger):not([role="tab"]), .machine select, .acct-add input {
  border: 1px solid var(--line-2); background: transparent; color: var(--ink); border-radius: var(--radius-md);
  padding: 6px 12px; min-height: 34px; cursor: pointer; transition: border-color .15s, background-color .15s;
}
.machine select { padding-right: 8px; background: var(--field); }
.machine button:not(.danger):hover:not(:disabled) { border-color: var(--primary); background: var(--muted); }
.machine button.small { min-height: 30px; padding: 3px 10px; }
.machine button.danger { border: 1px solid transparent; border-radius: var(--radius-md); padding: 6px 12px; min-height: 34px; cursor: pointer; }
.machine button.danger-text:not(.danger):not([role="tab"]) { color: var(--red); }
.machine button:disabled { opacity: .5; cursor: default; }
