/* Social MCP design system: tokens, type, and the shared controls every screen is built from.
   Light: warm paper-white with British Racing Green. Dark: deep forest green, never black or navy. */

@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/onest-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/onest-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Prata"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/prata-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Prata"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/prata-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Other fonts a person can choose in Settings → Appearance; a browser downloads only the one in use. */
@font-face {
  font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url("../fonts/golos-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text"; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url("../fonts/golos-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("../fonts/manrope-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("../fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Lora"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/lora-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Lora"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("../fonts/lora-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --font: "Onest", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Prata", "Iowan Old Style", "Times New Roman", Georgia, serif;
  --display-weight: 400;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  /* British Racing Green and its family */
  --brg: #004225;
  --brg-deep: #00301B;
  --ivory: #F4F1E6;
  --brass: #B39256;

  --bg: #FAFAF7;
  --bg-side: #F2F4EF;
  --surface: #FFFFFF;
  --surface-2: #F3F5F1;
  --surface-3: #E7ECE6;
  --line: rgba(16, 46, 30, 0.10);
  --line-strong: rgba(16, 46, 30, 0.18);
  --text: #0F1F17;
  --text-2: #4D5E54;
  --text-3: #6A7A70;

  --accent: #004225;
  --accent-hover: #0A5434;
  --accent-press: #00301B;
  --on-accent: #F4F1E6;
  --accent-text: #17663E;
  --accent-soft: #E4EFE7;
  --accent-soft-2: #D2E4D8;
  --ring: rgba(23, 102, 62, 0.22);
  --focus: #2E7D54;
  --switch-on: #17663E;
  --sheet-hi: transparent;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234D5E54' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");

  --ok: #1D7443;
  --ok-soft: #E3F1E7;
  --warn: #8F5600;
  --warn-soft: #FBF0DC;
  --danger: #B0281F;
  --danger-soft: #FBE7E4;

  --scrim: rgba(9, 24, 16, 0.32);
  --shadow-sm: 0 1px 2px rgba(10, 34, 21, 0.05);
  --shadow: 0 1px 2px rgba(10, 34, 21, 0.04), 0 6px 20px -6px rgba(10, 34, 21, 0.10);
  --shadow-lg: 0 2px 8px rgba(10, 34, 21, 0.06), 0 28px 64px -12px rgba(10, 34, 21, 0.26);

  --toast-bg: #00301B; --toast-fg: #F4F1E6; --toast-ic: #9EDDB8;
  --toast-bad-bg: #5E1712; --toast-bad-fg: #FFF1EE; --toast-bad-ic: #FFB4AA;

  --r-xs: 8px;
  --r-sm: 12px;
  --r: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --side-w: 272px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --t-fast: 140ms;
  --t: 200ms;
  --t-slow: 280ms;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0F1D17;
    --bg-side: #0B1813;
    --surface: #14251E;
    --surface-2: #1B2E26;
    --surface-3: #24392F;
    --line: rgba(206, 232, 216, 0.085);
    --line-strong: rgba(206, 232, 216, 0.16);
    --text: #E8EFEA;
    --text-2: #A2B3A9;
    --text-3: #869990;
    --accent: #DCEADF;
    --accent-hover: #EAF3EC;
    --accent-press: #C8DCCD;
    --on-accent: #082417;
    --accent-text: #8ED1AA;
    --accent-soft: rgba(142, 209, 170, 0.11);
    --accent-soft-2: rgba(142, 209, 170, 0.19);
    --ring: rgba(142, 209, 170, 0.24);
    --focus: #8ED1AA;
    --switch-on: #4FA877;
    --sheet-hi: rgba(220, 234, 223, 0.06);
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A2B3A9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --ok: #74D49E;
    --ok-soft: rgba(116, 212, 158, 0.12);
    --warn: #E9B75E;
    --warn-soft: rgba(233, 183, 94, 0.12);
    --danger: #F28B80;
    --danger-soft: rgba(242, 139, 128, 0.12);
    --scrim: rgba(2, 8, 5, 0.6);
    --toast-bg: #E4EFE7; --toast-fg: #0B2416; --toast-ic: #004225;
    --toast-bad-bg: #FBE2DE; --toast-bad-fg: #5A120C; --toast-bad-ic: #B0281F;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px -8px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.4), 0 32px 72px -12px rgba(0, 0, 0, 0.7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F1D17;
  --bg-side: #0B1813;
  --surface: #14251E;
  --surface-2: #1B2E26;
  --surface-3: #24392F;
  --line: rgba(206, 232, 216, 0.085);
  --line-strong: rgba(206, 232, 216, 0.16);
  --text: #E8EFEA;
  --text-2: #A2B3A9;
  --text-3: #869990;
  --accent: #DCEADF;
  --accent-hover: #EAF3EC;
  --accent-press: #C8DCCD;
  --on-accent: #082417;
  --accent-text: #8ED1AA;
  --accent-soft: rgba(142, 209, 170, 0.11);
  --accent-soft-2: rgba(142, 209, 170, 0.19);
  --ring: rgba(142, 209, 170, 0.24);
  --focus: #8ED1AA;
  --switch-on: #4FA877;
  --sheet-hi: rgba(220, 234, 223, 0.06);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A2B3A9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --ok: #74D49E;
  --ok-soft: rgba(116, 212, 158, 0.12);
  --warn: #E9B75E;
  --warn-soft: rgba(233, 183, 94, 0.12);
  --danger: #F28B80;
  --danger-soft: rgba(242, 139, 128, 0.12);
  --scrim: rgba(2, 8, 5, 0.6);
  --toast-bg: #E4EFE7; --toast-fg: #0B2416; --toast-ic: #004225;
  --toast-bad-bg: #FBE2DE; --toast-bad-fg: #5A120C; --toast-bad-ic: #B0281F;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px -8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.4), 0 32px 72px -12px rgba(0, 0, 0, 0.7);
}
@media (prefers-contrast: more) {
  :root { --line: var(--line-strong); --text-3: var(--text-2); }
}

/* ---------- personal appearance (Settings → Appearance, applied by theme.js as attributes on <html>) ---------- */
:root[data-font="golos"] { --font: "Golos Text", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
:root[data-font="manrope"] { --font: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
:root[data-font="inter"] { --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
:root[data-font="system"] { --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
:root[data-heading="lora"] { --font-display: "Lora", "Iowan Old Style", Georgia, serif; --display-weight: 500; }
:root[data-heading="same"] { --font-display: var(--font); --display-weight: 650; }
:root[data-heading="same"] h1, :root[data-heading="same"] .display { letter-spacing: -0.02em; }

/* text size: everything is sized in rem, so the whole panel follows */
:root[data-size="90"] { font-size: 90%; }
:root[data-size="110"] { font-size: 110%; }
:root[data-size="120"] { font-size: 120%; }
:root[data-size="135"] { font-size: 135%; }

:root[data-radius="sharp"] { --r-xs: 4px; --r-sm: 6px; --r: 8px; --r-lg: 10px; --r-xl: 12px; }
:root[data-radius="round"] { --r-xs: 10px; --r-sm: 16px; --r: 22px; --r-lg: 28px; --r-xl: 34px; }

/* more contrast: secondary text and lines move closer to the main text colour, whatever the palette */
:root[data-contrast="high"] {
  --text-2: color-mix(in srgb, var(--text) 80%, var(--bg));
  --text-3: color-mix(in srgb, var(--text) 70%, var(--bg));
  --line: var(--line-strong);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  font-family: var(--font); font-size: 100%; line-height: 1.5;
  font-feature-settings: "ss01" 0; -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  background: var(--bg); scrollbar-color: var(--line-strong) transparent;
}
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text); font-size: 0.9375rem;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent-soft-2); color: var(--text); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.012em; text-wrap: balance; }
h1 { font-family: var(--font-display); font-weight: var(--display-weight); font-size: 2rem; line-height: 1.15; letter-spacing: -0.01em; }
h2 { font-size: 1.0625rem; line-height: 1.35; }
h3 { font-size: 0.9375rem; line-height: 1.4; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 0.2em; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); transition: text-decoration-color var(--t-fast) ease; }
a:hover { text-decoration-color: currentColor; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
img { display: block; max-width: 100%; }
code, .mono { font-family: var(--font-mono); font-size: 0.8125rem; }
.display { font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: -0.01em; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 0.8125rem; line-height: 1.45; }
.xs { font-size: 0.75rem; line-height: 1.4; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.top { align-items: flex-start; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.stack.tight { gap: 6px; }
.stack.loose { gap: 28px; }
.snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.error-text { color: var(--danger); }
.warn-text { color: var(--warn); }
hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }

/* icons */
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 16px; height: 16px; }
.ic.xs { width: 14px; height: 14px; stroke-width: 2; }
.ic.lg { width: 22px; height: 22px; stroke-width: 1.6; }
.ic.xl { width: 28px; height: 28px; stroke-width: 1.5; }
.bi { width: 100%; height: 100%; fill: currentColor; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }

/* ---------- buttons ---------- */
.btn {
  appearance: none; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font-size: 0.875rem; font-weight: 550; line-height: 1;
  cursor: pointer; white-space: nowrap; text-decoration: none; user-select: none;
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease, transform 90ms ease-out, box-shadow var(--t-fast) ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { border-radius: 999px; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); box-shadow: var(--shadow-sm); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.primary:active { background: var(--accent-press); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.link { background: transparent; border-color: transparent; color: var(--accent-text); padding: 0 10px; }
.btn.link:hover { background: var(--accent-soft); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: transparent; }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 0.8125rem; gap: 6px; }
.btn.lg { min-height: 46px; padding: 0 22px; font-size: 0.9375rem; }
.btn.block { width: 100%; }
.btn.icon-only { width: 36px; min-height: 36px; padding: 0; }
.btn.icon-only.sm { width: 30px; min-height: 30px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.42; pointer-events: none; box-shadow: none; }
.btn.busy { color: transparent !important; pointer-events: none; }
.btn.busy::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--on-accent) transparent var(--on-accent) var(--on-accent); opacity: 0.9;
  animation: spin 700ms linear infinite;
}
.btn:not(.primary).busy::after { border-color: var(--text-2) transparent var(--text-2) var(--text-2); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- fields ---------- */
.field { display: grid; gap: 7px; min-width: 0; }
.field-label, .field > span:first-child { font-size: 0.8125rem; font-weight: 550; color: var(--text); letter-spacing: 0; }
.hint { font-size: 0.8125rem; line-height: 1.45; color: var(--text-2); }
.input {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease, background-color var(--t-fast) ease;
}
.input::placeholder { color: var(--text-3); opacity: 1; }
.input:hover { border-color: color-mix(in srgb, var(--text) 26%, transparent); }
.input:focus, .input:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--ring); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--danger-soft); }
.input[aria-invalid="true"] { border-color: var(--danger); }
textarea.input { min-height: 140px; resize: vertical; line-height: 1.55; padding-block: 12px; }
textarea.input.sm { min-height: 84px; }
select.input {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 40px;
  background-image: var(--chevron); background-position: right 14px center; background-size: 16px 16px; background-repeat: no-repeat;
}
select.input option { background: var(--surface); color: var(--text); }
.input.mono { font-family: var(--font-mono); font-size: 0.875rem; letter-spacing: 0.02em; }
.input.code { font-family: var(--font); font-variant-numeric: tabular-nums; letter-spacing: 0.32em; font-size: 1.25rem; font-weight: 550; text-align: center; padding-inline: 10px; }
.input.inline { width: auto; min-width: 140px; min-height: 34px; padding: 5px 12px; border-radius: 999px; font-size: 0.875rem; flex: 0 1 auto; }
select.input.inline { padding-right: 34px; background-position: right 11px center; background-size: 14px 14px; }
.input[type="datetime-local"], .input[type="time"] { font-variant-numeric: tabular-nums; }
::-webkit-calendar-picker-indicator { opacity: 0.6; cursor: pointer; border-radius: 6px; padding: 2px; transition: opacity var(--t-fast) ease, background-color var(--t-fast) ease; }
::-webkit-calendar-picker-indicator:hover { opacity: 0.95; background-color: var(--surface-2); }
.input::-webkit-datetime-edit-fields-wrapper { padding: 0; }
.input::-webkit-datetime-edit-text { color: var(--text-3); padding: 0 1px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .input { padding-right: 46px; }
.input-wrap > .btn { position: absolute; right: 4px; }

/* checkbox + switch */
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; line-height: 1.4; }
.check input[type="checkbox"] {
  appearance: none; flex: none; width: 18px; height: 18px; margin: 1px 0 0; border-radius: 6px; cursor: pointer;
  border: 1.5px solid var(--line-strong); background: var(--surface); display: grid; place-items: center;
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease;
}
.check input[type="checkbox"]::after {
  content: ""; width: 9px; height: 5px; border: solid var(--on-accent); border-width: 0 0 2px 2px;
  transform: translateY(-1px) rotate(-45deg) scale(0.6); opacity: 0; transition: opacity var(--t-fast) ease, transform var(--t-fast) var(--ease-out);
}
.check input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.check input[type="checkbox"]:checked::after { opacity: 1; transform: translateY(-1px) rotate(-45deg) scale(1); }
.check input[type="checkbox"]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch { position: relative; flex: none; width: 40px; height: 24px; }
.switch input { appearance: none; position: absolute; inset: 0; margin: 0; border-radius: 999px; background: var(--surface-3); cursor: pointer; transition: background-color var(--t) ease; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform var(--t) var(--ease-out); }
.switch input:checked { background: var(--switch-on); }
.switch input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:checked::after { transform: translateX(16px); }

/* ---------- segmented control ---------- */
.seg {
  position: relative; justify-self: start; display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; max-width: 100%;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
}
.seg button {
  appearance: none; border: 0; background: transparent; cursor: pointer; min-height: 32px; padding: 0 14px; border-radius: 999px;
  font-size: 0.8125rem; font-weight: 550; color: var(--text-2); white-space: nowrap;
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.seg button:focus-visible { outline-offset: 0; border-radius: 999px; }
.seg.lg button { min-height: 36px; padding: 0 16px; font-size: 0.875rem; }
.seg .count { margin-left: 6px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip {
  appearance: none; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  cursor: pointer; font-size: 0.875rem; font-weight: 500; white-space: nowrap;
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease, transform 90ms ease-out;
}
.chip:has(.pglyph) { padding-left: 5px; }
.chip:hover { background: var(--surface-2); }
.chip:active { transform: scale(0.98); }
.chip.on, .chip[aria-pressed="true"] { border-color: var(--accent-text); background: var(--accent-soft); color: var(--text); }
.chip .chk { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-text); color: var(--bg); margin-right: -4px; }
.chip .chk .ic { width: 12px; height: 12px; stroke-width: 2.6; }
.chip[disabled] { opacity: 0.45; cursor: not-allowed; }
.chip .x { display: grid; place-items: center; width: 18px; height: 18px; margin-right: -6px; border-radius: 50%; color: var(--text-2); }
.chip:hover .x { background: var(--surface-3); color: var(--text); }
.chip.sm { min-height: 28px; padding: 0 10px; font-size: 0.8125rem; }

/* ---------- badges + status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; flex: none;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--text-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge.plain::before { display: none; }
.badge.info { background: var(--accent-soft); color: var(--accent-text); }
.badge.live { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 0.6875rem; font-weight: 650; background: var(--warn-soft); color: var(--warn); }
.tag.neutral { background: var(--surface-2); color: var(--text-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--text-3); }
.dot.live { background: var(--ok); }
.dot.test { background: var(--warn); }
.dot.off { background: var(--danger); }

/* platform glyph tile */
.pglyph {
  --pg: 32px; flex: none; display: inline-grid; place-items: center; width: var(--pg); height: var(--pg);
  border-radius: calc(var(--pg) * 0.3); background: var(--surface-2); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line); font-weight: 700; font-size: calc(var(--pg) * 0.38); letter-spacing: -0.02em; line-height: 1;
}
.pglyph .bi { width: 52%; height: 52%; }
.pglyph.sm { --pg: 22px; }
.pglyph.md { --pg: 26px; }
.pglyph.lg { --pg: 44px; }
.pglyph.xl { --pg: 52px; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.card.pad { padding: 20px; }
.card.pad-lg { padding: 24px 26px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 24px; display: grid; gap: 16px; }
.panel-head { display: flex; align-items: flex-start; gap: 14px; }
.panel-head h2 { line-height: 1.3; }
.panel-head p { margin-top: 3px; }
.list { list-style: none; margin: 0; padding: 0; }
.item { position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--surface); }
.item + .item { box-shadow: 0 -1px 0 var(--line); }
.card > .list > .item:first-child { border-radius: var(--r) var(--r) 0 0; }
.card > .list > .item:last-child { border-radius: 0 0 var(--r) var(--r); }
.card > .list > .item:only-child { border-radius: var(--r); }
.item-title { font-weight: 500; line-height: 1.4; }
.item-meta { font-size: 0.8125rem; line-height: 1.45; color: var(--text-2); margin-top: 2px; }
.item-meta .sep { margin: 0 6px; color: var(--text-3); }

.thumb { flex: none; width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.thumb.ph { display: grid; place-items: center; color: var(--text-3); }

/* message rows (problems, warnings, ready) */
.msg { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: var(--r-sm); font-size: 0.8125rem; line-height: 1.45; list-style: none; }
.msg > .ic { margin-top: 1px; width: 16px; height: 16px; }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }
.msg.bad { background: var(--danger-soft); color: var(--danger); }
.msg.info { background: var(--accent-soft); color: var(--accent-text); }
.msg > span { color: var(--text); }
.msg.ok > span { color: inherit; }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r); background: var(--warn-soft); font-size: 0.875rem; line-height: 1.5; }
.notice > .ic { color: var(--warn); margin-top: 1px; }
.notice.info { background: var(--accent-soft); }
.notice.info > .ic { color: var(--accent-text); }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 14px; }
.steps > li { counter-increment: step; position: relative; padding-left: 38px; line-height: 1.5; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.75rem; font-weight: 650; font-variant-numeric: tabular-nums;
  background: var(--accent-soft); color: var(--accent-text);
}
.steps.small > li { font-size: 0.875rem; padding-left: 34px; }
.steps.small > li::before { width: 22px; height: 22px; top: 0; font-size: 0.6875rem; }

