/* Vektor – design-järjestelmä (ks. docs/DESIGN.md)
 *
 * Suunta: kehittäjän pääte iltaisin. Musteen tummat, lähes harmaat pinnat; monospace kaikelle, minkä voi
 * kirjoittaa päätteeseen; yksi kursorin hehkuoranssi aksentti (pääpainike, valinta, CLI-kehotteen $).
 * Tarkka ja vähäpuheinen: pienet säteet, ohuet viivat, ei varjoja tummassa teemassa, ei koristetaustoja.
 * Tunnusmerkki: jokaisen toiminnon vieressä sitä vastaava `vektor`-komento (.cli), klikkaus kopioi.
 *
 * Kaikki arvot ovat tokeneita. Teema vaihtaa vain tokenit: oletus seuraa käyttöjärjestelmää,
 * [data-theme="light|dark"] pakottaa. */

@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("Inter-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("Inter-500.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("Inter-600.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url("JetBrainsMono-400.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 700; font-display: swap; src: url("JetBrainsMono-700.woff2") format("woff2"); }

:root {
  color-scheme: light;
  /* Muste (vaalea): neutraalit hyvin matalalla kromalla sävyyn 260 */
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --surface-3: #e4e8ee;
  --field: #ffffff;
  /* Lomakekentän reuna: vähintään 3:1 taustaa, pintaa ja kenttää vasten (WCAG 1.4.11). */
  --field-border: #7c8391;
  --text: #111827;
  --text-muted: #4b5565;
  --text-subtle: #5f687c;
  --border: color-mix(in oklch, var(--text) 9%, transparent);
  --border-strong: color-mix(in oklch, var(--text) 18%, transparent);
  /* Aksentti: kursorin hehku. Tumma teksti päällä (kontrasti > 7:1). */
  --accent: oklch(0.7 0.17 52);
  --accent-hover: oklch(0.66 0.17 50);
  --accent-fg: #1a1206;
  --accent-text: oklch(0.52 0.15 45);
  --accent-soft: oklch(0.95 0.035 60);
  /* Tilat – vain tilan merkitsemiseen */
  --success: oklch(0.55 0.13 155);
  --success-soft: oklch(0.95 0.035 155);
  --warning: oklch(0.6 0.13 85);
  --warning-soft: oklch(0.96 0.05 90);
  --danger: oklch(0.53 0.19 25);
  --danger-soft: oklch(0.96 0.03 25);
  /* Pääte (lokit) – tumma molemmissa teemoissa */
  --term-bg: #0b0d14;
  --term-fg: #e4e7ee;
  --term-muted: #7a8296;
  --term-err: oklch(0.75 0.14 25);

  --shadow-float: 0 8px 24px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.06);
  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--text-subtle);

  /* Välit (4 px:n askel), säteet (tarkka, tekninen: pienet), typografia */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px;
  --r-sm: 4px; --r-md: 6px; --r-lg: 10px; --r-full: 999px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  --text-xs: 12px; --text-sm: 13px; --text-md: 14px; --text-lg: 16px; --text-xl: 20px; --text-2xl: 28px;

  /* Liike: yksi käyrä, lyhyet kestot */
  --dur-fast: 120ms; --dur: 180ms; --dur-slow: 240ms; --dur-exit: 140ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.6, 0, 0.3, 1);
}

/* Tumma teema (muste): sama lohko sekä käyttöjärjestelmän asetukselle että pakotetulle valinnalle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0d14; --surface: #11141c; --surface-2: #171b25; --surface-3: #1f2430; --field: #1a1e28; --field-border: #6b7283;
    --text: #eef0f5; --text-muted: #a3a9b8; --text-subtle: #7f879b;
    --accent: oklch(0.74 0.16 55); --accent-hover: oklch(0.79 0.14 58); --accent-fg: #1a1206;
    --accent-text: oklch(0.8 0.13 58); --accent-soft: oklch(0.28 0.05 55);
    --success: oklch(0.74 0.14 155); --success-soft: oklch(0.27 0.045 155);
    --warning: oklch(0.84 0.13 92); --warning-soft: oklch(0.29 0.05 92);
    --danger: oklch(0.7 0.16 25); --danger-soft: oklch(0.28 0.06 25);
    --term-bg: #07080d;
    --shadow-float: 0 12px 32px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d14; --surface: #11141c; --surface-2: #171b25; --surface-3: #1f2430; --field: #1a1e28; --field-border: #6b7283;
  --text: #eef0f5; --text-muted: #a3a9b8; --text-subtle: #7f879b;
  --accent: oklch(0.74 0.16 55); --accent-hover: oklch(0.79 0.14 58); --accent-fg: #1a1206;
  --accent-text: oklch(0.8 0.13 58); --accent-soft: oklch(0.28 0.05 55);
  --success: oklch(0.74 0.14 155); --success-soft: oklch(0.27 0.045 155);
  --warning: oklch(0.84 0.13 92); --warning-soft: oklch(0.29 0.05 92);
  --danger: oklch(0.7 0.16 25); --danger-soft: oklch(0.28 0.06 25);
  --term-bg: #07080d;
  --shadow-float: 0 12px 32px rgba(0, 0, 0, 0.5);
}

/* --- Perusta ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
/* hidden-attribuutti voittaa aina komponenttien display-säännöt (esim. .stream-field { display: grid }). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 400 var(--text-md)/1.55 var(--font); -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11"; /* Interin suora 1 */
}
/* Tasalevyiset numerot vain numeroille (CPU, ajat, taulukot). Koko sivulle asetettuna Inter leventää myös
   tavuviivan, jolloin nimet kuten "lunch-rota" näyttävät väljiltä. */
.data-table, .kv, .facts dd, .meta, .tile-meta, .stat-value, .usage-amount, time, td, .eyebrow { font-variant-numeric: tabular-nums; }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; font-weight: 500; }
h1 { font-size: var(--text-xl); letter-spacing: -0.01em; }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); }
p { margin: 0; text-wrap: pretty; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code, kbd, .mono { font-family: var(--mono); font-size: 0.9em; }
code { background: var(--surface-2); padding: 0.1em 0.35em; border-radius: var(--r-sm); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); font-size: var(--text-sm); }
.stack > * + * { margin-top: var(--s-3); }
.stack-lg > * + * { margin-top: var(--s-6); }
.row { display: flex; gap: var(--s-2); align-items: center; }
.spacer { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Kirjautumis- ja tilasivut ---------------------------------------------------- */
.auth { display: grid; place-items: center; padding: var(--s-6) var(--s-4); }
.auth-card { width: min(380px, 100%); }
.auth-card .brand { margin-bottom: var(--s-10); }
.auth-card h1 { font-size: var(--text-2xl); letter-spacing: -0.01em; margin-bottom: var(--s-2); }
.auth-card .lead { color: var(--text-muted); margin-bottom: var(--s-6); }
.auth-foot { margin-top: var(--s-6); font-size: var(--text-sm); color: var(--text-muted); }
.auth-foot .cli { margin-left: calc(-1 * var(--s-2)); }
.auth-legal { margin-top: var(--s-4); font-size: var(--text-xs); color: var(--text-subtle); }
.auth-legal a { color: inherit; }

/* --- Lakisivut (/legal/*) --- */
.legal-main { gap: var(--s-8); max-width: 720px; }
.legal-section { display: grid; gap: var(--s-3); scroll-margin-top: 80px; }
.legal-section h2 { font-size: var(--text-lg); margin: 0; }
.legal-section p, .legal-section li { color: var(--text-muted); line-height: 1.65; margin: 0; }
.legal-section ul { margin: 0; padding-left: var(--s-5); display: grid; gap: var(--s-2); }
.legal-section strong { color: var(--text); font-weight: 500; }
.legal-table { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
.legal-table table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--border); }
.legal-table th { font-weight: 500; color: var(--text); background: var(--surface-2); }
.legal-table td { color: var(--text-muted); font-variant-numeric: normal; }
.legal-table tr:last-child td { border-bottom: 0; }
.invite summary { cursor: pointer; font-size: var(--text-sm); color: var(--text-muted); padding: var(--s-1) 0; }
.invite summary:hover { color: var(--text); }
.invite[open] summary { margin-bottom: var(--s-3); }
.input.mono { font-family: var(--mono); letter-spacing: 0.04em; text-transform: uppercase; }
.input.mono::placeholder { text-transform: none; }
.code-display {
  font: 700 26px/1 var(--mono); letter-spacing: 0.08em; text-align: center;
  padding: var(--s-4); background: var(--surface-2); border-radius: var(--r-md); margin: var(--s-3) 0 var(--s-4);
}

/* --- Brändi (docs/brand/BRAND.md): merkki tekstin värillä + sanamerkki pienellä -------------
   Oranssi on varattu päätoiminnolle, joten logo ei kilpaile sen kanssa. Merkin laatikossa on oma
   sisäreunansa (5/32), joten väli sanamerkkiin on pienempi kuin tavallinen ikonin väli. */
.brand { display: inline-flex; align-items: center; gap: 5px; color: var(--text); font-weight: 600; font-size: 17px; letter-spacing: -0.025em; line-height: 1; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; color: var(--accent); }
.brand-mark svg { width: 22px; height: 22px; }
.brand-word { transform: translateY(-0.5px); }

/* --- Sovelluskehys: yläpalkki + sisältö ----------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: var(--s-3);
  height: 52px; padding: 0 var(--s-5); background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: var(--s-2); min-width: 0; font-size: var(--text-sm); }
.crumbs .sep { color: var(--text-subtle); }
.crumbs .crumb { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .crumb a { color: inherit; }
.crumbs .crumb.current { color: var(--text); }
.topbar .user { font-size: var(--text-sm); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32ch; }
.container { width: min(1120px, 100%); margin: 0 auto; padding: var(--s-10) var(--s-5) var(--s-12); }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); margin-bottom: var(--s-8); }
.page-head h1 { font-size: var(--text-2xl); letter-spacing: -0.01em; }
.page-head .actions { margin-left: auto; display: flex; gap: var(--s-2); flex-wrap: wrap; }
.page-meta { flex-basis: 100%; font: 400 var(--text-sm)/1.5 var(--mono); color: var(--text-muted); }
.page-meta:empty { display: none; }
.grid { display: grid; gap: var(--s-4); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 860px) { .grid-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .container { padding: var(--s-6) var(--s-4) var(--s-10); }
  .topbar { padding: 0 var(--s-4); }
  .topbar .user { display: none; }
  .page-head { margin-bottom: var(--s-6); }
  .page-head .actions { margin-left: 0; width: 100%; order: 2; }
  .page-meta { order: 1; }
  .input, .select, .textarea { font-size: 16px; }
}
/* Kapealla näytöllä murupolku vie tilaa ja katkeaa – otsikko kertoo jo, missä ollaan. */
@media (max-width: 520px) { .topbar .crumbs { display: none; } }

