/* АУБ · Нормотворчий агент. Візуальна основа — макет Claude Design
   https://claude.ai/artifact/Wv9Au8xWdoiTLUvvYx86oy (PRODUCT.md → Brand Commitments). */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/inter-cyrillic-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/inter-cyrillic-wght-normal.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("/static/fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/inter-latin-wght-normal.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 {
  --bg: #EEF0F4;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --line: #ECEEF2;
  --line-strong: #D1D5DB;
  --text: #111827;
  --text-2: #374151;
  --muted: #4B5563;      /* 7.5:1 на білому */
  --subtle: #6B7280;     /* 4.8:1 на білому, лише дрібні підписи */
  --accent: #2F5BEA;     /* 5.6:1 на білому */
  --accent-strong: #1E40AF;
  --accent-soft: #EAF0FE;
  --accent-tint: #F3F6FE;
  --ok-bg: #E7F6EC;   --ok: #166534;
  --warn-bg: #FEF3C7; --warn: #92400E; --warn-line: #FDE68A; --warn-surface: #FFFBEB;
  --bad-bg: #FDECEC;  --bad: #B42318;  --bad-line: #F5C2C0; --bad-surface: #FFF8F7;
  --role-bg: #F1ECFE; --role: #5B21B6;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --focus: 0 0 0 3px rgba(47, 91, 234, 0.35);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }  /* атрибут hidden сильніший за display компонентів (.btn тощо) */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 14px; line-height: 1.5; font-feature-settings: "cv11", "ss01"; }
::selection { background: var(--accent-soft); color: var(--accent-strong); }
* { scrollbar-color: var(--line-strong) transparent; scrollbar-width: thin; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
h1, h2, h3 { text-wrap: balance; margin: 0; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
.num, td.num, .tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.skip-link { position: absolute; left: 16px; top: -48px; background: var(--surface); padding: 8px 12px;
  border-radius: var(--radius-sm); z-index: 10; }
.skip-link:focus { top: 16px; }

/* ---------------------------------------------------------------- оболонка */
.page { min-height: 100vh; padding: 24px; }
.shell { max-width: 1392px; margin: 0 auto; min-height: calc(100vh - 48px); background: var(--surface);
  border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-wrap: wrap; overflow: hidden; }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.topbar { min-height: 56px; padding: 0 24px; border-bottom: 1px solid var(--line); display: flex;
  align-items: center; justify-content: space-between; gap: 12px; }
.crumbs { font-size: 13px; color: var(--muted); }
.content { padding: 28px 36px; display: flex; flex-direction: column; gap: 22px; }
.lede { font-size: 13px; color: var(--muted); max-width: 72ch; line-height: 1.55; }

/* навігація */
.nav { width: 292px; flex-shrink: 0; display: flex; border-right: 1px solid var(--line); }
.rail { width: 56px; border-right: 1px solid var(--line); display: flex; flex-direction: column;
  align-items: center; padding: 16px 0; gap: 6px; }
.rail a { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); color: var(--subtle); }
.rail a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.rail a:hover { color: var(--accent-strong); }
.logo { width: 34px !important; height: 34px !important; border-radius: 9px !important; background: var(--accent);
  color: #fff !important; font-size: 11px; font-weight: 700; text-decoration: none; margin-bottom: 18px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ok-bg); color: var(--ok);
  font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.nav-col { flex: 1; min-width: 0; padding: 24px 18px; display: flex; flex-direction: column; gap: 22px; }
.nav-title { font-size: 15px; font-weight: 600; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-title { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 10px 6px; }
.nav-link { display: flex; align-items: center; justify-content: space-between; min-height: 36px;
  padding: 0 10px; border-radius: var(--radius-sm); color: var(--text-2); font-size: 13px; text-decoration: none; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--accent-tint); color: var(--accent-strong); font-weight: 600; }
.nav-foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 0 10px; display: flex; gap: 8px; align-items: flex-start; line-height: 1.45; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; background: #16A34A; }
.dot.off { background: var(--subtle); }

/* ---------------------------------------------------------------- елементи */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px;
  padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--text); font: inherit; font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer;
  transition: background-color .15s cubic-bezier(.16, 1, .3, 1), border-color .15s; }
.btn:hover { background: var(--surface-2); border-color: var(--subtle); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn-danger { color: var(--bad); border-color: var(--bad-line); }
.btn-danger:hover { background: var(--bad-surface); color: var(--bad); border-color: var(--bad); }
.btn[disabled], .btn[aria-disabled="true"] { background: #E5E7EB; border-color: #E5E7EB; color: var(--muted); cursor: not-allowed; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 12px; }
.btn-block { width: 100%; min-height: 44px; font-size: 14px; }
.htmx-request .btn-primary, .btn-primary.htmx-request { opacity: .7; cursor: progress; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 13px; font-weight: 500; }
.input, select.input, textarea.input { min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong);
  border-radius: 8px; font: inherit; font-size: 14px; color: var(--text); background: var(--surface); width: 100%; }
textarea.input { padding: 10px 12px; min-height: 96px; resize: vertical; line-height: 1.55; }
.input::placeholder { color: var(--subtle); }
.input:focus-visible { box-shadow: var(--focus); border-color: var(--accent); border-radius: 8px; }
.input[aria-invalid="true"] { border-color: var(--bad); }
.hint { font-size: 12px; color: var(--muted); }
.error-text { font-size: 12px; color: var(--bad); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); flex-shrink: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.span-2 { grid-column: 1 / -1; }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 3px 9px;
  border-radius: 999px; background: #F1F2F5; color: var(--text-2); white-space: nowrap; }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-bad { background: var(--bad-bg); color: var(--bad); }
.chip-accent { background: var(--accent-soft); color: var(--accent-strong); }
.chip-role { background: var(--role-bg); color: var(--role); }

.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
label.panel:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
label.panel:hover { border-color: var(--line-strong); }
.panel-quiet { background: var(--surface-2); border-radius: var(--radius); padding: 14px 16px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; font-size: 13px; line-height: 1.5; border: 1px solid; }
.notice svg { flex-shrink: 0; margin-top: 1px; }
.notice-warn { background: var(--warn-surface); border-color: var(--warn-line); color: var(--warn); }
.notice-bad { background: var(--bad-surface); border-color: var(--bad-line); color: var(--bad); }
.notice-ok { background: #F3FBF5; border-color: #BBE5C8; color: var(--ok); }
.notice-info { background: var(--accent-tint); border-color: #C7D4FB; color: var(--accent-strong); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab { min-height: 44px; padding: 0 14px; display: flex; align-items: center; font-size: 13px; color: var(--muted);
  text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab[aria-current="page"] { color: var(--accent-strong); font-weight: 600; border-bottom-color: var(--accent); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; padding: 12px; font-weight: 600; color: var(--text-2); background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td, .table th[scope="row"] { padding: 11px 12px; border-bottom: 1px solid #F1F2F5; vertical-align: top; }
.table th[scope="row"] { background: transparent; font-weight: 400; color: var(--text); white-space: normal; }
.table tr:last-child td, .table tr:last-child th[scope="row"] { border-bottom: 0; }
.table td:first-child, .table th:first-child { padding-left: 16px; }

.list-row { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border: 1px solid var(--line);
  border-radius: var(--radius); flex-wrap: wrap; }
.initials { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent-strong); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.empty { border: 1px dashed var(--line-strong); border-radius: 12px; padding: 32px 28px; display: flex; flex-direction: column;
  align-items: center; gap: 10px; text-align: center; }
.empty strong { font-size: 16px; }
.empty p { color: var(--muted); max-width: 52ch; }

/* етапи кейсу */
.stepper { list-style: none; margin: 0; padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 8px 20px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.stepper li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.stepper-dot { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; border: 1px solid var(--line-strong); color: var(--muted); }
.stepper .done { color: var(--text-2); }
.stepper .done .stepper-dot { background: var(--ok-bg); border-color: var(--ok-bg); color: var(--ok); }
.stepper .current { color: var(--accent-strong); font-weight: 600; }
.stepper .current .stepper-dot { background: var(--accent); border-color: var(--accent); color: #fff; }

/* кейси */
.case-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.case-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 16px;
  border-bottom: 1px solid #F1F2F5; text-decoration: none; color: inherit; }
.case-row:last-child { border-bottom: 0; }
.case-row:hover { background: var(--surface-2); }
.case-row strong { font-size: 14px; display: block; }
.dl { margin: 0; display: grid; grid-template-columns: 170px minmax(0, 1fr); row-gap: 10px; column-gap: 12px; font-size: 13px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.quote { margin: 0; padding: 12px 14px; background: var(--surface-2); border-radius: 8px; font-size: 14px; line-height: 1.6;
  white-space: pre-wrap; max-width: 75ch; }
.values-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pair > div { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin .9s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.rec { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); flex-wrap: wrap; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.rec[data-state="idle"] .rec-dot { background: var(--line-strong); }

/* ---------------------------------------------------------------- екрани без оболонки (вхід) */
.auth-page { min-height: 100vh; padding: 24px; display: flex; align-items: center; justify-content: center; }
.auth-card { width: 100%; max-width: 1000px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow);
  display: flex; flex-wrap: wrap; overflow: hidden; }
.auth-aside { flex: 1 1 380px; padding: 48px; background: var(--accent-tint); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 28px; }
.auth-main { flex: 1 1 380px; padding: 48px; display: flex; flex-direction: column; gap: 20px; }
.auth-narrow { max-width: 560px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; }
.brand-mark { width: 40px; height: 40px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 13px;
  font-weight: 700; display: flex; align-items: center; justify-content: center; }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; font-size: 14px; color: var(--text-2); }
.steps li { display: flex; gap: 10px; }
.steps b { color: var(--accent); }
.qr { width: 200px; height: 200px; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; background: #fff; }

@media (max-width: 760px) {
  .page { padding: 0; }
  .shell { border-radius: 0; min-height: 100vh; }
  .nav { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); }
  .content { padding: 20px 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .auth-aside, .auth-main { padding: 28px 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
