/*
 * Стиль макетов панели Direct Copilot.
 *
 * Токены сняты с нового оформления dante-crm: near-black полотно, мелкие
 * радиусы, ни одной тени вне всплывающих слоёв, холодный синий акцент.
 * Красный — только опасность и бренд, акцентом он не работает.
 */

:root {
  --n-2: oklch(15.2% 0.016 265deg);
  --n-3: oklch(20.5% 0.02 265deg);
  --n-1: oklch(27% 0.023 265deg);
  --n-4: oklch(31.5% 0.025 265deg);
  --n-6: oklch(38.5% 0.026 265deg);
  --n-8: oklch(53% 0.023 265deg);
  --n-9: oklch(69% 0.019 265deg);
  --n-10: oklch(73% 0.017 265deg);
  --n-11: oklch(82% 0.013 265deg);
  --n-12: oklch(94% 0.008 265deg);

  --a-9: oklch(69% 0.155 262deg);
  --a-11: #a8c0fb;
  --a-3: #1b2540;

  --red: #e5231a;
  --ok: oklch(72% 0.16 150deg);
  --warn: oklch(78% 0.14 80deg);

  --ink: var(--n-12);
  --ink-2: var(--n-11);
  --ink-3: var(--n-10);
  --ink-faint: var(--n-9);
  --line: var(--n-6);

  --r-sm: 6px;
  --r-card: 12px;
  --r-pill: 999px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  width: 1440px;
  height: 900px;
  display: grid;
  grid-template-columns: 232px 1fr;
  background: var(--n-2);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- сайдбар */

.side {
  background: var(--n-3);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 6px;
}

.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: var(--r-sm);
  background: var(--red);
  display: grid;
  place-items: center;
  font-family: 'Unbounded', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.brand-name {
  font-family: 'Unbounded', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0 6px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
}

.nav-item.is-active {
  background: var(--n-4);
  color: var(--ink);
}

.nav-item-label {
  display: flex;
  align-items: center;
  gap: 9px;
}

.nav-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-faint);
}

.nav-count.is-alert {
  color: var(--a-11);
}

.side-foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.side-foot-row {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-faint);
}

.side-foot-row b {
  color: var(--ink-3);
  font-weight: 500;
}

/* ------------------------------------------------------------------ шапка */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}

.top-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

h1 {
  font-family: 'Unbounded', sans-serif;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.top-sub {
  color: var(--ink-faint);
  font-size: 12px;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--ink-2);
  font-size: 12px;
}

.chip-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

.btn {
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--a-9);
  color: #08122b;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  line-height: normal;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-2);
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--red);
}

/* ----------------------------------------------------------------- полотно */

.body {
  flex: 1;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.card {
  background: var(--n-1);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.card-title {
  font-size: 13px;
  font-weight: 600;
}

.card-note {
  color: var(--ink-faint);
  font-size: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid color-mix(in oklch, var(--line) 55%, transparent);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: 0;
}

.num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  text-align: right;
}

.muted {
  color: var(--ink-faint);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tag-ok {
  background: color-mix(in oklch, var(--ok) 18%, transparent);
  color: var(--ok);
}

.tag-warn {
  background: color-mix(in oklch, var(--warn) 18%, transparent);
  color: var(--warn);
}

.tag-alert {
  background: color-mix(in oklch, var(--red) 22%, transparent);
  color: #ff8a82;
}

.tag-idle {
  background: var(--n-4);
  color: var(--ink-3);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat {
  background: var(--n-1);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 14px 16px;
}

.stat-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.stat-value {
  font-family: 'Unbounded', sans-serif;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-top: 8px;
}

.stat-hint {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
}

.stat-hint.is-bad {
  color: #ff8a82;
}

.stat-hint.is-good {
  color: var(--ok);
}

/* ------------------------------------------------------------- наблюдения */

.finding {
  display: grid;
  grid-template-columns: 132px 1fr 168px;
  gap: 16px;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid color-mix(in oklch, var(--line) 55%, transparent);
}

.finding:last-child {
  border-bottom: 0;
}

.finding-text b {
  font-weight: 600;
}

.finding-note {
  color: var(--ink-3);
  font-size: 12px;
  margin-top: 2px;
}

.finding-fact {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-2);
  text-align: right;
}

/* ------------------------------------------------------------ план правок */

.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border: 1px solid color-mix(in oklch, var(--a-9) 40%, transparent);
  background: var(--a-3);
  border-radius: var(--r-card);
  color: var(--a-11);
  font-size: 12px;
}

.op {
  display: grid;
  grid-template-columns: 26px 150px 1fr 236px 128px;
  gap: 14px;
  align-items: start;
  padding: 13px 16px;
  border-bottom: 1px solid color-mix(in oklch, var(--line) 55%, transparent);
}

.op:last-child {
  border-bottom: 0;
}

.op .tag {
  justify-self: start;
}

.op.is-blocked {
  background: color-mix(in oklch, var(--red) 7%, transparent);
}

.box {
  width: 15px;
  height: 15px;
  margin-top: 2px;
  border: 1px solid var(--n-8);
  border-radius: 4px;
  display: grid;
  place-items: center;
}

.box.is-on {
  background: var(--a-9);
  border-color: var(--a-9);
}

.box.is-off {
  border-style: dashed;
  opacity: 0.5;
}

.box svg {
  display: block;
}

.op-object {
  font-weight: 600;
}

.op-why {
  color: var(--ink-3);
  font-size: 12px;
  margin-top: 3px;
}

.diff {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}

.diff-was {
  color: var(--ink-faint);
  text-decoration: line-through;
  text-decoration-color: color-mix(in oklch, var(--ink-faint) 60%, transparent);
}

.diff-arrow {
  color: var(--ink-faint);
}

.diff-now {
  color: var(--a-11);
}

.diff-note {
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 3px;
}

.op-effect {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  text-align: right;
  color: var(--ink-2);
}

.op-effect small {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 3px;
}

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--n-3);
}

.foot-summary {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.foot-count {
  font-family: 'Unbounded', sans-serif;
  font-size: 14px;
  font-weight: 500;
}

.foot-note {
  color: var(--ink-3);
  font-size: 12px;
}

.foot-actions {
  display: flex;
  gap: 8px;
}

/* ---------------------------------------------------------------- журнал */

.log-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
}

.log-diff {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
}

.log-actor {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar {
  width: 22px;
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--n-4);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
}

.btn-mini {
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  line-height: normal;
}

/* ================================================================
 * Живая панель: то, чего не было в статичных макетах.
 * ================================================================ */

body {
  /* В макетах размер полотна был фиксированным — здесь окно любое. */
  width: auto;
  height: 100vh;
  overflow: hidden;
}

.main {
  overflow: hidden;
}

.body {
  overflow-y: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

.link {
  color: var(--a-11);
}

.link:hover {
  text-decoration: underline;
}

.nav-item:hover {
  background: var(--n-4);
  color: var(--ink);
}

tbody tr:hover {
  background: color-mix(in oklch, var(--n-4) 60%, transparent);
}

button {
  cursor: pointer;
  font-family: inherit;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}

.btn-ghost:hover {
  border-color: var(--n-8);
  color: var(--ink);
  filter: none;
}

/* ------------------------------------------------------- вход в панель */

.login {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  height: 100vh;
}

.login-card {
  /* Фиксированные 340px не влезали в узкое окно и обрезались по правому краю. */
  width: min(340px, 100% - 32px);
  background: var(--n-1);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 28px 26px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}

input[type='password'],
input[type='text'],
input[type='number'] {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  background: var(--n-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
}

input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--a-9);
  outline-offset: 2px;
}

.error {
  color: #ff8a82;
  font-size: 12px;
  margin-bottom: 12px;
}

/* --------------------------------------------------- переключатель managed */

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 26px;
  padding: 0 10px 0 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: normal;
  white-space: nowrap;
}

.switch-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--n-6);
  transition: background 0.12s ease;
}

.switch.is-on {
  border-color: color-mix(in oklch, var(--ok) 45%, transparent);
  color: var(--ok);
}

.switch.is-on .switch-dot {
  background: var(--ok);
}

.switch:hover {
  border-color: var(--n-8);
}

/* ------------------------------------------------------- пустые состояния */

.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--ink-faint);
}

.empty-title {
  font-family: 'Unbounded', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: var(--ink-2);
  margin-bottom: 8px;
}

.empty-text {
  font-size: 12.5px;
  max-width: 44ch;
  margin: 0 auto;
}

/* ------------------------------------------------------------- фильтры */

.tabs {
  display: flex;
  gap: 6px;
}

.tab {
  height: 28px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  color: var(--ink-3);
  font-size: 12px;
}

.tab:hover {
  color: var(--ink);
}

.tab.is-active {
  background: var(--n-4);
  border-color: var(--line);
  color: var(--ink);
}

.tab-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-faint);
}

/* --------------------------------------------------------------- прочее */

.flash {
  padding: 10px 14px;
  border-radius: var(--r-card);
  border: 1px solid color-mix(in oklch, var(--ok) 40%, transparent);
  background: color-mix(in oklch, var(--ok) 12%, transparent);
  color: var(--ok);
  font-size: 12.5px;
}

.flash.is-bad {
  border-color: color-mix(in oklch, var(--red) 45%, transparent);
  background: color-mix(in oklch, var(--red) 12%, transparent);
  color: #ff8a82;
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.spin {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.6px solid color-mix(in oklch, currentColor 30%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Версия и время сборки — отдельной строкой под меню, чтобы не слипалась
   с «Выйти» на узком экране. */
.side-foot-version {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-faint);
  padding-top: 4px;
  border-top: 1px solid color-mix(in oklch, var(--line) 50%, transparent);
  margin-top: 4px;
  word-break: break-word;
}