/* --- Näkymävälilehdet (sovelluspaneeli). Ilman JS:ää kaikki osiot näkyvät allekkain. ---- */
.tabs { display: flex; gap: var(--s-5); margin: calc(-1 * var(--s-4)) 0 var(--s-6); border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs a { position: relative; padding: var(--s-2) 0 var(--s-3); color: var(--text-muted); font-size: var(--text-md); white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--text); }
.tabs a[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--text); }
[data-view-current] [data-view] { display: none; }
[data-view-current="overview"] [data-view="overview"], [data-view-current="settings"] [data-view="settings"], [data-view-current="access"] [data-view="access"] { display: block; }
[data-view-current="settings"] .settings-layout { display: grid; }

/* --- Julkaisudialogi: agentti --- */
.deploy-agent { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer; }
.deploy-agent input { margin-top: 3px; accent-color: var(--accent); }
.deploy-agent > span { display: grid; gap: 2px; font-size: var(--text-sm); }
.deploy-agent .subtle { font-size: var(--text-xs); line-height: 1.5; }

/* --- Tasot (/plans) --- */
.plan-usage { margin: 0 0 var(--s-2); color: var(--text-muted); font-size: var(--text-sm); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s-4); margin: var(--s-6) 0; }
.plan-card { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-6); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.plan-card.is-highlight { border-color: color-mix(in oklch, var(--accent) 55%, var(--border)); box-shadow: 0 0 0 1px color-mix(in oklch, var(--accent) 25%, transparent); }
.plan-card h2 { margin: 0; font-size: var(--text-lg); }
.plan-price { margin: 0; }
.plan-price strong { font-size: var(--text-2xl); letter-spacing: -0.01em; }
.plan-card p { margin: 0; }
.plan-card ul { margin: var(--s-2) 0; padding-left: 1.1em; display: grid; gap: var(--s-1); font-size: var(--text-sm); flex: 1; }
.plan-foot { margin-top: auto; min-height: 34px; display: flex; align-items: center; }
.plan-current { font-size: var(--text-sm); color: var(--success); font-weight: 500; }
.plan-addon { margin-bottom: var(--s-4); }
.upgrade-link { color: var(--accent-text, var(--accent)); text-decoration: none; font-weight: 500; }
.upgrade-link:hover { text-decoration: underline; }

/* --- Ohjeet (/docs) --- */
.guide-code { margin: var(--s-3) 0; padding: var(--s-4); border-radius: var(--r-md); background: var(--term-bg, var(--surface-2)); color: var(--term-fg, var(--text)); font: 400 var(--text-sm)/1.6 var(--mono); overflow-x: auto; white-space: pre; }
.guides .docs-nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.guide-next { margin-top: var(--s-8); font-weight: 500; }

/* --- Juuri julkaistu --- */
.live-hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-5); padding: var(--s-6);
  border-color: color-mix(in oklch, var(--success) 40%, var(--border)); background: color-mix(in oklch, var(--success) 6%, var(--surface)); }
.live-hero-text { display: grid; gap: var(--s-2); max-width: 52ch; }
.live-hero h2 { margin: 0; font-size: var(--text-xl); }
.live-hero p { margin: 0; }
.live-badge { display: inline-flex; align-items: center; gap: 6px; align-self: start; font: 500 var(--text-xs) var(--font); color: var(--success); text-transform: uppercase; letter-spacing: .06em; }
.live-badge .live-dot { width: 7px; height: 7px; }
.live-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.live-hero-actions .copy-field { display: inline-flex; gap: var(--s-1); }
.live-hero-actions .copy-field .input { width: 240px; font: 400 var(--text-sm) var(--mono); }
.fr-card.dropzone { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; text-align: left; place-items: start; }

/* --- Ensimmäinen sovellus: kolme tapaa --- */
.fr-head { display: grid; gap: var(--s-2); margin-bottom: var(--s-6); }
.fr-head .lead { margin: 0; color: var(--text-muted); }
.fr-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s-4); align-items: stretch; }
.fr-card { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-6); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); text-align: left; }
.fr-card h3 { margin: 0; font-size: var(--text-lg); }
.fr-card p { margin: 0; }
.fr-card.dropzone { align-items: flex-start; justify-content: flex-start; border-style: dashed; cursor: pointer; }
.fr-card .dz-actions { margin-top: auto; }
.fr-paste { border-color: color-mix(in oklch, var(--accent) 45%, var(--border)); }
.fr-paste .textarea { min-height: 120px; font-size: var(--text-xs); }
.fr-kicker { align-self: flex-start; font: 500 var(--text-xs) var(--font); color: var(--accent-text, var(--accent)); text-transform: uppercase; letter-spacing: .06em; }
.fr-templates { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-1); flex: 1; }
.fr-templates a { display: grid; gap: 1px; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); color: inherit; text-decoration: none; }
.fr-templates a:hover { background: var(--surface-2); }
.fr-templates .subtle { font-size: var(--text-sm); }
.first-run-alt { margin-top: var(--s-8); }

/* --- Kuukausiraportti --- */
#report-form { display: grid; gap: var(--s-2); }
#report-form .switch { display: flex; align-items: center; gap: var(--s-2); }
#report-form label.mini { margin-top: var(--s-2); }
.report-preview { margin: var(--s-3) 0 0; padding: var(--s-4); background: var(--surface-2); border-radius: var(--r-md); font: 400 var(--text-xs)/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* --- Tietoluokitus --- */
#details-form label.mini:not(:first-child) { margin-top: var(--s-2); }
.tag-class.is-confidential { color: var(--warning); border-color: color-mix(in oklch, var(--warning) 40%, transparent); }
.tag-class.is-restricted { color: var(--danger); border-color: color-mix(in oklch, var(--danger) 45%, transparent); }
.classification-form { border-top: 1px solid var(--border); }

/* --- Luotettavuus --- */
.sla-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s-5); align-items: start; }
.sla-top > div, .sla-target { display: grid; gap: var(--s-1); }
.sla-big { font-size: var(--text-2xl); font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.sla-budget .meter { margin-top: 0; height: 6px; }
.sla-org-actions { display: inline-flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.sla-org-actions .select { width: auto; }

/* --- Kustannusten kohdistus --- */
.costs-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2); }
.costs-bar .seg { display: inline-flex; gap: var(--s-1); }
.costs-bar .seg [aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.costs-tables { display: grid; gap: var(--s-5); }
.costs-wrap { overflow-x: auto; }
.costs-wrap td:nth-child(2).costs-center, .costs-wrap th.costs-center { text-align: left; }

/* --- Salausavaimet (BYOK) --- */
.byok-status { display: grid; gap: var(--s-2); }
.byok-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

/* --- Istunnon päättymisvaroitus --- */
.session-warn { position: fixed; right: var(--s-6); bottom: var(--s-6); z-index: 60; width: min(380px, calc(100vw - 32px)); display: grid; gap: var(--s-3);
  padding: var(--s-5); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-float); }
.session-warn[hidden] { display: none; }
.session-warn h2 { margin: 0; font-size: var(--text-md); }
.session-warn p { margin: 0; color: var(--text-muted); font-size: var(--text-sm); }
.session-warn .time { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.session-warn .actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
@media (max-width: 640px) { .session-warn { right: 16px; left: 16px; bottom: 16px; width: auto; } }

/* --- Sovelluksen asetukset: ryhmät ja sivuvalikko --- */
.settings-layout { gap: var(--s-6); grid-template-columns: minmax(0, 1fr); align-items: start; }
.settings-main { display: grid; gap: var(--s-8); min-width: 0; }
.settings-group { display: grid; gap: var(--s-5); }
.settings-group-title { margin: 0; font-size: var(--text-sm); font-weight: 500; color: var(--text-muted); letter-spacing: 0; padding-bottom: var(--s-2); border-bottom: 1px solid var(--border); }
.settings-main .card { scroll-margin-top: var(--s-6); }
.settings-nav { display: flex; gap: var(--s-1); overflow-x: auto; max-width: 100%; padding-bottom: var(--s-1); scrollbar-width: thin; }
.settings-nav-group { display: contents; }
.settings-nav-title { display: none; }
.settings-nav ul { display: contents; list-style: none; margin: 0; padding: 0; }
.settings-nav a { display: block; white-space: nowrap; padding: 6px 10px; border-radius: var(--radius-sm, 6px); color: var(--text-muted); text-decoration: none; font-size: var(--text-sm); border: 1px solid var(--border); }
.settings-nav a:hover { color: var(--text); background: var(--surface-2, var(--surface)); }
.settings-nav a[aria-current="true"] { color: var(--text); border-color: var(--border-strong, var(--border)); background: var(--surface); }
@media (min-width: 1180px) {
  .settings-layout { grid-template-columns: 184px minmax(0, 1fr); gap: var(--s-8); }
  .settings-nav { position: sticky; top: var(--s-6); flex-direction: column; gap: var(--s-5); overflow: visible; padding: 0; }
  .settings-nav-group { display: grid; gap: 2px; }
  .settings-nav-title { display: block; font-size: var(--text-xs, 12px); color: var(--text-subtle, var(--text-muted)); text-transform: uppercase; letter-spacing: .06em; padding: 0 10px var(--s-1); }
  .settings-nav ul { display: grid; gap: 2px; }
  .settings-nav a { border: 0; padding: 5px 10px; }
  .settings-nav a[aria-current="true"] { background: var(--surface); box-shadow: inset 2px 0 0 var(--accent); }
}

/* --- Kortti: yksi syvyysvihje (hiusviiva), ei varjoa ------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); min-width: 0; }
.card-body { padding: var(--s-5); }
.card-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2) var(--s-3); padding: var(--s-4) var(--s-5) var(--s-2); min-height: 52px; }
.card-head + .card-body { padding-top: var(--s-2); }
.card-head h2 { font-size: var(--text-lg); font-weight: 500; }
.card-head .hint { font-size: var(--text-sm); color: var(--text-muted); }
.card-head .cli { margin-left: auto; }
.section-title { font-size: var(--text-sm); color: var(--text-muted); margin: var(--s-5) 0 var(--s-2); }

/* --- Tunnusmerkki: vastaava CLI-komento. Klikkaus kopioi (vektor.js). ------------------ */
.cli { display: inline-flex; align-items: center; gap: 0.5ch; max-width: 100%; min-height: 26px; padding: 2px var(--s-2); border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text-subtle); font: 400 var(--text-xs)/1.6 var(--mono); cursor: copy; white-space: normal; overflow-wrap: anywhere; text-align: left;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out); }
.cli::before { content: "$"; color: var(--accent-text); }
.cli:hover { color: var(--text); background: var(--surface-2); }
.cli.is-copied { color: var(--success); }
.cli.is-copied::before { content: "✓"; color: var(--success); }

/* --- Napit: 6 px kulma, painallus skaalaa 0.97 ------------------------------------------ */
.btn {
  --btn-bg: var(--surface-2); --btn-fg: var(--text); --btn-border: var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 34px; padding: 0 var(--s-3); border-radius: var(--r-md); border: 1px solid var(--btn-border);
  background: var(--btn-bg); color: var(--btn-fg); font: 500 var(--text-sm)/1 var(--font); cursor: pointer;
  text-decoration: none; white-space: nowrap; position: relative;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.btn::after { content: ""; position: absolute; inset: -4px; } /* kosketusalue näkyvää suurempi */
.btn:hover { text-decoration: none; background: var(--surface-3); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { --btn-bg: var(--accent); --btn-fg: var(--accent-fg); --btn-border: transparent; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { --btn-fg: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-block { width: 100%; min-height: 42px; font-size: var(--text-md); }
.btn-sm { min-height: 28px; padding: 0 var(--s-2); font-size: var(--text-xs); }
.btn-icon { width: 34px; padding: 0; }
.btn-sm.btn-icon { width: 28px; }
.btn svg { width: 16px; height: 16px; flex: none; }

/* --- Lomakkeet ---------------------------------------------------------------- */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: var(--s-4); }
label, .label { font-size: var(--text-sm); font-weight: 500; color: var(--text); }
.input, .select {
  width: 100%; min-height: 34px; padding: 0 var(--s-3); border-radius: var(--r-md);
  border: 1px solid var(--field-border); background: var(--field); color: var(--text);
  font: 400 var(--text-md) var(--font); transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input::placeholder { color: var(--text-subtle); }
.input:hover, .select:hover { border-color: var(--text-subtle); }
.input:focus, .select:focus { outline: none; border-color: var(--text-muted); box-shadow: 0 0 0 3px color-mix(in oklch, var(--text) 12%, transparent); }
.input[readonly] { background: var(--surface-2); font-family: var(--mono); font-size: var(--text-sm); }
.input.mono { font-family: var(--mono); font-size: var(--text-sm); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.select { appearance: none; padding-right: var(--s-8); cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.field-error { font-size: var(--text-xs); color: var(--danger); min-height: 1em; }
.field-error:empty { min-height: 0; }
.inline-form { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.inline-form .input { flex: 1 1 220px; }
.inline-form .select { flex: 0 0 auto; width: auto; }
.copy-field { display: flex; gap: var(--s-2); }
.copy-field .input { flex: 1; min-width: 0; }

/* --- Merkit ja tila: tekstiä, ei pillereitä ---------------------------------------------- */
/* Taso, rooli, laskuri: hiljainen mono-teksti. */
.badge { display: inline-flex; align-items: center; gap: var(--s-1); font: 400 var(--text-xs)/1.4 var(--mono); color: var(--text-muted); white-space: nowrap; }
.badge-accent { color: var(--text); }
.badge-success { color: var(--success); }
.badge-danger { color: var(--danger); }
/* Tila: piste + teksti. Väri vain pisteessä (ja virheessä tekstissä). */
.status { --dot: var(--text-subtle); display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--text-sm); color: var(--text-muted); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot); flex: none; }
.status.is-running { --dot: var(--success); color: var(--text); }
.status.is-stopped { --dot: var(--text-subtle); }
.status.is-warning { --dot: var(--warning); color: var(--text); }
.status.is-down { --dot: var(--danger); color: var(--danger); }
/* Sykkii vain, kun jokin todella on live (lokivirta auki) */
.status.is-live::before { animation: pulse 2s var(--ease-in-out) infinite; }
.status.is-loading::before { opacity: 0.4; }

/* --- Elintoiminnot: CPU, muisti, prosessit yhdessä rivissä ---------------------------------- */
.vitals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.vitals .stat + .stat { border-left: 1px solid var(--border); }
.stat { padding: var(--s-4) var(--s-5); display: grid; gap: 2px; align-content: start; min-width: 0; }
.stat .label { font-size: var(--text-sm); font-weight: 400; color: var(--text-muted); }
.stat .value { font: 400 var(--text-xl)/1.3 var(--mono); letter-spacing: -0.01em; }
.stat .value small { font-size: var(--text-sm); color: var(--text-muted); letter-spacing: 0; }
.stat .sub { font-size: var(--text-xs); color: var(--text-subtle); overflow-wrap: anywhere; }
.meter { height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin-top: var(--s-2); }
.meter > i { display: block; height: 100%; width: 0; background: var(--text-subtle); border-radius: inherit; transition: width var(--dur-slow) var(--ease-out); }
.meter.is-high > i { background: var(--warning); }
@media (max-width: 520px) {
  .stat { padding: var(--s-3) var(--s-4); }
  .stat .value { font-size: 18px; }
  .vitals .stat .sub { line-height: 1.35; }
}

/* --- Listat: välit ryhmittelevät, ei viivoja rivien välissä ------------------------------- */
.list { list-style: none; margin: 0; padding: 0 0 var(--s-2); }
.list-item { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-5); min-height: 44px; }
.list-item .who { min-width: 0; flex: 1; }
.list-item .email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item.is-pending { opacity: 0.55; }
.list-item.is-leaving { opacity: 0; transform: translateX(8px); transition: opacity var(--dur-exit) var(--ease-out), transform var(--dur-exit) var(--ease-out); }
.list-item.is-new { animation: enter var(--dur) var(--ease-out) both; }
.empty { padding: var(--s-5); color: var(--text-muted); font-size: var(--text-sm); }
li.empty { list-style: none; }

/* --- Ilmoitukset (toast) ---------------------------------------------------------- */
.toasts { position: fixed; z-index: 50; right: var(--s-4); bottom: max(var(--s-4), env(safe-area-inset-bottom)); display: grid; gap: var(--s-2); width: min(360px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-float); font-size: var(--text-sm);
  animation: toast-in var(--dur) var(--ease-out) both; }
.toast.is-error { background: var(--danger); color: #fff; }
.toast.is-leaving { animation: toast-out var(--dur-exit) var(--ease-out) both; }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; font: 500 var(--text-sm) var(--font); cursor: pointer; text-decoration: underline; padding: var(--s-1); }

/* --- Ilmoituslaatikko --------------------------------------------------------------- */
.callout { display: flex; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); font-size: var(--text-sm); background: var(--surface-2); color: var(--text-muted); }
.callout.is-error { background: var(--danger-soft); color: var(--danger); }
.callout.is-success { background: var(--success-soft); color: var(--success); }

/* --- Latauspaikat (varaavat tilan valmiiksi) ---------------------------------------------- */
.skeleton { display: inline-block; height: 0.9em; width: 6ch; border-radius: var(--r-sm); background: var(--surface-3); animation: pulse 1.4s var(--ease-in-out) infinite; vertical-align: middle; }

/* --- Lokinäkymä --------------------------------------------------------------------- */
.log-shell { display: flex; flex-direction: column; height: 100vh; }
.log-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); padding: var(--s-2) var(--s-5); border-bottom: 1px solid var(--border); background: var(--bg); font-size: var(--text-sm); min-height: 48px; }
.log-toolbar .metrics { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-5); color: var(--text-muted); }
.log-toolbar .metrics b { color: var(--text); font: 400 var(--text-sm) var(--mono); }
.log-toolbar .controls { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }
.switch { display: inline-flex; align-items: center; gap: var(--s-2); cursor: pointer; user-select: none; color: var(--text-muted); font-weight: 400; }
.switch input { accent-color: var(--accent); width: 15px; height: 15px; }
.log { flex: 1; margin: 0; overflow: auto; background: var(--term-bg); color: var(--term-fg);
  padding: var(--s-3) var(--s-5) var(--s-8); font: 12.5px/1.65 var(--mono); white-space: pre-wrap; word-break: break-word; }
.log .ln { display: flex; gap: var(--s-4); } /* ei animaatiota riveille: käytetään jatkuvasti */
.log .ts { color: var(--term-muted); flex: none; }
.log .stderr { color: var(--term-err); }
.log .status-line { color: var(--term-muted); }
/* Lokin häntä sovelluspaneelissa: pääte kortin sisällä, reunasta reunaan */
.log-card { overflow: hidden; }
.log-card .log { height: 340px; flex: none; border-top: 1px solid var(--border); padding: var(--s-3) var(--s-5); }
.log-card .log:empty::before { content: "Odotetaan lokirivejä…"; color: var(--term-muted); }

/* --- Dashboard ------------------------------------------------------------------------ */
.org-section + .org-section { margin-top: var(--s-10); }
.org-section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-1) var(--s-3); margin-bottom: var(--s-3); }
.org-section-head h2 { font-size: var(--text-lg); font-weight: 500; }
.org-section-head .badge { font-size: var(--text-xs); }
.org-section-head > a { margin-left: auto; font-size: var(--text-sm); color: var(--text-muted); }
.org-section-head > a:hover { color: var(--text); }
.app-rows { padding: var(--s-2) 0; }
.app-row { display: grid; grid-template-columns: minmax(0, 1fr) 190px 150px auto; align-items: center; gap: var(--s-4); padding: var(--s-2) var(--s-5); min-height: 48px; }
.app-row:hover { background: var(--surface-2); }
.app-row .app-name { font-weight: 500; }
.app-row .app-data { font: 400 var(--text-sm) var(--mono); color: var(--text-muted); text-align: right; }
.app-row .app-data.is-locked { color: var(--danger); }
.app-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-name:hover { text-decoration: none; color: var(--accent-text); }
@media (max-width: 760px) {
  .app-row { grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-1) var(--s-3); padding: var(--s-3) var(--s-4); }
  .app-row .app-data { grid-column: 1; text-align: left; }
  .app-row .status { grid-column: 2; grid-row: 1; justify-self: end; }
  .app-row > .btn { grid-column: 2; grid-row: 2; justify-self: end; }
}
.empty-org { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); padding: var(--s-4) var(--s-5); color: var(--text-muted); font-size: var(--text-sm); }
.empty-org .cli { font-size: var(--text-sm); }
.select-sm { min-height: 28px; width: auto; font-size: var(--text-sm); padding-left: var(--s-2); }
.list-item.is-invite .email { color: var(--text-muted); }
details.new-app { position: relative; }
details.new-app > summary { list-style: none; }
details.new-app > summary::-webkit-details-marker { display: none; }
details.new-app > summary::before { content: none; }
/* Popover kasvaa napista (origin-aware), ei näytön keskeltä */
.popover-card { position: absolute; right: 0; top: calc(100% + var(--s-2)); z-index: 20; width: min(380px, calc(100vw - 32px)); box-shadow: var(--shadow-float);
  transform-origin: top right; animation: pop-in var(--dur) var(--ease-out) both; }
@keyframes pop-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
/* Kapealla näytöllä nappi on vasemmassa reunassa → popover avautuu oikealle */
@media (max-width: 760px) { .popover-card { left: 0; right: auto; transform-origin: top left; } }

