/* twin.vu — основа обеих вёрсток.
   Направление: канон продуктового интерфейса, сыгранный прямо. Плотность без
   тесноты, одна сетка, все состояния проработаны. Брендом служит точность
   деталей, а не приём. */

:root {
  color-scheme: light;

  /* Нейтрали с лёгким уклоном в акцент — не чистый серый. */
  --bg:        #f7f8f8;
  --surface:   #ffffff;
  --surface-2: #f0f2f1;
  --line:      #e0e4e2;
  --line-soft: #ebeeec;
  --text:      #14181a;
  --text-2:    #596460;
  --text-3:    #8a938f;

  --accent:      #0f6e62;
  --accent-hover:#0b574d;
  --accent-wash: #e4f0ed;
  --accent-text: #0b574d;

  --late:      #a45209;   /* ждут дольше недели */
  --late-wash: #fbf0e3;
  --done:      #2f6b45;

  --ui: Onest, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --data: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --r-sm: 8px;
  --r: 12px;
  --measure: 68ch;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:        #101314;
    --surface:   #171b1c;
    --surface-2: #1e2325;
    --line:      #2a3133;
    --line-soft: #222829;
    --text:      #e8ecea;
    --text-2:    #9aa4a0;
    --text-3:    #6e7873;
    --accent:      #4fbfae;
    --accent-hover:#6bd3c3;
    --accent-wash: #14322e;
    --accent-text: #6bd3c3;
    --late:      #d98c46;
    --late-wash: #2c2119;
    --done:      #63b586;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101314; --surface: #171b1c; --surface-2: #1e2325;
  --line: #2a3133; --line-soft: #222829;
  --text: #e8ecea; --text-2: #9aa4a0; --text-3: #6e7873;
  --accent: #4fbfae; --accent-hover: #6bd3c3; --accent-wash: #14322e; --accent-text: #6bd3c3;
  --late: #d98c46; --late-wash: #2c2119; --done: #63b586;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Поверхности, которые рисует браузер, тоже часть интерфейса. */
::selection { background: var(--accent-wash); color: var(--text); }
:root { accent-color: var(--accent); caret-color: var(--accent); scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }

h1, h2, h3 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.021em;
  text-wrap: balance;
  font-weight: 600;
}
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p { margin: 0; max-width: var(--measure); }

a { color: var(--accent-text); text-underline-offset: 3px; }

.num {
  font-family: var(--data);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Вторичный текст: подписи, примечания, заголовки колонок. Один размер на всю
   эту роль — иначе в каждом файле заводится своя шкала. */
.small { font-size: 13px; }

.dim { color: var(--text-2); }
.faint { color: var(--text-3); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; line-height: 1.4;
  padding: 3px 8px; border-radius: 6px;
  background: var(--surface-2); color: var(--text-2);
  white-space: nowrap;
}
.chip.late { background: var(--late-wash); color: var(--late); }
.chip.kind { background: var(--accent-wash); color: var(--accent-text); }
.chip .num { font-size: 11px; }

button {
  font: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 8px 14px;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
button:hover:not(:disabled) { background: var(--surface-2); border-color: var(--text-3); }
button:active:not(:disabled) { transform: translateY(0.5px); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
button.quiet { background: transparent; border-color: transparent; color: var(--text-2); }
button.quiet:hover:not(:disabled) { background: var(--surface-2); color: var(--text); border-color: transparent; }
button:disabled { opacity: .45; cursor: not-allowed; }
button[aria-busy="true"] { color: transparent; position: relative; }
button[aria-busy="true"]::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  color: var(--text-2);
  animation: spin .7s linear infinite;
}

textarea, input {
  font: inherit; font-size: 15px;
  width: 100%; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  resize: vertical;
}
textarea:focus, input:focus { outline: none; border-color: var(--accent); }
textarea::placeholder { color: var(--text-3); }

.draft {
  white-space: pre-wrap;
  background: var(--surface-2);
  border-radius: var(--r);
  padding: 13px 15px;
  font-size: 15px;
}

.alert {
  background: var(--late-wash);
  color: var(--late);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 13.5px;
}

.spinner {
  width: 15px; height: 15px; display: inline-block;
  border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.state {
  display: grid; gap: var(--s2); justify-items: center; text-align: center;
  padding: var(--s7) var(--s5); color: var(--text-2); max-width: 36ch; margin: 0 auto;
}
.state h3 { color: var(--text); }
.state p { font-size: 13px; }

/* Таблица данных: цифры выравниваются по разрядам, заголовки не кричат. */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-weight: 500; font-size: 13px;
  color: var(--text-2); padding: 0 var(--s3) var(--s2) 0;
}
td { padding: var(--s3) var(--s3) var(--s3) 0; border-top: 1px solid var(--line-soft); }
td.num { font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }
