/*
 * QA Studio design tokens — direction B «Журнал».
 * Source of truth: design canvas https://claude.ai/artifact/XGgBFHM65YWYA44w9RiB3Z
 * Rules: web/DESIGN.md. Components use only these variables, never raw hex.
 * Theme switch: <html data-theme="light|dark"> (theme.tsx). Without the attribute
 * the OS preference decides.
 */

/* Shared Zona mark: dashboard header and sign-in. */
.zona-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--brand-bg);
  outline: 1px solid var(--border-strong);
  outline-offset: 2px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.zona-mark svg { width: 15px; height: 16px; }
.zona-mark path { fill: var(--brand-fg, #0094f6); }

/* Self-hosted fonts (woff2, OFL in public/fonts/). No request to Google Fonts. */
@font-face {
  font-family: 'Golos Text';
  src: url('/dashboard-assets/fonts/golos-text-cyrillic-ext-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: 'Golos Text';
  src: url('/dashboard-assets/fonts/golos-text-cyrillic-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Golos Text';
  src: url('/dashboard-assets/fonts/golos-text-latin-ext-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C0, U+02C4-02C7, U+02CC-02CC, U+02CE-02D7, U+02DD-02DD, U+2000-206F, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Golos Text';
  src: url('/dashboard-assets/fonts/golos-text-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BB, 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: 'Golos Text';
  src: url('/dashboard-assets/fonts/golos-text-cyrillic-ext-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: 'Golos Text';
  src: url('/dashboard-assets/fonts/golos-text-cyrillic-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Golos Text';
  src: url('/dashboard-assets/fonts/golos-text-latin-ext-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C0, U+02C4-02C7, U+02CC-02CC, U+02CE-02D7, U+02DD-02DD, U+2000-206F, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Golos Text';
  src: url('/dashboard-assets/fonts/golos-text-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BB, 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: 'Golos Text';
  src: url('/dashboard-assets/fonts/golos-text-cyrillic-ext-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: 'Golos Text';
  src: url('/dashboard-assets/fonts/golos-text-cyrillic-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Golos Text';
  src: url('/dashboard-assets/fonts/golos-text-latin-ext-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C0, U+02C4-02C7, U+02CC-02CC, U+02CE-02D7, U+02DD-02DD, U+2000-206F, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Golos Text';
  src: url('/dashboard-assets/fonts/golos-text-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BB, 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: 'Golos Text';
  src: url('/dashboard-assets/fonts/golos-text-cyrillic-ext-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: 'Golos Text';
  src: url('/dashboard-assets/fonts/golos-text-cyrillic-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Golos Text';
  src: url('/dashboard-assets/fonts/golos-text-latin-ext-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C0, U+02C4-02C7, U+02CC-02CC, U+02CE-02D7, U+02DD-02DD, U+2000-206F, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Golos Text';
  src: url('/dashboard-assets/fonts/golos-text-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BB, 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: 'JetBrains Mono';
  src: url('/dashboard-assets/fonts/jetbrains-mono-cyrillic-ext-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('/dashboard-assets/fonts/jetbrains-mono-cyrillic-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('/dashboard-assets/fonts/jetbrains-mono-latin-ext-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C0, U+02C4-02C7, U+02CC-02CC, U+02CE-02D7, U+02DD-02DD, U+2000-206F, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('/dashboard-assets/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BB, 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: 'JetBrains Mono';
  src: url('/dashboard-assets/fonts/jetbrains-mono-cyrillic-ext-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('/dashboard-assets/fonts/jetbrains-mono-cyrillic-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('/dashboard-assets/fonts/jetbrains-mono-latin-ext-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C0, U+02C4-02C7, U+02CC-02CC, U+02CE-02D7, U+02DD-02DD, U+2000-206F, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('/dashboard-assets/fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BB, 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 {
  /* type */
  --font-ui: 'Golos Text', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --text-xs: 11.5px;   /* section labels, badges */
  --text-sm: 12.5px;   /* meta, captions, table head */
  --text-md: 14px;     /* body, steps, buttons */
  --text-lg: 16px;     /* card titles */
  --text-xl: 18px;     /* panel titles, dialogs */
  --text-2xl: 22px;    /* scenario title */
  --text-3xl: 24px;    /* page title */
  --leading: 1.45;

  /* space (4px grid) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-2-5: 10px;
  --sp-3-5: 14px;

  /* radius */
  --r-xs: 6px;      /* small buttons, code chips */
  --r-sm: 8px;      /* controls, rows */
  --r-md: 10px;     /* buttons, inputs, inner cards */
  --r-lg: 14px;     /* panels, cards */
  --r-xl: 16px;     /* device stage, dialogs */
  --r-device: 12px; /* device cards and offline section, both themes */
  --r-dialog: 18px; /* scenario editor */
  --r-pill: 999px;  /* status chips */

  /* size */
  --control-h: 40px;      /* primary controls */
  --control-h-sm: 32px;   /* toolbar buttons */
  --row-h: 52px;          /* table / list rows */
  --header-h: 52px;
  --dot: 7px;             /* status dot, never shrinks */

  /* layout */
  --ws-col-result: 340px;
  --ws-devtools-h: 300px;
  --phone-w: 272px;       /* native phone frame, scaled to fit the stage */
  --phone-h: 564px;
  --tv-max-w: 820px;

  /* motion */
  --dur: 180ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  --shadow-dialog: 0 28px 80px rgba(0, 0, 0, 0.35);
  --shadow-pop: 0 24px 60px rgba(0, 0, 0, 0.3);
  --sc-menu-shadow: 0 14px 36px rgba(0, 0, 0, 0.2);
  --sc-row-hover: rgba(127, 120, 105, 0.06);
  --sc-danger-fg: #ffffff;
  --scrim: rgba(20, 19, 17, 0.45);
  --brand-bg: #1e252b;      /* Zona launcher icon */
  --brand-fg: #0094f6;
}

/* ---------- light (default) ---------- */
:root,
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #e9e5dd;      /* segmented control track, avatar */
  --stage: #e9e5dd;          /* device stage */
  --device-bezel: #1c1b19;
  --shadow-device: 0 18px 40px rgba(40, 30, 15, 0.28);
  --sunken: #eeeae3;         /* table head, selected row, screenshot well */
  --code-bg: #f7f5f1;
  --se-sunken: #f7f5f1;
  --se-ring: rgba(28, 27, 25, 0.12);
  --border: #e2ded6;
  --border-strong: #d6d1c7;
  --fg: #1c1b19;
  --fg-2: #3d3a35;
  --muted: #6b675f;          /* 5.0:1 on --bg */
  --faint: #8a857b;          /* disabled / placeholder only */
  --primary: #1c1b19;
  --on-primary: #ffffff;
  --link: #1d4ed8;
  --focus: #1d4ed8;

  --sc-danger-bg: #dc2626;
  --pass-fg: #166534;  --pass-bg: #dcfce7;  --pass-dot: #15803d;
  --fail-fg: #991b1b;  --fail-bg: #fdecec;  --fail-dot: #dc2626;
  --run-fg: #92400e;   --run-bg: #fef3c7;   --run-dot: #f59e0b;
  --info-fg: #1e3a8a;  --info-bg: #eef2ff;  --info-dot: #4f46e5;

  /* syntax (IntelliJ Light flavour): code viewer, JSON tree, logcat */
  --syn-text: #1c1b19;
  --syn-keyword: #0033b3;
  --syn-string: #067d17;
  --syn-comment: #8c8c8c;
  --syn-number: #1750eb;
  --syn-function: #00627a;
  --syn-class: #871094;
  --syn-const: #871094;
  --syn-line-hl: rgba(0, 0, 0, 0.035);
}

/* ---------- dark ---------- */
:root[data-theme='dark'] {
  color-scheme: dark;
  --sc-danger-bg: #b91c1c;
  --bg: #161513;
  --surface: #1f1d1a;
  --surface-2: #2a2723;
  --stage: #1b1a17;
  --device-bezel: #3a3631;
  --shadow-device: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.6), 0 18px 44px rgba(0, 0, 0, 0.6);
  --sunken: #2a2723;
  --code-bg: #191816;
  --se-sunken: #1a1917;
  --se-ring: rgba(237, 234, 228, 0.14);
  --scrim: rgba(0, 0, 0, 0.62);
  --border: #2f2c27;
  --border-strong: #3d3933;
  --fg: #edeae4;
  --fg-2: #d3cec5;
  --muted: #a39e94;
  --faint: #7f7a71;
  --primary: #edeae4;
  --on-primary: #161513;
  --link: #8ab4ff;
  --focus: #8ab4ff;

  --pass-fg: #86efac;  --pass-bg: #14301f;  --pass-dot: #22c55e;
  --fail-fg: #fca5a5;  --fail-bg: #3a1919;  --fail-dot: #ef4444;
  --run-fg: #fcd34d;   --run-bg: #3a2d0e;   --run-dot: #f59e0b;
  --info-fg: #c7d2fe;  --info-bg: #232845;  --info-dot: #818cf8;

  /* syntax (Darcula flavour) */
  --syn-text: #bcbec4;
  --syn-keyword: #cf8e6d;
  --syn-string: #6aab73;
  --syn-comment: #7a7e85;
  --syn-number: #2aacb8;
  --syn-function: #56a8f5;
  --syn-class: #c77dbb;
  --syn-const: #c77dbb;
  --syn-line-hl: rgba(255, 255, 255, 0.04);

  --shadow-pop: 0 24px 60px rgba(0, 0, 0, 0.5);
}

/* OS preference when the user has not picked a theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --sc-danger-bg: #b91c1c;
  --bg: #161513;
    --surface: #1f1d1a;
    --surface-2: #2a2723;
    --stage: #1b1a17;
  --device-bezel: #3a3631;
  --shadow-device: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.6), 0 18px 44px rgba(0, 0, 0, 0.6);
    --sunken: #2a2723;
    --code-bg: #191816;
  --se-sunken: #1a1917;
  --se-ring: rgba(237, 234, 228, 0.14);
  --scrim: rgba(0, 0, 0, 0.62);
    --border: #2f2c27;
    --border-strong: #3d3933;
    --fg: #edeae4;
    --fg-2: #d3cec5;
    --muted: #a39e94;
    --faint: #7f7a71;
    --primary: #edeae4;
    --on-primary: #161513;
    --link: #8ab4ff;
    --focus: #8ab4ff;
    --pass-fg: #86efac;  --pass-bg: #14301f;  --pass-dot: #22c55e;
    --fail-fg: #fca5a5;  --fail-bg: #3a1919;  --fail-dot: #ef4444;
    --run-fg: #fcd34d;   --run-bg: #3a2d0e;   --run-dot: #f59e0b;
    --info-fg: #c7d2fe;  --info-bg: #232845;  --info-dot: #818cf8;
    --syn-text: #bcbec4;
    --syn-keyword: #cf8e6d;
    --syn-string: #6aab73;
    --syn-comment: #7a7e85;
    --syn-number: #2aacb8;
    --syn-function: #56a8f5;
    --syn-class: #c77dbb;
    --syn-const: #c77dbb;
    --syn-line-hl: rgba(255, 255, 255, 0.04);
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur: 0ms; }
}