/* --- Ympäristömuuttujat ---------------------------------------------------------------- */
.env-group { padding: var(--s-3) var(--s-5) var(--s-1); font: 400 var(--text-xs) var(--mono); color: var(--text-subtle); }
.env-row { gap: var(--s-3); flex-wrap: wrap; min-height: 40px; }
.env-row .env-key { font-family: var(--mono); font-size: var(--text-sm); min-width: 14ch; word-break: break-all; }
.env-row .env-value { flex: 1; min-width: 10ch; font-family: var(--mono); font-size: var(--text-sm); color: var(--text-muted); word-break: break-all; }
.env-row .env-value.is-revealed { color: var(--text); }
.env-row .env-value .input { min-height: 30px; font-size: var(--text-sm); }
.env-row .env-actions { display: flex; gap: var(--s-1); margin-left: auto; }
.env-row.is-unset .env-key, .env-row.is-unset .env-value { text-decoration: line-through; color: var(--text-subtle); }
.env-add { display: grid; gap: var(--s-2); }
.env-key-input { flex: 0 1 220px !important; text-transform: none; }
.textarea { min-height: 96px; padding: var(--s-2) var(--s-3); resize: vertical; line-height: 1.5; }
.env-bar { position: sticky; bottom: 0; display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3) var(--s-5);
  background: var(--surface-2); color: var(--text); font-size: var(--text-sm); border-top: 1px solid var(--border);
  border-radius: 0 0 var(--r-lg) var(--r-lg); animation: enter var(--dur) var(--ease-out) both; }
.env-bar[hidden] { display: none; }
.env-history .list-item { padding-left: 0; padding-right: 0; font-size: var(--text-sm); min-height: 36px; }
.env-history .ver { font-family: var(--mono); min-width: 4ch; }

/* --- Auditointiloki: rivit kuin pääkirja (hiusviiva auttaa silmää rivillä) ----------------- */
.audit-item { align-items: baseline; font-size: var(--text-sm); min-height: 0; padding-top: var(--s-2); padding-bottom: var(--s-2); }
.audit-item + .audit-item { border-top: 1px solid var(--border); }
.audit-when { flex: none; width: 16ch; font: 400 var(--text-xs) var(--mono); color: var(--text-subtle); }
.audit-item strong { font-weight: 500; }
@media (max-width: 760px) { .audit-item { flex-wrap: wrap; } .audit-when { width: auto; } }

/* --- Kertakirjautuminen (SSO) ym. vaiheittaiset kortit ------------------------------------ */
.sso-step { padding: var(--s-4) var(--s-5) var(--s-5); display: grid; gap: var(--s-3); min-width: 0; }
.sso-step + .sso-step { border-top: 1px solid var(--border); padding-top: var(--s-5); }
.sso-step h3 { display: flex; align-items: center; gap: var(--s-2); margin: 0; font-size: var(--text-md); font-weight: 500; }
.step-num { font: 400 var(--text-xs) var(--mono); color: var(--text-subtle); }
.step-num::after { content: "."; }
.step-num.is-done { color: var(--success); }
.segmented { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); justify-self: start; }
.segmented label { position: relative; display: inline-flex; align-items: center; min-height: 28px; padding: 0 var(--s-3); font-weight: 400;
  border-radius: var(--r-sm); cursor: pointer; color: var(--text-muted); transition: background var(--dur-fast), color var(--dur-fast); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.segmented label:has(input:focus-visible) { box-shadow: var(--ring); }
.segmented label:has(input:disabled) { cursor: not-allowed; opacity: 0.5; }
fieldset.sso-protocol { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: var(--s-3); }
fieldset.sso-protocol[hidden] { display: none; }
.sso-domains { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-1) 0; }
.sso-domains .list-item { padding: var(--s-2) var(--s-4); }
.sso-domain { align-items: flex-start; flex-wrap: wrap; }
.sso-txt { display: grid; gap: var(--s-2); margin-top: var(--s-3); }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s-1) var(--s-4); margin: 0; font-size: var(--text-sm); }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; font-family: var(--mono); overflow-wrap: anywhere; }
.kv dd + dd { grid-column: 2; }
@media (max-width: 760px) { .kv { grid-template-columns: 1fr; } .kv dd + dd { grid-column: 1; } }

/* --- Avattava osio (progressiivinen paljastaminen) ---------------------------------- */
details.disclosure > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--text-sm); color: var(--text-muted); padding: var(--s-2) 0; }
details.disclosure > summary:hover { color: var(--text); }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "›"; display: inline-block; width: 1ch; transition: transform var(--dur-fast) var(--ease-out); }
details.disclosure[open] > summary::before { transform: rotate(90deg); }

/* --- Animaatiot ------------------------------------------------------------------- */
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(4px) scale(0.98); } }
@keyframes pulse { 50% { opacity: 0.4; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
.ip-label { flex: 0 1 200px !important; }
.ip-rule code { font-size: var(--text-sm); }

/* --- Julkaisut: versio, mitä, milloin – nykyinen versio merkitty pisteellä ------------------ */
.release-item { display: grid; grid-template-columns: 5ch minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 0 var(--s-3); font-size: var(--text-sm); min-height: 48px; }
.release-item .ver { font-family: var(--mono); grid-row: 1 / 3; align-self: start; padding-top: 1px; color: var(--text-muted); }
.release-item.is-current .ver { color: var(--accent-text); }
.release-item .who { grid-column: 2; }
.release-item .meta { color: var(--text-subtle); font-size: var(--text-xs); display: block; }
.release-item .img { display: none; }
.release-item .tail { grid-column: 3; grid-row: 1 / 3; align-self: center; }
.release-item .btn.is-armed { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* --- Liikenne: kaaviot (docs: dataviz-menetelmä – validoitu paletti, ohuet merkit, yksi akseli) ------- */
:root { --viz-1: #2a78d6; --viz-2: #8b93a5; --viz-critical: #d03b3b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --viz-1: #4b93ea; --viz-2: #6f788c; } }
:root[data-theme="dark"] { --viz-1: #4b93ea; --viz-2: #6f788c; }
#traffic-card .card-head { gap: var(--s-3); }
#traffic-card .segmented { margin-left: auto; }
.traffic-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.traffic-tiles .tile { display: grid; gap: 2px; padding: var(--s-3) var(--s-5) var(--s-4); min-width: 0; }
.traffic-tiles .tile + .tile { border-left: 1px solid var(--border); }
.traffic-tiles .label { font-size: var(--text-sm); color: var(--text-muted); font-weight: 400; }
.traffic-tiles .value { font: 400 20px/1.3 var(--mono); letter-spacing: -0.01em; }
.traffic-tiles .sub { font-size: var(--text-xs); color: var(--text-subtle); overflow-wrap: anywhere; }
.traffic-tiles .sub:empty::before { content: "\00a0"; }
.traffic-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chart { margin: 0; padding: var(--s-4) var(--s-5); position: relative; min-width: 0; }
.chart + .chart { border-left: 1px solid var(--border); }
.chart figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); margin-bottom: var(--s-3); font-size: var(--text-sm); }
.chart-title { font-weight: 500; }
.legend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2); color: var(--text-muted); font-size: var(--text-xs); }
.legend .key { display: inline-block; flex: none; background: var(--key); margin-left: var(--s-2); }
.legend .key:first-child { margin-left: 0; }
.key-rect { width: 8px; height: 8px; border-radius: 2px; }
.key-line { width: 14px; height: 2px; border-radius: 1px; }
.chart-plot svg { display: block; width: 100%; height: 180px; overflow: visible; }
.chart-plot .grid { stroke: var(--border); stroke-width: 1; shape-rendering: crispEdges; }
.chart-plot .axis { fill: var(--text-subtle); font: 400 11px var(--mono); }
.chart-plot .end-label { fill: var(--text-muted); font: 400 11px var(--mono); }
.chart-plot .crosshair { stroke: var(--text-subtle); stroke-width: 1; }
.chart-plot .hit:hover + .bar-group, .chart-plot .bar-group.is-hot { opacity: 0.8; }
.chart-empty { height: 180px; display: grid; place-items: center; color: var(--text-subtle); font-size: var(--text-sm); }
.viz-tip { position: absolute; pointer-events: none; z-index: 5; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-float); font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }
.viz-tip strong { color: var(--text); font: 400 var(--text-sm) var(--mono); }
.viz-tip .row { display: flex; align-items: center; gap: var(--s-2); }
.viz-tip .row i { width: 12px; height: 2px; background: var(--key); border-radius: 1px; }
#alert-list:empty { display: none; }
#alert-list { border-top: 1px solid var(--border); padding: var(--s-2) 0; }
.alert-item { font-size: var(--text-sm); gap: var(--s-3); min-height: 36px; }
.traffic-table-wrap { border-top: 1px solid var(--border); padding-top: var(--s-2); padding-bottom: var(--s-2); }
.table-scroll { overflow-x: auto; max-height: 320px; }
.data-table { width: 100%; border-collapse: collapse; font: 400 var(--text-xs) var(--mono); }
.data-table th, .data-table td { padding: var(--s-1) var(--s-3); text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th { color: var(--text-muted); font-weight: 400; font-family: var(--font); position: sticky; top: 0; background: var(--surface); }
@media (max-width: 760px) {
  .traffic-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .traffic-tiles .tile + .tile { border-left: 0; }
  .traffic-tiles .tile { border-top: 1px solid var(--border); }
  .traffic-tiles .tile:nth-child(-n+2) { border-top: 0; }
  .traffic-tiles .tile:nth-child(even) { border-left: 1px solid var(--border); }
  .traffic-charts { grid-template-columns: minmax(0, 1fr); }
  .chart + .chart { border-left: 0; border-top: 1px solid var(--border); }
  #traffic-card .segmented { width: 100%; margin-left: 0; }
}

/* --- Git (sovelluspaneeli) --- */
.git-deploys { border-top: 1px solid var(--border); padding-top: var(--s-2); }
.git-deploy { align-items: flex-start; font-size: var(--text-sm); flex-wrap: wrap; }
.git-deploy .who { overflow-wrap: anywhere; }
.git-error { margin: var(--s-2) 0 0; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--term-bg); color: var(--term-fg); font: 400 var(--text-xs)/1.5 var(--mono); white-space: pre-wrap; max-height: 240px; overflow: auto; }
#git-card .btn.is-armed, #domains-card .btn.is-armed { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* --- Skaalaus --- */
.scale-form { align-items: flex-end; }
.scale-form .mini { display: grid; gap: 4px; font-size: var(--text-xs); color: var(--text-muted); font-weight: 400; }
.scale-form .mini .input { width: 96px; flex: none; font-family: var(--mono); }
.scale-events { border-top: 1px solid var(--border); padding-top: var(--s-2); }
.scale-events .list-item { font-size: var(--text-sm); gap: var(--s-3); min-height: 32px; }

