/* Стиль «Пульт», правила и имена токенов — docs/UI.md. Цвет — только токеном; литералы живут в блоках :root ниже. */
:root {
  --bg: #f1f1ef; --surface: #ffffff; --surface-2: #f6f6f4; --text: #1e2023; --muted: #5d6066; --line: #dedfdd;
  --band: #24272c; --band-text: #f1f1ef; --band-muted: #b5b8bd; --band-active: #3a3e45; --band-focus: #eba94d;
  --accent: #96500a; --on-accent: #ffffff; --ok: #1f6b4a; --warn: #8f5500; --danger: #ae2c23; --on-danger: #ffffff;
  --ok-soft: #dfefe7; --warn-soft: #f6ead6; --danger-soft: #f8e1de; --neutral-soft: #ebebe8; --focus: #96500a;
  --shadow: 0 1px 2px rgba(30, 32, 35, .07), 0 6px 18px rgba(30, 32, 35, .06);
  --shadow-dialog: 0 10px 40px rgba(0, 0, 0, .3); --backdrop: rgba(20, 21, 23, .55);
  --radius: 14px; --radius-control: 9px; --gap: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-family: var(--font); color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181a; --surface: #212326; --surface-2: #292b2f; --text: #ececea; --muted: #a4a6aa; --line: #33353a;
    --band: #0e0f10; --band-text: #ececea; --band-muted: #a4a6aa; --band-active: #2b2d31; --band-focus: #eba94d;
    --accent: #eba94d; --on-accent: #241503; --ok: #6ccb9f; --warn: #e6b05e; --danger: #f4918a; --on-danger: #2a0c0a;
    --ok-soft: #1b3329; --warn-soft: #382b15; --danger-soft: #3c2120; --neutral-soft: #2d2f33; --focus: #eba94d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .2);
    --shadow-dialog: 0 10px 40px rgba(0, 0, 0, .55); --backdrop: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; }
a { color: var(--accent); }
h2 { font-size: 16px; font-weight: 650; margin: 0 0 10px; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 12.5px; }
.note { margin: 10px 0 0; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap { gap: 10px; }
.wrap { flex-wrap: wrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Шапка: на входе полоса сверху, в работе боковая панель (её включает data-view="app" страницы приложения). */
.top { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 10px 28px;
  background: var(--band); color: var(--band-text); }
.top :focus-visible { outline-color: var(--band-focus); }
.brand { font-weight: 700; letter-spacing: .2px; }
.tabs { display: flex; gap: 2px; }
.tabs button { background: none; border: 0; padding: 6px 14px; border-radius: 8px; color: var(--band-muted); font: inherit; text-align: left; }
.tabs button:hover:not(:disabled) { background: none; color: var(--band-text); }
.tabs button.active, .tabs button.active:hover:not(:disabled) { background: var(--band-active); color: var(--band-text); font-weight: 600; }
.top-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.top-right button { color: var(--band-text); }
.me { color: var(--band-muted); overflow-wrap: anywhere; }
.top-right button:hover:not(:disabled) { background: var(--band-active); }
main { max-width: 1140px; margin: 0 auto; padding: 24px 28px; }

@media (min-width: 721px) {
  body[data-view="app"] { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
  body[data-view="app"] main { width: 100%; }
  body[data-view="app"] .top { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 20px; padding: 18px 14px; height: 100vh; }
  body[data-view="app"] .brand { padding: 0 10px; }
  body[data-view="app"] .tabs { flex-direction: column; }
  body[data-view="app"] .top-right { margin: auto 0 0; flex-direction: column; align-items: flex-start; padding: 0 10px; }
  body[data-view="app"] .top-right button { padding: 6px 12px; }
  body[data-view="app"] .top-right button:hover:not(:disabled) { background: none; }
}
@media (max-width: 720px) {
  .top { position: static; padding: 10px 16px; }
  .tabs { order: 3; flex-basis: 100%; overflow-x: auto; }
  .tabs button { padding: 6px 8px; font-size: 13px; }
  .top-right button { padding: 6px 8px; }
  main { padding: 16px; }
  .card { padding: 16px; }
}

/* Карточка и показатель */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: var(--gap); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 24px; font-weight: 650; line-height: 1.2; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.2px; overflow-wrap: anywhere; }
.stat .sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; overflow-wrap: anywhere; }

/* Действия и поля */
button { font: inherit; border-radius: var(--radius-control); padding: 8px 16px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
button:hover:not(:disabled) { background: var(--surface-2); }
button.primary, button.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
button.primary:hover:not(:disabled) { filter: brightness(1.08); }
button.destructive, button.destructive:hover:not(:disabled) { background: var(--danger); border-color: var(--danger); color: var(--on-danger); font-weight: 600; }
button.destructive:hover:not(:disabled) { filter: brightness(1.08); }
button.ghost { background: transparent; }
button.danger { color: var(--danger); border-color: transparent; }
button:disabled { opacity: .55; cursor: default; }
input, select { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); color: var(--text); max-width: 100%; }
input[type=search] { width: 240px; }
@media (max-width: 720px) { input[type=search] { width: 100%; } }
input[type=checkbox] { accent-color: var(--accent); }
[aria-invalid="true"] { border-color: var(--danger); }
.switch { display: flex; gap: 8px; align-items: center; color: var(--muted); cursor: pointer; }

/* Форма: одна раскладка на все экраны, ячейки сами собираются в ряд или столбец по ширине. */
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 14px 20px; align-items: end; }
.form label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 13px; min-width: 0; }
.form label input, .form label select { color: var(--text); font-size: 14px; width: 100%; }
.form > button { justify-self: start; }
.form > p { grid-column: 1 / -1; margin: 0; }
.form-action { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.form-action .msg { margin: 0; }
.note + .form { margin-top: 14px; }

/* Метка: короткий статус, единственный вид */
.badge { display: inline-block; font-size: 12px; font-weight: 600; line-height: 1.5; padding: 1px 10px; border-radius: 999px; background: var(--neutral-soft); color: var(--muted); white-space: nowrap; }
.badge.ok { 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); }
td.title .badge { margin-left: 6px; }

