/* Фирменные ориентиры ОАК: синий #143D8D, серый #6A747C, авиационная строгость */

:root,
[data-theme="light"] {
  --oak-blue: #143d8d;
  --oak-blue-2: #1c4fb0;
  --oak-gray: #6a747c;
  --ink: #152033;
  --muted: #6a747c;
  --paper: #eef2f7;
  --panel: rgba(255, 255, 255, 0.92);
  --line: #c9d2dc;
  --steel: #143d8d;
  --steel-2: #1c4fb0;
  --accent: #2a6bb5;
  --accent-soft: #d9e6f7;
  --ok: #2f6b4f;
  --warn: #9a5b16;
  --err: #8f2d2d;
  --rail: #0f274f;
  --rail-text: #e8eef8;
  --shadow: 0 12px 32px rgba(20, 61, 141, 0.12);
  --bg:
    radial-gradient(circle at 12% 8%, rgba(20, 61, 141, 0.12), transparent 42%),
    linear-gradient(165deg, #e8eef8 0%, #f5f7fb 48%, #e4ebf4 100%);
  --glass: blur(0px);
  --panel-border: 1px solid var(--line);
  --choice-bg: #ffffff;
  --choice-active-bg: #eaf1fb;
  --choice-active-muted: #5a6f88;
  --font-ui: "Segoe UI", "Candara", sans-serif;
  --font-display: "Cambria", "Georgia", serif;
}

[data-theme="dark"] {
  --ink: #eaf0f8;
  --muted: #a7b4c4;
  --paper: #0b1528;
  --panel: #162a45;
  --line: #3a5278;
  --steel: #5b8fef;
  --steel-2: #7aa6f5;
  --accent: #8bb8ff;
  --accent-soft: #1e3a66;
  --choice-bg: #1a3154;
  --choice-active-bg: #234a7a;
  --choice-active-muted: #c5d4e8;
  --ok: #6dbf95;
  --warn: #e0a85a;
  --err: #e28a8a;
  --rail: #091322;
  --rail-text: #eaf0f8;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  --bg:
    radial-gradient(circle at 82% 0%, rgba(43, 90, 170, 0.22), transparent 42%),
    linear-gradient(180deg, #08111f 0%, #0e1a2f 52%, #12233d 100%);
  --panel-border: 1px solid var(--line);
}

[data-theme="glass"] {
  --ink: #10203a;
  --muted: #4f6278;
  --paper: transparent;
  --panel: rgba(255, 255, 255, 0.42);
  --line: rgba(255, 255, 255, 0.45);
  --steel: #143d8d;
  --steel-2: #1c4fb0;
  --accent: #1c4fb0;
  --accent-soft: rgba(255, 255, 255, 0.35);
  --ok: #2f6b4f;
  --warn: #9a5b16;
  --err: #8f2d2d;
  --rail: rgba(15, 39, 79, 0.55);
  --rail-text: #f2f6fc;
  --shadow: 0 18px 50px rgba(15, 39, 79, 0.18);
  --bg:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,0.55), transparent 35%),
    radial-gradient(circle at 85% 10%, rgba(20, 61, 141, 0.35), transparent 40%),
    linear-gradient(135deg, #9eb6de 0%, #d7e3f4 40%, #b9cceb 100%);
  --glass: blur(18px) saturate(1.25);
  --panel-border: 1px solid rgba(255, 255, 255, 0.55);
  --choice-bg: rgba(255, 255, 255, 0.55);
  --choice-active-bg: rgba(255, 255, 255, 0.78);
  --choice-active-muted: #4f6278;
}

body {
  color: var(--ink);
  background: var(--bg);
  background-attachment: fixed;
}

.rail {
  background: var(--rail);
  color: var(--rail-text);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}

.panel,
.struct-tree,
.struct-editor,
.choice,
.block-card,
.finding,
.modal,
.auth-card,
.stat-card,
.admin-table-wrap {
  background: var(--panel);
  border: var(--panel-border);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}

.btn {
  background: color-mix(in srgb, var(--panel) 88%, white);
  color: var(--ink);
  border-color: var(--line);
}
.btn.primary {
  background: var(--steel);
  border-color: var(--steel);
  color: #fff;
}
.btn.ghost {
  color: var(--rail-text);
  border-color: rgba(255, 255, 255, 0.2);
  background: transparent;
}

.field input,
.field select,
.field textarea,
.te-grid input {
  background: color-mix(in srgb, var(--panel) 80%, white);
  color: var(--ink);
  border-color: var(--line);
}

[data-theme="dark"] .field input,
[data-theme="dark"] .field select,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .te-grid input,
[data-theme="dark"] .btn:not(.primary):not(.accent):not(.ghost) {
  background: #0f1c33;
  color: var(--ink);
}

[data-theme="dark"] .badge {
  background: #1a3154;
  border-color: #3a5278;
  color: #d7e4f7;
}

[data-theme="dark"] .tree-item.selected,
[data-theme="dark"] .tree-item:hover {
  background: #1e3a66;
}

[data-theme="dark"] .block-card {
  background: #1a3154;
}

[data-theme="dark"] .empty {
  color: var(--muted);
  border-color: #3a5278;
}

[data-theme="dark"] .table-preview th {
  background: #1e3a66;
}

[data-theme="dark"] .modal-head,
[data-theme="dark"] .modal-foot {
  border-color: #3a5278;
}

.theme-switch {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px;
  border-radius: 10px;
}
.theme-switch button {
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.theme-switch button.active {
  background: rgba(255, 255, 255, 0.16);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--rail-text);
  opacity: 0.95;
}