/* --- Tietokanta --- */
#db-card .db-url { word-break: break-all; }
#db-card .db-note { padding: var(--s-3) var(--s-5) 0; margin: 0; }
.db-sql-wrap { border-top: 1px solid var(--border); }
.db-sql .mini { font-size: var(--text-xs); color: var(--text-muted); }
.db-sql .textarea { min-height: 72px; width: 100%; font-size: var(--text-sm); }
.db-sql .hint { font: 400 var(--text-xs) var(--mono); color: var(--text-subtle); }
.db-result:empty { display: none; }
.db-table td { text-align: left; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.db-table th { text-align: left; }
.db-table td.is-null { color: var(--text-subtle); }
.db-backups .list-item { font-size: var(--text-sm); gap: var(--s-3); min-height: 36px; }
.db-backups .ver { font-family: var(--mono); color: var(--text-muted); }
.db-backups .tail { margin-left: auto; }

/* --- Käyttö (org-sivu): pääkirjan rivit --- */
.usage-list { list-style: none; margin: 0; padding: 0; }
.usage-row { padding: var(--s-3) var(--s-5); display: grid; gap: var(--s-1); }
.usage-row + .usage-row { border-top: 1px solid var(--border); }
.usage-line { display: flex; align-items: baseline; gap: var(--s-3); }
.usage-label { min-width: 96px; }
.usage-used { color: var(--text-muted); font: 400 var(--text-sm) var(--mono); }
.usage-cost { margin-left: auto; font: 400 var(--text-sm) var(--mono); }
.usage-cost.is-over { color: var(--warning); }
.usage-row .meter { margin-top: 0; }
.usage-sub { font-size: var(--text-xs); }
.usage-foot { border-top: 1px solid var(--border); }
.usage-total { display: flex; align-items: baseline; justify-content: space-between; }
.usage-total strong { font: 400 var(--text-lg) var(--mono); }
#usage-budget-form { align-items: center; flex-wrap: wrap; }
#usage-budget-form .mini { font-size: var(--text-xs); color: var(--text-muted); font-weight: 400; flex-basis: 100%; }
#usage-budget-form .usage-budget-input { width: 120px; flex: none; font-family: var(--mono); }

/* --- SCIM --- */
#scim .mini { font-size: var(--text-xs); color: var(--text-muted); font-weight: 400; }
#scim .scim-default { align-items: center; }
#scim .scim-default .select { width: auto; flex: none; }
#scim-groups .select { width: auto; flex: none; margin-left: auto; }
#scim-secret:empty { display: none; }

/* --- Pääsy (sovelluspaneeli): jakolinkki, jäsenet ja suorat jaot yhdessä kortissa --- */
.access-group { padding: var(--s-2) 0 var(--s-1); }
.access-group + .access-group { border-top: 1px solid var(--border); }
.access-group > h3 { padding: var(--s-3) var(--s-5) var(--s-1); font-size: var(--text-sm); font-weight: 400; color: var(--text-muted); }
.access-group .list { padding-bottom: 0; }
.access-group .note { padding: var(--s-1) var(--s-5) var(--s-3); }

/* --- Organisaation yhteenveto (yksi rivi, ei kortteja) --- */
.org-summary { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-8); margin: calc(-1 * var(--s-4)) 0 var(--s-8); font-size: var(--text-sm); color: var(--text-muted); }
.org-summary b { display: block; font: 400 var(--text-xl)/1.3 var(--mono); color: var(--text); }
.org-summary .meter { width: 120px; }

/* --- AI-agentti: hätäkatkaisin ensimmäisenä, jäljitys pääkirjan riveinä --- */
#agent-card .agent-top { padding-top: var(--s-2); }
.agent-kill { --btn-fg: var(--danger); --btn-border: color-mix(in oklch, var(--danger) 40%, transparent); }
.agent-kill.is-armed { background: var(--danger); color: #fff; border-color: transparent; }
.agent-trace td:nth-child(3) { font-family: var(--mono); max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.agent-trace td, .agent-trace th { text-align: left; }
.agent-trace tr.is-blocked td { color: var(--danger); }
.approvals { border-left: 2px solid var(--accent); }
.approval { align-items: flex-start; }
.approval .who { display: grid; gap: 4px; }
.approval-call { font-size: var(--text-sm); color: var(--text); overflow-wrap: anywhere; }
.approval-body { margin: 2px 0 0; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--surface-2); font: 400 var(--text-xs)/1.5 var(--mono); color: var(--text-muted); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 140px; overflow: auto; }
.badge.rule-deny { color: var(--danger); }
.badge.rule-approve { color: var(--accent-text); }
.agent-limits { flex-wrap: wrap; align-items: end; }
.agent-limits .mini { display: grid; gap: 4px; font-size: var(--text-xs); color: var(--text-muted); }
.agent-limits .mini .input { width: 120px; }

/* --- Lokien vienti --- */
.stream-item { flex-wrap: wrap; }
.stream-item .who { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.support-active { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; justify-content: space-between; }
.support-active span { flex: 1 1 280px; }
.freeze-item { flex-wrap: wrap; }
.freeze-item .who { display: grid; gap: 2px; flex: 1 1 260px; }
.freeze-item.is-active strong { color: var(--warning); }
.export-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); }
.export-row .subtle { flex: 1 1 280px; }
.access-filter { flex-wrap: wrap; }
.access-filter .input { flex: 1 1 220px; }
.access-filter .select { width: auto; flex: 0 0 auto; }
.access-status-err { color: var(--danger); }
.residency-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.residency-row .select { width: auto; min-width: 16rem; }

/* --- Viimeisimmät julkaisut (dashboard) --- */
#onboarding, #recent { margin-bottom: var(--s-8); }
.recent-item { gap: var(--s-3); }
.recent-item .who { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; flex: 1 1 auto; min-width: 0; }
.recent-item .who > .subtle:last-child { flex-basis: 100%; }
.recent-item a { color: inherit; text-decoration: none; }
.recent-item a:hover strong { text-decoration: underline; }
.recent-item time { white-space: nowrap; font-size: var(--text-sm); }
.recent-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--success); align-self: center; }
.recent-dot.is-rollback { background: var(--warning); }
.recent-dot.is-promote { background: var(--accent); }

/* --- Aloituslista (dashboard) --- */
.onboarding .card-head { align-items: center; }
.ob-close { margin-left: auto; }
.ob-progress { height: 3px; margin: 0 var(--s-5); background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.ob-progress span { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width 300ms var(--ease-out, ease-out); }
.ob-steps { list-style: none; margin: 0; padding: var(--s-2) 0; counter-reset: ob; }
.ob-step { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-5); }
.ob-step + .ob-step { border-top: 1px solid var(--border); }
.ob-check { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; }
.ob-step.is-done .ob-check { background: var(--success); border-color: var(--success); }
.ob-check svg { width: 14px; height: 14px; fill: none; stroke: var(--bg); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ob-text { display: grid; gap: 2px; min-width: 0; }
.ob-step.is-done .ob-text strong { color: var(--text-muted); font-weight: 500; }
.ob-action { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: flex-end; }
@media (max-width: 640px) { .ob-step { grid-template-columns: 22px minmax(0, 1fr); } .ob-action { grid-column: 2; justify-content: flex-start; } .ob-step.is-done .ob-action, .cmdk-trigger kbd { display: none; } }

/* Pitkät osoitteet ja avaimet tekstissä rivittyvät (ei sivuttaisvieritystä 320 px:n leveydellä). */
.main-col code, .docs-main code { overflow-wrap: anywhere; }

.tile-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-muted); font-size: var(--text-sm); line-height: 1.4; }

/* --- Hyppää sisältöön (näkyy vain näppäimistöfokuksessa) --- */
.skip-link { position: absolute; left: var(--s-3); top: -60px; z-index: 200; padding: 8px 14px; border-radius: var(--r-md); background: var(--accent); color: var(--accent-fg, #1a1206); font-weight: 500; text-decoration: none; transition: top 120ms; }
.skip-link:focus { top: var(--s-3); outline: 2px solid var(--text); outline-offset: 2px; }
#content:focus { outline: none; }

/* --- Komentopaletti (Ctrl/⌘ K) --- */
.cmdk-trigger { display: flex; align-items: center; gap: var(--s-2); width: 100%; margin: 0 0 var(--s-3); padding: 0 var(--s-2) 0 var(--s-3); height: 34px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--text-subtle); font: inherit; font-size: var(--text-sm); cursor: pointer; transition: border-color 150ms, color 150ms; }
.cmdk-trigger:hover { border-color: var(--border-strong); color: var(--text-muted); }
.cmdk-trigger svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; flex: none; }
.cmdk-trigger span { flex: 1; text-align: left; }
.cmdk-trigger kbd, .cmdk kbd { font: 500 11px/1 var(--mono); color: var(--text-subtle); border: 1px solid var(--border); border-radius: 5px; padding: 3px 5px; background: var(--surface-2); }
.cmdk-backdrop { position: fixed; inset: 0; z-index: 100; background: color-mix(in oklch, var(--bg) 55%, transparent); backdrop-filter: blur(2px); display: grid; justify-items: center; align-items: start; padding: 12vh var(--s-4) var(--s-4); }
.cmdk { width: min(620px, 100%); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: 0 24px 64px -12px rgb(0 0 0 / 0.45); overflow: hidden; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: 70vh; }
.cmdk-input { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); font: inherit; font-size: 15px; padding: 14px 16px; outline: none; }
.cmdk-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.cmdk-group { padding: 10px 10px 4px; font-size: var(--text-xs); color: var(--text-subtle); }
.cmdk-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-md); color: var(--text-muted); cursor: pointer; }
.cmdk-item[aria-selected="true"] { background: var(--surface-2); color: var(--text); }
.cmdk-item svg { width: 16px; height: 16px; flex: none; }
.cmdk-item .cmdk-hint { margin-left: auto; font-size: var(--text-xs); color: var(--text-subtle); font-family: var(--mono); }
.cmdk-empty { padding: 18px 16px; color: var(--text-subtle); font-size: var(--text-sm); }
.cmdk-foot { display: flex; gap: var(--s-4); padding: 8px 14px; border-top: 1px solid var(--border); font-size: var(--text-xs); color: var(--text-subtle); }
@media (prefers-reduced-motion: no-preference) { .cmdk { animation: cmdk-in 140ms var(--ease-out, ease-out); } @keyframes cmdk-in { from { opacity: 0; transform: translateY(-6px) scale(0.99); } } }

/* --- Organisaation osioryhmät --- */
.org-group { display: grid; gap: var(--s-6); padding-top: var(--s-4); }
.org-group-title { margin: 0; font-size: var(--text-sm); font-weight: 500; color: var(--text-muted); letter-spacing: 0; padding-bottom: var(--s-2); border-bottom: 1px solid var(--border); }
.nav-on { margin-left: 6px; font-size: var(--text-xs); color: var(--accent-text, var(--accent)); font-family: var(--mono); }
/* --- Tilasivu --- */
.status-main { max-width: 860px; margin: 0 auto; padding: var(--s-10) var(--s-5) var(--s-12); display: grid; gap: var(--s-10); }
.status-banner { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: var(--s-3); row-gap: 4px; padding: var(--s-5) var(--s-6); border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); }
.status-banner h1 { font-size: 22px; margin: 0; }
.status-banner .subtle { grid-column: 2; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.status-banner.is-degraded .status-dot, .status-banner.is-maintenance .status-dot { background: var(--warning); box-shadow: 0 0 0 4px var(--warning-soft); }
.status-banner.is-partial .status-dot, .status-banner.is-major .status-dot { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.status-section { display: grid; gap: var(--s-4); }
.status-section h2 { font-size: 16px; margin: 0; }
.status-comps { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.status-comp { padding: var(--s-4) var(--s-5); display: grid; gap: var(--s-2); }
.status-comp + .status-comp { border-top: 1px solid var(--border); }
.status-comp-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.status-name { font-weight: 500; }
.status-pill { font-size: var(--text-sm); color: var(--success); }
.status-pill.is-degraded, .status-pill.is-maintenance { color: var(--warning); }
.status-pill.is-partial, .status-pill.is-major { color: var(--danger); }
.uptime-bars { display: grid; grid-template-columns: repeat(90, minmax(0, 1fr)); gap: 2px; height: 28px; }
.uptime-bar { border-radius: 2px; background: var(--success); }
.uptime-bar.is-warn { background: var(--warning); }
.uptime-bar.is-bad { background: var(--danger); }
.uptime-bar.is-none { background: var(--surface-2); }
.uptime-foot { display: flex; justify-content: space-between; font-size: var(--text-xs); }
.status-incident { border: 1px solid var(--border); border-left: 3px solid var(--warning); border-radius: var(--r-md); padding: var(--s-4) var(--s-5); background: var(--surface); display: grid; gap: var(--s-2); }
.status-incident.is-partial, .status-incident.is-major { border-left-color: var(--danger); }
.status-incident.is-maintenance { border-left-color: var(--accent); }
.status-incident h3 { margin: 0; font-size: 15px; }
.status-updates { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.status-updates p { margin: 2px 0 0; }
.status-foot { font-size: var(--text-sm); }
@media (max-width: 640px) {
  .uptime-bars { grid-template-columns: repeat(30, minmax(0, 1fr)); }
  .uptime-bar:nth-child(-n+60) { display: none; }
  .uptime-foot span:first-child { font-size: 0; }
  .uptime-foot span:first-child::after { content: '30 days ago'; font-size: var(--text-xs); }
}
.session-item { flex-wrap: wrap; }
.session-item .who { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; flex: 1 1 260px; }
.session-item .who .subtle { flex-basis: 100%; }
.retention-item { flex-wrap: wrap; padding-top: var(--s-3); padding-bottom: var(--s-3); }
.retention-item .who { display: grid; gap: 2px; flex: 1 1 260px; }
.retention-item .select { width: auto; flex: 0 0 auto; min-width: 11rem; }
.stream-meta, .stream-status { flex-basis: 100%; font-size: var(--text-sm); }
.stream-status { color: var(--text-muted); }
.stream-item.is-failing .stream-status { color: var(--danger); }
.role-perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: var(--s-2) var(--s-4); }
.stream-row { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: flex-end; }
.stream-field { display: grid; gap: 4px; flex: 1 1 160px; min-width: 0; }
.stream-field > .select, .stream-field > .input { width: 100%; min-width: 0; }
.stream-url { flex: 2 1 280px; }
.stream-cats { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); }

/* --- Tiedostot --- */
.files-list .who code { word-break: break-all; }
.files-more { margin: 0 var(--s-5) var(--s-4); }

/* --- Tilin poisto --- */
.card-danger { border-color: color-mix(in oklch, var(--danger) 40%, var(--border)); }
.delete-list { margin: 0; padding-left: var(--s-5); display: grid; gap: 6px; color: var(--text-muted); }
.btn-danger:disabled { opacity: 0.45; cursor: not-allowed; }
#delete-account-form .input { flex: 0 1 280px; }

/* --- Ajastetut tehtävät --- */
.cron-job { flex-wrap: wrap; }
.cron-job .who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.cron-meta { flex-basis: 100%; padding-left: 16px; order: 5; }
.cron-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-subtle); opacity: 0.5; align-self: center; }
.cron-dot.is-ok { background: var(--success); opacity: 1; }
.cron-dot.is-bad { background: var(--danger); opacity: 1; }
.cron-form { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: flex-end; }
.cron-field { display: grid; gap: 4px; flex: 1 1 140px; }

/* --- Mallipohjat ja remix --- */
.tpl-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s-4); }
.tpl { display: flex; flex-direction: column; justify-content: space-between; gap: var(--s-4); padding: var(--s-5); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.tpl h3 { margin: 0 0 var(--s-2); font-size: var(--text-lg); }
.tpl p { margin: 0; }
.tpl-uses { margin-top: var(--s-3) !important; display: flex; flex-wrap: wrap; gap: 6px; }
.tpl .btn { align-self: flex-start; }
.remix-form .input { max-width: 420px; }

/* --- AI-mallit --- */
.ai-provider { flex-wrap: wrap; }
.ai-key-form { flex-basis: 100%; }
.ai-key-form[hidden] { display: none; }
#ai [data-ai-budget] .input, #ai-card form .input { flex: 0 1 140px; }
.ai-key-form .input { flex: 1; min-width: 0; }
.ai-env { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.ai-env code { font-size: var(--text-xs); }
.ai-calls .is-blocked .subtle { color: var(--danger); }

/* --- IT-näkymä (organisaatiosivu) --- */
.gov-policy { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-6); align-items: center; padding-top: var(--s-2); }
.switch { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--text-sm); color: var(--text-muted); cursor: pointer; }
.switch input { accent-color: var(--accent); width: 16px; height: 16px; }
.gov-policy [data-gov-csv] { margin-left: auto; }
.gov-item { align-items: flex-start; gap: var(--s-4); padding-top: var(--s-3); padding-bottom: var(--s-3); }
.gov-risk { flex: none; width: 84px; font: 500 var(--text-xs)/1.9 var(--sans); color: var(--text-subtle); display: inline-flex; align-items: center; gap: 6px; }
.gov-risk::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-subtle); opacity: 0.5; }
.risk-high .gov-risk { color: var(--danger); }
.risk-high .gov-risk::before { background: var(--danger); opacity: 1; }
.risk-medium .gov-risk { color: var(--warning, var(--accent-text)); }
.risk-medium .gov-risk::before { background: var(--warning, var(--accent)); opacity: 1; }
.risk-none .gov-risk::before { background: var(--success); opacity: 1; }
.gov-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.gov-name { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.gov-name a { text-decoration: none; }
.gov-flags { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 2px; font-size: var(--text-sm); }
.gov-flags li { color: var(--text-muted); }
.gov-flags .flag-high { color: var(--danger); }
.gov-flags .flag-medium { color: var(--text); }
.gov-findings summary { cursor: pointer; font-size: var(--text-xs); color: var(--text-subtle); }
.gov-findings ul { margin: 6px 0 0; padding-left: var(--s-4); font-size: var(--text-xs); display: grid; gap: 2px; }
.gov-review { display: flex; gap: var(--s-2); flex: none; }
@media (max-width: 720px) { .gov-item { flex-wrap: wrap; } .gov-risk { width: auto; } .gov-policy [data-gov-csv] { margin-left: 0; } }

/* =====================================================================================================
 * Kehys v2 (2026-11-16): himmennetty sivupalkki (Linear, Vercel), esikatselukuvat sovelluksista, yksi polttopiste
 * per näkymä, vähemmän laatikoita. Otsikot 2026-11-17: Inter 600 tiukalla välistyksellä kuten sanamerkki (ei serifiä).
 * ===================================================================================================== */
:root { --sidebar: #eef0f4; --sidebar-w: 236px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --sidebar: #07080c; } }
:root[data-theme="dark"] { --sidebar: #07080c; }

.display { font-weight: 600; letter-spacing: -0.032em; line-height: 1.1; text-wrap: balance; }
h1.display { font-size: 34px; }
.eyebrow { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: 6px; }
.auth-card h1.display { font-size: 34px; margin-bottom: var(--s-3); }

/* --- Kehys --- */
body.has-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--s-2);
  padding: var(--s-3) var(--s-3) var(--s-4); background: var(--sidebar); border-right: 1px solid var(--border); overflow-y: auto;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: var(--s-1) var(--s-1) var(--s-3) var(--s-2); }
.side-nav { display: grid; gap: var(--s-5); }
.nav-section { display: grid; gap: 1px; }
.nav-title { padding: 0 var(--s-2) 6px; font-size: var(--text-xs); color: var(--text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item {
  display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 0 var(--s-2); border-radius: var(--r-md);
  color: var(--text-muted); font-size: var(--text-md); text-decoration: none; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.nav-item span { overflow: hidden; text-overflow: ellipsis; }
.nav-item svg { width: 16px; height: 16px; flex: none; opacity: 0.75; }
.nav-item:hover { background: color-mix(in oklch, var(--text) 6%, transparent); color: var(--text); text-decoration: none; }
.nav-item[aria-current="page"] { background: color-mix(in oklch, var(--text) 9%, transparent); color: var(--text); }
.nav-item[aria-current="page"] svg { opacity: 1; }
.sidebar-foot { margin-top: auto; display: grid; gap: 2px; padding-top: var(--s-3); border-top: 1px solid var(--border); }
.sidebar-foot .user { padding: var(--s-1) var(--s-2); font-size: var(--text-xs); color: var(--text-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.main-col > .crumbs { padding: var(--s-4) var(--s-10) 0; }
.has-shell .container { width: min(1160px, 100%); padding: var(--s-10) var(--s-10) var(--s-12); }
.page-head { align-items: flex-end; }
.page-head .title-block { min-width: 0; }
.log-shell.has-shell .main-col { height: 100vh; }
.log-shell .log-toolbar { padding: var(--s-3) var(--s-5); }

/* --- Dashboard: esikatseluruudukko --- */
.org-section + .org-section { margin-top: var(--s-12); }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-1) var(--s-3); margin-bottom: var(--s-4); }
.section-head h2 { font-size: var(--text-lg); font-weight: 600; }
.section-head .meta { font: 400 var(--text-xs) var(--mono); color: var(--text-subtle); }
.section-head > a { margin-left: auto; font-size: var(--text-sm); color: var(--text-muted); }
.section-head > a:hover { color: var(--text); }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(264px, 1fr)); gap: var(--s-6) var(--s-5); }
.app-tile { display: grid; gap: var(--s-3); color: var(--text); text-decoration: none; }
.app-tile:hover { text-decoration: none; }
.thumb {
  position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--r-lg);
  border: 1px solid var(--border); background: var(--surface);
  transition: border-color var(--dur) var(--ease-out), transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.app-tile:hover .thumb { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.35); }
.app-tile:active .thumb { transform: translateY(0) scale(0.99); }
.thumb.is-empty, .preview-empty { display: grid; place-items: center; align-content: center; gap: var(--s-2); background: var(--surface-2); color: var(--text-subtle); font-size: var(--text-sm); text-align: center; padding: var(--s-4); }
.thumb-host { display: block; font: 400 var(--text-sm)/1.4 var(--mono); color: var(--text-muted); overflow-wrap: anywhere; }
.tile-body { display: grid; gap: 2px; padding: 0 2px; }
.tile-head { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.tile-name { font-weight: 500; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-head .status { margin-left: auto; font-size: var(--text-xs); }
.app-tile .status.is-running { display: none; } /* käynnissä on oletus – näytetään vain poikkeama */
.tile-meta { font: 400 var(--text-xs) var(--mono); color: var(--text-subtle); }
.tile-meta .is-locked { color: var(--danger); }
.tag { font: 400 11px/1.6 var(--mono); padding: 0 6px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); color: var(--text-muted); }
.empty-panel { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); padding: var(--s-5); border-radius: var(--r-lg); background: var(--surface-2); color: var(--text-muted); font-size: var(--text-sm); }
.empty-panel .cli { font-size: var(--text-sm); }
.first-run { margin-bottom: var(--s-12); padding: var(--s-8); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); }
.first-run h2.display { font-size: 26px; margin-bottom: var(--s-5); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); counter-reset: step; }
.steps li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); counter-increment: step; }
.steps li::before { content: counter(step); font: 400 var(--text-sm)/1 var(--mono); color: var(--text-subtle); width: 1.5em; }
.steps li > span { color: var(--text-muted); min-width: 22ch; }

/* --- Sovellussivu: esikatselu polttopisteenä + tilatiedot --- */
.app-hero { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(220px, 1fr); gap: var(--s-8); align-items: start; }
.preview {
  position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--r-lg);
  border: 1px solid var(--border); background: var(--surface); box-shadow: 0 24px 48px -28px rgba(0, 0, 0, 0.45);
  transition: border-color var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.preview:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.preview img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.preview .preview-empty { display: none; position: absolute; inset: 0; }
.preview.is-empty img { display: none; }
.preview.is-empty .preview-empty { display: grid; }
.facts { margin: 0; display: grid; gap: var(--s-5); padding-top: var(--s-1); }
.facts div { display: grid; gap: 4px; min-width: 0; }
.facts dt { font-size: var(--text-xs); color: var(--text-subtle); }
.facts dd { margin: 0; font-size: 15px; color: var(--text); overflow-wrap: anywhere; }
.facts dd .cli { margin-left: calc(-1 * var(--s-2)); font-size: var(--text-sm); }
.facts .mono { font-family: var(--mono); font-size: var(--text-sm); color: var(--text); }

/* --- Kapea näyttö: sivupalkista yläpalkki, linkit vierivät --- */
@media (max-width: 900px) {
  body.has-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; z-index: 10; height: auto; gap: var(--s-2); padding: var(--s-2) var(--s-3); border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar-top { padding: var(--s-1); }
  .side-nav { display: flex; gap: var(--s-1); overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--s-3)); padding: 0 var(--s-3) var(--s-1); }
  .nav-section { display: contents; }
  .nav-title { display: none; }
  .nav-item { flex: none; }
  .sidebar-foot { display: none; }
  .main-col > .crumbs { padding: var(--s-3) var(--s-4) 0; }
  .has-shell .container { padding: var(--s-6) var(--s-4) var(--s-10); }
  .app-hero { grid-template-columns: minmax(0, 1fr); gap: var(--s-5); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
  h1.display { font-size: 30px; }
  .log-shell.has-shell .main-col { height: auto; min-height: 70vh; }
}

/* --- Kirjautuminen (2026-11-17): lomake vasemmalla, oikealla aina tumma "yö" – sama maailma kuin
   laskeutumissivulla: oranssi horisontti, iso V ja julkaisu, joka tapahtuu silmien edessä. --- */
.auth-split { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr); place-items: stretch; gap: 0; padding: 0; min-height: 100vh; min-height: 100dvh; }
.auth-split .auth-card { justify-self: center; align-self: center; padding: var(--s-10) var(--s-6); }
/* Kirjautumissivu on aina tumma: lomakepuoli on sama yö kuin kuvapuoli, vain hieman vaaleampi pinta ja hento
   hehku – ei vaaleaa ja tummaa puoliskoa vierekkäin. Rajat lasketaan uudelleen tumman tekstin mukaan. */
body.auth-split {
  color-scheme: dark;
  --bg: #0b0d14; --surface: #11141c; --surface-2: #171b25; --surface-3: #1f2430; --field: #141821; --field-border: #6b7283;
  --text: #eef0f5; --text-muted: #a3a9b8; --text-subtle: #7f879b;
  --border: color-mix(in oklch, #eef0f5 9%, transparent); --border-strong: color-mix(in oklch, #eef0f5 18%, transparent);
  --accent: oklch(0.74 0.16 55); --accent-hover: oklch(0.79 0.14 58); --accent-fg: #1a1206; --accent-text: oklch(0.8 0.13 58);
  background: radial-gradient(90% 70% at 0% 100%, rgba(239, 138, 60, 0.07), transparent 60%), radial-gradient(60% 50% at 10% 0%, rgba(120, 130, 160, 0.06), transparent 70%), #0b0d14;
  color: var(--text);
}
body.auth-split .auth-visual { border-left: 1px solid rgba(238, 240, 245, 0.06); }
.auth-visual { position: relative; margin: 0; overflow: hidden; display: grid; place-items: center; align-content: center; gap: var(--s-12);
  padding: var(--s-12) var(--s-10); background: #08090d; color: #eef0f5; isolation: isolate; }
.auth-visual figcaption { position: relative; font-size: var(--text-sm); color: #8b92a3; max-width: 46ch; text-align: center; }
.night { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
/* Horisontti: terävä valoviiva, jonka yläpuolelle hehku nousee ja alapuolella maa on tummempaa kuin taivas. */
.night-horizon { position: absolute; left: 0; right: 0; top: 80%; bottom: 0; animation: horizon-in 1600ms ease-out both;
  background: linear-gradient(180deg, #050608, #030305); }
.night-horizon::before { content: ""; position: absolute; left: 50%; bottom: 100%; width: 120%; height: 360px; transform: translateX(-50%);
  background: radial-gradient(50% 100% at 50% 100%, rgba(239, 138, 60, 0.28), rgba(239, 138, 60, 0.08) 45%, transparent 75%); }
.night-horizon::after { content: ""; position: absolute; left: 8%; right: 8%; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 173, 107, 0.55) 25%, #ffd2a8 50%, rgba(255, 173, 107, 0.55) 75%, transparent);
  box-shadow: 0 0 18px 2px rgba(239, 138, 60, 0.45); }
.night-v { position: absolute; width: 78%; max-width: 760px; aspect-ratio: 1; left: 50%; top: 46%; transform: translate(-50%, -50%); color: var(--accent); opacity: 0.08; }
.auth-stage { position: relative; width: min(560px, 100%); }
.auth-stage .term { background: rgba(8, 9, 13, 0.86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.9); animation: stage-in 900ms var(--ease-out) 150ms both; }
.auth-stage .term-body { min-height: 13.5em; align-content: start; }
.term-body .t-step { display: grid; grid-template-columns: 14px auto 1fr; gap: 10px; align-items: center; }
.term-body .t-step b { font-weight: 400; color: var(--term-muted); }
.t-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid #3a3f4c; }
.t-dot.is-on { width: 10px; height: 10px; border-color: var(--accent); border-top-color: transparent; animation: spin 0.7s linear infinite; }
.t-dot.is-ok { background: oklch(0.82 0.12 155); border-color: oklch(0.82 0.12 155); }
.t-caret { display: inline-block; width: 0.55em; height: 1.1em; background: var(--accent); vertical-align: -0.2em; animation: blink 1s steps(1) infinite; }
.live-card { position: absolute; right: -18px; bottom: -26px; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center;
  padding: 12px 16px; border-radius: var(--r-lg); background: #11141c; border: 1px solid rgba(238, 240, 245, 0.12); box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.8);
  animation: card-in 600ms var(--ease-out) both; }
.live-card[hidden] { display: none; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: oklch(0.82 0.12 155); grid-row: span 2; box-shadow: 0 0 0 0 oklch(0.82 0.12 155 / 0.6); animation: live-ping 1.8s ease-out infinite; }
.live-host { font: 500 13px var(--mono); color: #eef0f5; }
.live-meta { font-size: var(--text-xs); color: #8b92a3; }
@keyframes horizon-in { from { opacity: 0; transform: translateY(40px); } }
@keyframes stage-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
@keyframes card-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } }
@keyframes live-ping { 70% { box-shadow: 0 0 0 7px oklch(0.82 0.12 155 / 0); } }
@keyframes blink { 50% { opacity: 0; } }
/* Merkki piirtyy sivun avautuessa: vasen viiva laskeutuu, oikea ampaisee sen ohi. */
.auth-card .brand-mark path { transform-box: fill-box; }
.auth-card .brand-mark path:first-child { animation: mark-l 520ms var(--ease-out) both; }
.auth-card .brand-mark path:last-child { animation: mark-r 600ms cubic-bezier(0.16, 1.2, 0.3, 1) 160ms both; }
@keyframes mark-l { from { transform: translateY(-60%); opacity: 0; } }
@keyframes mark-r { from { transform: translate(40%, -70%); opacity: 0; } }
/* Lomake on käytettävissä heti (ei sisääntuloanimaatiota): vain merkki piirtyy ja oikean puolen terminaali liukuu esiin. */
@media (prefers-reduced-motion: reduce) {
  .night-horizon, .auth-stage .term, .live-card, .auth-card > *, .auth-card .brand-mark path, .t-dot.is-on, .t-caret, .live-dot { animation: none !important; }
}
.term { border-radius: var(--r-lg); background: var(--term-bg); border: 1px solid color-mix(in oklch, var(--term-fg) 12%, transparent);
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.6); overflow: hidden; }
.term-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid color-mix(in oklch, var(--term-fg) 8%, transparent); }
.term-bar i { width: 10px; height: 10px; border-radius: 50%; background: color-mix(in oklch, var(--term-fg) 18%, transparent); }
.term-bar span { margin-left: var(--s-2); font: 400 12px var(--mono); color: var(--term-muted); }
.term-pause { margin-left: auto; height: 24px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid color-mix(in oklch, var(--term-fg) 18%, transparent);
  background: transparent; color: var(--term-muted); font: 500 12px var(--font); cursor: pointer; }
.term-pause:hover { color: var(--term-fg); }
.term.is-paused .t-caret, .term.is-paused .t-dot.is-on { animation-play-state: paused; }
.term-body { margin: 0; padding: var(--s-5) var(--s-5) var(--s-6); display: grid; gap: 6px; font: 400 13px/1.55 var(--mono); color: var(--term-fg); white-space: pre-wrap; }
.term-body .t-cmd { color: var(--term-fg); }
.term-body .t-cmd i { font-style: normal; color: var(--accent); }
.term-body .t-out { color: var(--term-muted); }
.term-body .t-ok { color: oklch(0.82 0.12 155); }
.term-body .t-gap { height: var(--s-3); }
@media (max-width: 900px) {
  .auth-split { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .auth-split .auth-card { padding: var(--s-8) var(--s-4) var(--s-10); }
  .auth-visual { padding: var(--s-10) var(--s-4) var(--s-12); }
  .live-card { right: 8px; bottom: -22px; }
}

/* --- Julkaisu selaimesta (2026-11-17): pudotusalue, julkaisuikkuna, vaiheet ---------------------------
   Pudotusalue on ensimmäisen käynnin näkymän pääasia; sama komponentti on "New app" -ikkunassa. Vaiheet
   näyttävät, mitä palvelimella tapahtuu (lataus → eristetty build → käynnistys → live), eikä vain pyörivää ikonia. */
.dropzone {
  display: grid; justify-items: center; gap: var(--s-2); padding: var(--s-8) var(--s-6); text-align: center;
  border: 1px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface); color: var(--text-muted);
  cursor: pointer; transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-over { border-color: var(--text-subtle); background: var(--surface-2); outline: none; }
.dropzone.is-over { border-style: solid; }
.dropzone.has-files { border-style: solid; color: var(--text); }
.dz-art svg { width: 22px; height: 22px; color: var(--text-subtle); }
.dz-title { font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
.dz-sub { font-size: var(--text-sm); }
.dz-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-2); margin-top: var(--s-2); }
.dropzone-hero { padding: var(--s-12) var(--s-6); gap: var(--s-3); }
.dropzone-hero h2.display { font-size: 30px; color: var(--text); }
.dropzone-hero p { max-width: 46ch; }
.first-run { margin-bottom: var(--s-12); padding: 0; border: 0; background: none; display: grid; gap: var(--s-6); }
.first-run-alt { display: grid; gap: var(--s-3); }
.first-run-alt .steps li { gap: var(--s-2) var(--s-3); }
button.link { all: unset; color: var(--text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
button.link:focus-visible { box-shadow: var(--ring); border-radius: 2px; }

.deploy-dialog {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--border);
  border-radius: var(--r-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-float);
}
.deploy-dialog::backdrop { background: color-mix(in oklch, var(--bg) 70%, transparent); backdrop-filter: blur(2px); }
.deploy-dialog[open] { animation: pop-in var(--dur) var(--ease-out) both; }
.deploy { display: grid; gap: var(--s-5); padding: var(--s-5) var(--s-6) var(--s-6); }
.deploy-head { display: flex; align-items: center; justify-content: space-between; }
.deploy-head h2 { font-size: var(--text-lg, 18px); font-weight: 600; letter-spacing: -0.02em; }
.deploy-fields { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-3); align-items: start; }
.deploy-fields:has(> :only-child) { grid-template-columns: minmax(0, 1fr); }
.deploy-fields .field { display: grid; gap: 6px; margin: 0; }
.deploy-fields .select { width: auto; min-width: 12ch; }
.input.mono-plain { font-family: var(--mono); font-size: var(--text-sm); }
[data-url-preview] { font-family: var(--mono); overflow-wrap: anywhere; }
.deploy-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.deploy-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); font-size: var(--text-sm); color: var(--text-subtle); }
.deploy-steps[hidden] { display: none; }
.deploy-steps li { display: flex; align-items: center; gap: var(--s-3); }
.deploy-steps li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; flex: none; }
.deploy-steps li.is-active { color: var(--text); }
.deploy-steps li.is-active::before { border-color: var(--accent); border-top-color: transparent; width: 10px; height: 10px; margin: -1px; animation: spin 0.8s linear infinite; }
.deploy-steps li.is-done { color: var(--text-muted); }
.deploy-steps li.is-done::before { background: var(--success); border-color: var(--success); }
.deploy-steps li.is-failed { color: var(--danger); }
.deploy-steps li.is-failed::before { background: var(--danger); border-color: var(--danger); }
[data-deploy-error] { white-space: pre-wrap; font-family: var(--mono); font-size: var(--text-xs); max-height: 220px; overflow: auto; display: block; }
[data-deploy-error][hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.drop-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; pointer-events: none;
  background: color-mix(in oklch, var(--bg) 80%, transparent); }