.copybox { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.copybox code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 0.8125rem; color: var(--text); }

.empty { display: grid; justify-items: center; gap: 10px; padding: 44px 24px; text-align: center; color: var(--text-2); }
.empty .empty-ic { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 4px; }
.empty h3 { color: var(--text); font-size: 1rem; }
.empty p { max-width: 46ch; font-size: 0.875rem; }
.empty .empty-actions { justify-content: center; margin-top: 6px; }

/* details / disclosure */
.more > summary {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; user-select: none;
  color: var(--accent-text); font-weight: 550; font-size: 0.875rem; padding: 4px 0; border-radius: var(--r-xs);
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary .ic { transition: transform var(--t) var(--ease-out); }
.more[open] > summary .ic { transform: rotate(90deg); }
.more > .stack { padding-top: 12px; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head > .grow > p { margin-top: 8px; color: var(--text-2); max-width: 62ch; }
.section-head { display: flex; align-items: center; gap: 12px; }
.section-head h2 { flex: 1; }

/* ---------- dialog sheet ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px;
  background: var(--scrim); opacity: 0; transition: opacity var(--t) ease;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.scrim.open { opacity: 1; }
.sheet {
  position: relative; width: min(560px, 100%); max-height: calc(100dvh - 48px); overflow: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: inset 0 1px 0 var(--sheet-hi), var(--shadow-lg);
  padding: 26px 28px 0; display: flex; flex-direction: column;
  transform: translateY(10px) scale(0.985); opacity: 0;
  transition: transform var(--t-slow) var(--ease-out), opacity var(--t) ease;
}
.sheet > .sheet-body { display: grid; gap: 20px; padding-bottom: 26px; }
.scrim.open .sheet { transform: none; opacity: 1; }
.sheet.wide { width: min(760px, 100%); }
.sheet-head { display: flex; align-items: flex-start; gap: 14px; }
.sheet-head h2 { font-family: var(--font-display); font-weight: var(--display-weight); font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.005em; }
.sheet-head p { margin-top: 6px; }
.sheet-head .close { margin: -4px -8px 0 0; }
.sheet-foot {
  position: sticky; bottom: 0; z-index: 3; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 4px -28px 0; padding: 14px 28px calc(16px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 82%, transparent); border-top: 1px solid var(--line);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
}
.sheet-foot .status { flex: 1 1 180px; font-size: 0.8125rem; color: var(--text-2); }
.sheet-foot .status:empty { flex-basis: 0; }

@media (max-width: 640px) {
  .copybox { flex-wrap: wrap; padding: 10px 10px 10px 14px; }
  .copybox code { flex-basis: 100%; }
  .scrim { padding: 0; place-items: end stretch; }
  .sheet, .sheet.wide { width: 100%; max-height: 94dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 22px 18px 0; border-bottom: 0; transform: translateY(24px); }
  .sheet-foot { margin: 4px -18px 0; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); }
  .sheet-foot .btn { flex: 1 1 auto; }
  .sheet-foot .status { flex-basis: 100%; }
  .sheet-head h2 { font-size: 1.375rem; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60; display: flex; align-items: center; gap: 10px;
  max-width: min(520px, calc(100vw - 32px)); padding: 12px 18px 12px 14px; border-radius: 16px;
  background: var(--toast-bg); color: var(--toast-fg); font-size: 0.875rem; line-height: 1.4; box-shadow: var(--shadow-lg);
  transform: translate(-50%, 14px); opacity: 0; transition: transform var(--t-slow) var(--ease-out), opacity var(--t) ease;
}
.toast .ic { color: var(--toast-ic); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.bad { background: var(--toast-bad-bg); color: var(--toast-bad-fg); }
.toast.bad .ic { color: var(--toast-bad-ic); }

/* ---------- loading ---------- */
.skeleton { display: grid; gap: 14px; }
.sk { border-radius: var(--r-sm); background: var(--surface-2); position: relative; overflow: hidden; }
.sk::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 60%, transparent), transparent);
  animation: shimmer 1.4s var(--ease-in-out) infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.sk.h1 { height: 38px; width: 42%; border-radius: 10px; }
