:root {
  --navy: #1A2B49;
  --navy-2: #24395E;
  --accent: #D99B00;
  --accent-soft: #FBEFCE;
  --ground: #F2F4F7;
  --surface: #FFFFFF;
  --surface-2: #E9EDF3;
  --ink: #131B29;
  --ink-2: #55627A;
  --ink-3: #8A94A6;
  --line: #D8DEE8;
  --ok: #2B6E52;
  --ok-soft: #DFEDE6;
  --warn: #92601A;
  --warn-soft: #F8EAD1;
  --stop: #A63B2B;
  --stop-soft: #F7E0DB;
  --radius: 8px;
  --sidebar: 208px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

[x-cloak] { display: none !important; }

a { color: var(--navy-2); }

/* ---------- каркас ---------- */

.layout { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--navy);
  color: #E7ECF4;
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; padding: 0 10px; }
.brand span { color: var(--accent); }

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

.nav a {
  color: #C2CCDC;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.nav a:hover { background: #ffffff14; color: #fff; }
.nav a.active { background: var(--accent); color: #2A1F00; font-weight: 600; }

.nav .count {
  background: #ffffff26;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 12px;
}

.nav a.active .count { background: #2A1F0026; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.sidebar-foot .who { color: #9DAFC9; padding: 0 10px; }

.lang-switch { display: flex; gap: 4px; padding: 0 10px; }
.lang-switch button {
  flex: 1;
  background: #ffffff14;
  border: 0;
  color: #C2CCDC;
  padding: 5px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
}
.lang-switch button.on { background: var(--accent); color: #2A1F00; font-weight: 600; }

.main { padding: 26px 30px 80px; max-width: 1280px; }

.page-head { margin-bottom: 20px; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin: 0 0 3px; letter-spacing: -0.01em; }
.page-head p { margin: 0; color: var(--ink-2); font-size: 14px; }
.page-head .actions { display: flex; gap: 8px; }

/* ---------- элементы ---------- */

.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 7px 13px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { border-color: var(--ink-3); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #2A1F00; font-weight: 600; }
.btn.danger { color: var(--stop); border-color: #E4BDB5; }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input[type=text], input[type=url], input[type=date], input[type=number], textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  font: inherit;
  font-size: 14px;
  background: var(--surface);
  color: var(--ink);
}
textarea { resize: vertical; min-height: 68px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .05em; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.cards { display: grid; gap: 12px; }
.cards.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.cards.three { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

.pill {
  display: inline-block;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.stop { background: var(--stop-soft); color: var(--stop); }
.pill.accent { background: var(--accent-soft); color: #7A5700; }

.muted { color: var(--ink-3); font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }

.empty { padding: 40px; text-align: center; color: var(--ink-3); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- материалы ---------- */

.source { display: flex; flex-direction: column; gap: 10px; }
.source h3 { margin: 0; font-size: 16px; }
.source .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.crm { background: var(--surface-2); border-radius: 6px; padding: 10px 12px; font-size: 13px; }
.crm dl { margin: 0; display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 3px 12px; }
.crm dt { color: var(--ink-2); }
.crm dd { margin: 0; }

/* ---------- доска ---------- */

.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.col h3 { margin: 0 0 9px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); display: flex; justify-content: space-between; }
.clip-card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.clip-card:hover { border-color: var(--accent); }
.clip-card h4 { margin: 0 0 4px; font-size: 14px; }
.clip-card .chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }

/* ---------- апрув ---------- */

.review-item { display: grid; grid-template-columns: 1fr 300px; gap: 18px; }
@media (max-width: 900px) { .review-item { grid-template-columns: 1fr; } }

.player { width: 100%; border-radius: 6px; background: #000; aspect-ratio: 9/16; max-height: 460px; }

/* ---------- публикация ---------- */

.post-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 14px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.post-row:last-child { border-bottom: 0; }
.copyable { background: var(--surface-2); border-radius: 6px; padding: 8px 10px; font-size: 13px; white-space: pre-wrap; }

/* ---------- загрузка ---------- */

.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .2s; }

/* ---------- вход ---------- */

.login { min-height: 100vh; display: grid; place-items: center; background: var(--navy); }
.login .box { background: var(--surface); border-radius: 12px; padding: 34px 36px; width: min(420px, 92vw); text-align: center; }
.login h1 { font-size: 21px; margin: 0 0 8px; }
.login p { color: var(--ink-2); font-size: 14px; margin: 0 0 20px; }

/* ---------- тосты ---------- */

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--navy); color: #fff; padding: 10px 15px; border-radius: 6px; font-size: 14px; box-shadow: 0 6px 20px #0003; }
.toast.err { background: var(--stop); }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin: 0; flex-direction: row; align-items: center; }
  .main { padding: 18px 16px 60px; }
}