.drop-overlay span { padding: var(--s-6) var(--s-10); border: 1px dashed var(--text-subtle); border-radius: var(--r-lg); background: var(--surface); font-weight: 500; }
.drop-overlay[hidden] { display: none; }
@media (max-width: 560px) {
  .deploy-fields { grid-template-columns: minmax(0, 1fr); }
  .deploy-fields .select { width: 100%; }
  .dropzone-hero { padding: var(--s-8) var(--s-4); }
}
@media (prefers-reduced-motion: reduce) { .deploy-steps li.is-active::before { animation: none; } }

/* --- Tilisivu: API-avaimet ------------------------------------------------------------------- */
.container-narrow { max-width: 820px; }
.key-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--s-2); }
.key-form .select { width: auto; }
.key-reveal { display: grid; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-md); background: var(--surface-2); }
.key-reveal[hidden] { display: none; }
.key-reveal .input { font-family: var(--mono); font-size: var(--text-sm); }
.key-item .who { display: grid; gap: 2px; }
.key-name { font-weight: 500; }
.key-item.is-leaving { opacity: 0; transition: opacity var(--dur-exit) var(--ease-out); }
@media (max-width: 640px) { .key-form { grid-template-columns: minmax(0, 1fr); } .key-form .select { width: 100%; } }

/* --- API-dokumentaatio (/docs/api) -----------------------------------------------------------
   Lukusivu: kapea vasen hakemisto, yksi lukupalsta. Jokaisen reitin vieressä sama CLI-komento (tunnusmerkki). */
body.docs { background: var(--bg); }
.docs-top { position: sticky; top: 0; z-index: 10; background: color-mix(in oklch, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.docs-top-in { display: flex; align-items: center; gap: var(--s-3); max-width: 1180px; margin: 0 auto; padding: 0 var(--s-5); height: 56px; font-size: var(--text-md); }
.docs-sep { color: var(--text-subtle); }
.docs-spacer { flex: 1; }
.docs-top a:not(.brand):not(.btn) { color: var(--text-muted); font-family: var(--mono); font-size: var(--text-sm); }
@media (max-width: 640px) {
  .docs-top-in { overflow-x: auto; scrollbar-width: none; }
  .docs-top-in > * { flex-shrink: 0; }
  .docs-top-in .docs-sep, .docs-top-in .docs-sep + span { display: none; }
}
.docs-body { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s-10); max-width: 1180px; margin: 0 auto; padding: var(--s-10) var(--s-5) var(--s-12); }
.docs-nav { position: sticky; top: 88px; align-self: start; display: grid; gap: 2px; }
.docs-nav a { color: var(--text-muted); padding: 6px var(--s-2); border-radius: var(--r-md); font-size: var(--text-md); text-decoration: none; }
.docs-nav a:hover { color: var(--text); background: var(--surface-2); }
.docs-main { min-width: 0; max-width: 780px; display: grid; gap: var(--s-12); }
.api-intro { display: grid; gap: var(--s-5); }
.api-intro h1.display { font-size: 40px; }
.api-intro .lead { color: var(--text-muted); font-size: 16px; max-width: 64ch; }
.kv-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.api-intro { grid-template-columns: minmax(0, 1fr); }
.kv-grid code { font-size: var(--text-sm); overflow-wrap: anywhere; }
.fld-title { font-size: var(--text-xs); color: var(--text-subtle); margin-bottom: 4px; }
.term-snippet { margin: 0; padding: var(--s-4) var(--s-5); border-radius: var(--r-lg); background: #0b0d14; color: #e4e7ee; font: 400 13px/1.7 var(--mono); overflow-x: auto; }
.term-snippet .t-c { color: #7f879b; }
.term-snippet .t-p { color: var(--accent); }
.api-group { display: grid; gap: var(--s-4); scroll-margin-top: 80px; }
.api-group > h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.025em; }
.api-op { display: grid; gap: var(--s-2); padding: var(--s-5) 0; border-top: 1px solid var(--border); scroll-margin-top: 80px; }
.api-op h3 { font-size: var(--text-lg); font-weight: 500; }
.api-sig { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.api-sig .cli { margin-left: auto; }
.api-path { font-size: var(--text-md); color: var(--text); background: none; padding: 0; }
.verb { font: 600 11px/1 var(--mono); padding: 4px 6px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); color: var(--text-muted); min-width: 52px; text-align: center; }
.verb-post { color: var(--accent-text); border-color: color-mix(in oklch, var(--accent) 45%, transparent); }
.verb-delete { color: var(--danger); border-color: color-mix(in oklch, var(--danger) 45%, transparent); }
.fields { margin: 0; display: grid; gap: var(--s-2); }
.fields .fields { margin: var(--s-2) 0 0 var(--s-4); }
.fld { display: grid; gap: 2px; }
.fld dt { font-size: var(--text-sm); }
.fld dd { margin: 0; color: var(--text-muted); font-size: var(--text-sm); }
@media (max-width: 860px) {
  .docs-body { grid-template-columns: minmax(0, 1fr); gap: var(--s-6); padding-top: var(--s-6); }
  .docs-nav { position: static; display: flex; flex-wrap: wrap; gap: var(--s-1); }
  .kv-grid { grid-template-columns: minmax(0, 1fr); }
  .api-sig .cli { margin-left: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: left; }
  .docs-main code { overflow-wrap: anywhere; }
  .term-snippet { max-width: 100%; }
}

/* --- Liike (WCAG 2.2.2): koristeelliset sykkeet ja kursori pysähtyvät alle viidessä sekunnissa;
   latausindikaattorit pyörivät vain latauksen ajan. Tiedoston lopussa, jotta ohittaa animation-lyhenteet. --- */
.status.is-live::before, .live-dot { animation-iteration-count: 2; }
.t-caret { animation-iteration-count: 5; }