.sk.line { height: 14px; width: 64%; }
.sk.block { height: 72px; border-radius: var(--r); }
.sk.tall { height: 220px; border-radius: var(--r); }

/* view swap: the new screen settles in, nothing slides */
.fade-in { animation: fadeIn var(--t) ease both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
  .sheet { transform: none !important; }
  .toast, .toast.show { transform: translate(-50%, 0) !important; }
}
/* the same calm, chosen in Settings → Appearance */
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
:root[data-motion="reduced"] .sheet { transform: none !important; }
:root[data-motion="reduced"] .toast, :root[data-motion="reduced"] .toast.show { transform: translate(-50%, 0) !important; }

@media (prefers-reduced-transparency: reduce) {
  .sheet-foot { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .scrim { backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* scrollbars inside panels */
.scroll-y { overflow: auto; scrollbar-width: thin; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- action menu ---------- */
.menu { position: relative; flex: none; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: inset 0 1px 0 var(--sheet-hi), var(--shadow-lg);
  display: grid; gap: 1px; animation: popIn var(--t) var(--ease-out);
}
.menu-pop.up { top: auto; bottom: calc(100% + 6px); }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.menu-item {
  appearance: none; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text); font-size: 0.875rem; text-align: left; cursor: pointer; white-space: nowrap;
}
.menu-item .ic { color: var(--text-2); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item.danger, .menu-item.danger .ic { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }
