/* Оформление панели. Токены — те же, что в основном Kimi (CLAUDE.md §9), и это
   не совпадение: два продукта одной команды не должны выглядеть чужими друг
   другу, а сотрудник ходит в оба.

   Чего здесь нет намеренно: градиентов, теней, блюра, второго шрифта и
   декоративной анимации. Панель читают восемь часов подряд. */

:root {
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --surface-sunken: #F1F3F6;
  --ink: #1F2430;
  --ink-soft: #6B7280;
  --ink-faint: #9CA3AF;
  --line: #E5E7EB;
  --line-strong: #D1D5DB;

  --blue: #4C6FFF;
  --blue-ink: #3450CC;
  --blue-bg: #EAEEFF;

  --green: #22A06B;
  --green-bg: #E6F6EF;

  --amber: #F5A623;
  --amber-bg: #FEF3DD;

  --red: #E5484D;
  --red-bg: #FDEAEA;

  --radius: 10px;
  --sidebar: 232px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-ink); }

/* ── Каркас ───────────────────────────────────────────────────────────────── */

.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand {
  font-weight: 600;
  font-size: 15px;
  padding: 4px 10px 16px;
  color: var(--ink);
}
.brand span { color: var(--ink-faint); font-weight: 400; display: block; font-size: 12px; }

.nav-group { margin-top: 14px; }
.nav-group h4 {
  margin: 0 0 6px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-faint);
}
.nav a {
  display: flex;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--ink);
}
.nav a:hover { background: var(--surface-sunken); }
.nav a.active { background: var(--blue-bg); color: var(--blue-ink); font-weight: 500; }
.nav .count { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.nav a.active .count { color: var(--blue-ink); }

.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); }
.sidebar-foot .who { font-size: 13px; }
.sidebar-foot .role { color: var(--ink-faint); font-size: 12px; }

.main { padding: 24px 28px; min-width: 0; }
.page-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 600; }
.page-head .muted { color: var(--ink-soft); }

/* ── Карточки и таблицы ───────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card + .card { margin-top: 16px; }
.card-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-body { padding: 16px; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-sunken); }

.empty { padding: 40px 16px; text-align: center; color: var(--ink-soft); }

/* ── Мелочи ───────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface-sunken);
  color: var(--ink-soft);
}
.badge.blue { background: var(--blue-bg); color: var(--blue-ink); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: #8a5a00; }
.badge.red { background: var(--red-bg); color: var(--red); }

.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }

button, .button {
  font: inherit;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
button:hover { background: var(--surface-sunken); }
button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
button.primary:hover { background: var(--blue-ink); border-color: var(--blue-ink); }
button:disabled { opacity: .5; cursor: default; }
button.danger { color: var(--red); border-color: var(--line-strong); }

input, textarea, select {
  font: inherit;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blue);
}
label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.field + .field { margin-top: 14px; }

.error {
  background: var(--red-bg);
  color: var(--red);
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
}
.error:empty { display: none; }

/* ── Вход ─────────────────────────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card { width: 360px; max-width: 100%; }
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card .sub { color: var(--ink-soft); margin-bottom: 20px; }

/* ── Разговор ─────────────────────────────────────────────────────────────── */

.workspace { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .workspace { grid-template-columns: 1fr; } }

.thread {
  height: 60vh;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface-sunken);
}
.msg { max-width: 72%; padding: 9px 12px; border-radius: var(--radius); background: var(--surface); }
.msg.out { align-self: flex-end; background: var(--blue-bg); }
.msg.system { align-self: center; background: transparent; color: var(--ink-faint); font-size: 12px; }
.msg .meta { font-size: 11px; color: var(--ink-faint); margin-top: 4px; display: flex; gap: 8px; }
.msg .body { white-space: pre-wrap; word-wrap: break-word; }
.msg .state.failed { color: var(--red); }
.msg .state.generated { color: var(--amber); }

.composer { padding: 14px 16px; border-top: 1px solid var(--line); }
.composer textarea { min-height: 74px; resize: vertical; }
.composer-row { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.composer-row select { width: auto; }
.composer-row .grow { flex: 1; }

.side-block + .side-block { margin-top: 12px; }
.side-block dt { font-size: 12px; color: var(--ink-faint); }
.side-block dd { margin: 2px 0 10px; }

.note { padding: 10px 12px; background: var(--amber-bg); border-radius: 8px; font-size: 13px; }
.note + .note { margin-top: 8px; }
.note .when { color: #8a5a00; font-size: 11px; }

/* ── Вложения ─────────────────────────────────────────────────────────────── */

.attachment {
  display: block;
  max-width: 100%;
  max-height: 260px;
  border-radius: 8px;
  margin-bottom: 6px;
}
audio.attachment { max-height: none; width: 260px; }
.attachment-link {
  display: inline-block;
  margin-bottom: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
}