/* Сообщение: рядом с действием; band — полоса над страницей для состояния системы */
.msg { margin: 10px 0 0; }
.msg.bad { color: var(--danger); }
.msg.ok { color: var(--ok); font-weight: 600; }
.msg.warn { color: var(--warn); }
.msg.info { color: var(--muted); }
.msg.band { margin: 0 0 var(--gap); padding: 11px 16px; border-radius: 12px; background: var(--warn-soft); color: var(--text); font-weight: 400; }
.msg.band.bad { background: var(--danger-soft); }
.msg.band.info { background: var(--neutral-soft); }

/* Прогресс */
.progress { margin-top: 16px; }
.progress-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 6px; font-weight: 600; }
.progress-pct { font-size: 18px; font-variant-numeric: tabular-nums; }
.bar { height: 12px; border-radius: 99px; background: var(--neutral-soft); overflow: hidden; }
.bar div { height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.progress p { margin-top: 6px; overflow-wrap: anywhere; }

/* Таблица: прокручивается внутри своей обёртки, страница — никогда */
.table-wrap { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
td.title { white-space: normal; min-width: 220px; }
tbody tr:hover td { background: var(--surface-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Подтверждение */
.dialog { border: 0; border-radius: var(--radius); padding: 22px 24px; width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-dialog); }
.dialog::backdrop { background: var(--backdrop); }
.dialog h2 { margin-bottom: 8px; }
.dialog p { margin: 0 0 18px; overflow-wrap: anywhere; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

/* Вход, приглашение, смена пароля, разрешение для Claude */
.sign-screen { max-width: 460px; margin: 64px auto; }
.sign-screen .form { margin-top: 14px; }
.sign-screen .reset { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }

/* Команда: карточка на человека */
.person-meta { margin-top: 6px; }
.person .badge.me-mark { margin-left: 6px; }
.link-box { margin-top: 14px; }
.link-box .msg { margin: 0 0 8px; }
.link-box input { flex: 1 1 280px; min-width: 0; }
.link-box .note { margin-top: 8px; }
