/* CEO Media — strict control panel. One accent (dark primary button), status by words, tables for lists. */
:root {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --ink: #1B1F27;
  --text: #2B3038;
  --muted: #6B7280;
  --line: #DDE1E6;
  --line-strong: #C3C9D1;
  --field: #FFFFFF;
  --hover: #F0F2F5;
  --primary: #1B1F27;
  --primary-ink: #FFFFFF;
  --ok: #1E7F4E;
  --ok-bg: #E7F4EC;
  --warn: #9A4B00;
  --warn-bg: #FBEEDC;
  --bad: #B3261E;
  --bad-bg: #FBE9E7;
  --info: #2B5FA3;
  --info-bg: #E6EEF9;
  --ad: #C27700;
  --focus: #2B5FA3;
  --r: 6px;
  --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171B; --surface: #1E2127; --ink: #F1F3F5; --text: #D7DBE0; --muted: #9AA1AB; --line: #2E333B; --line-strong: #434A54;
    --field: #181B20; --hover: #262A31; --primary: #E6E8EB; --primary-ink: #15171B;
    --ok: #4FBF83; --ok-bg: #16301F; --warn: #E5A04C; --warn-bg: #352714; --bad: #F08A80; --bad-bg: #3A1D1A; --info: #7DA6E8; --info-bg: #1B2A40;
    --ad: #E5A04C; --focus: #7DA6E8; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171B; --surface: #1E2127; --ink: #F1F3F5; --text: #D7DBE0; --muted: #9AA1AB; --line: #2E333B; --line-strong: #434A54;
  --field: #181B20; --hover: #262A31; --primary: #E6E8EB; --primary-ink: #15171B;
  --ok: #4FBF83; --ok-bg: #16301F; --warn: #E5A04C; --warn-bg: #352714; --bad: #F08A80; --bad-bg: #3A1D1A; --info: #7DA6E8; --info-bg: #1B2A40;
  --ad: #E5A04C; --focus: #7DA6E8; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.boot { padding: 40px; color: var(--muted); }
h1 { font-size: 20px; font-weight: 600; color: var(--ink); margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; color: var(--ink); margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.ink { color: var(--ink); }
.nowrap { white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar .in { max-width: 1200px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 24px; height: 52px; }
.brand { font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.brand i { width: 20px; height: 20px; border-radius: 5px; background: var(--primary); display: inline-block; position: relative; }
.brand i::before { content: ''; position: absolute; left: 5px; right: 5px; top: 5px; height: 2px; background: var(--primary-ink); box-shadow: 0 4px 0 var(--primary-ink), 0 8px 0 var(--primary-ink); }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav a { color: var(--text); padding: 0 11px; height: 52px; display: flex; align-items: center; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav a:hover { text-decoration: none; color: var(--ink); }
.nav a.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }
.nav a .n { margin-left: 6px; background: var(--bad); color: #fff; border-radius: 9px; font-size: 11px; padding: 0 6px; }
.topbar .right { display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); vertical-align: 0; margin-right: 6px; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }

main { max-width: 1200px; margin: 0 auto; padding: 24px 24px 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 2px; max-width: 70ch; }

/* ---------- blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.card > .hd { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card > .bd { padding: 16px; }
.card > .bd + .bd { border-top: 1px solid var(--line); }
.stack { display: grid; gap: 16px; }
.stack-s { display: grid; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 20px; align-items: start; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.aside { position: sticky; top: 68px; display: grid; gap: 16px; }
.notice { padding: 10px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.notice.bad { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.notice.warn { border-color: var(--warn); background: var(--warn-bg); color: var(--warn); }
.notice.ok { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.empty { color: var(--muted); padding: 24px 16px; text-align: center; }

/* ---------- controls ---------- */
.btn { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: var(--r); padding: 7px 13px; cursor: pointer; font-weight: 500; line-height: 1.3; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.primary:hover { opacity: .92; background: var(--primary); }
.btn.lg { padding: 10px 18px; font-size: 15px; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.danger { color: var(--bad); }
.btn.quiet { border-color: transparent; background: none; color: var(--info); padding-left: 6px; padding-right: 6px; }
.btn.quiet:hover { background: var(--hover); }
.btn[disabled] { opacity: .5; cursor: default; }
.field { display: grid; gap: 5px; }
.field > span, label.field > span, .lbl { font-weight: 500; color: var(--ink); font-size: 13px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
input[type=text], input[type=url], input[type=date], input[type=time], input[type=number], input[type=password], input[type=tel], input[type=search], select, textarea {
  border: 1px solid var(--line-strong); background: var(--field); border-radius: var(--r); padding: 7px 10px; width: 100%; min-width: 0; }
input:disabled, select:disabled { background: var(--hover); color: var(--muted); }
textarea { resize: vertical; min-height: 160px; line-height: 1.45; font-family: var(--font); }
.check { display: flex; gap: 9px; align-items: flex-start; cursor: pointer; font-weight: 400; }
.check input { margin: 4px 0 0; }
.check small { display: block; color: var(--muted); }
.tabs { display: flex; border-bottom: 1px solid var(--line); gap: 2px; }
.tabs button { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; }
.seg button { border: 0; border-left: 1px solid var(--line-strong); background: var(--surface); padding: 6px 12px; cursor: pointer; color: var(--text); }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--primary); color: var(--primary-ink); }
.fmt { display: flex; gap: 4px; flex-wrap: wrap; }
.fmt button { border: 1px solid var(--line); background: var(--surface); border-radius: 4px; min-width: 30px; padding: 3px 8px; cursor: pointer; font-size: 13px; }
.fmt button:hover { background: var(--hover); }
.choices { border: 1px solid var(--line-strong); border-radius: var(--r); max-height: 220px; overflow: auto; background: var(--field); }
.choices label { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-top: 1px solid var(--line); cursor: pointer; }
.choices label:first-child { border-top: 0; }
.choices label:hover { background: var(--hover); }
.choices label .sub { color: var(--muted); font-size: 12.5px; margin-left: auto; }
.btnrow { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 6px; align-items: center; }
.btnrows { display: grid; gap: 6px; }
.btnrows .sep { color: var(--muted); font-size: 12px; padding: 4px 0 0; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12.5px; border-top: 0; background: var(--hover); white-space: nowrap; }
tr:hover td { background: var(--hover); }
td.num, th.num { text-align: right; }
td.act { white-space: nowrap; text-align: right; }
td .sub { display: block; color: var(--muted); font-size: 12.5px; }
.table-wrap { overflow-x: auto; }
.status { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12.5px; font-weight: 500; border: 1px solid transparent; white-space: nowrap; }
.status.ok { color: var(--ok); background: var(--ok-bg); }
.status.bad { color: var(--bad); background: var(--bad-bg); }
.status.warn { color: var(--warn); background: var(--warn-bg); }
.status.info { color: var(--info); background: var(--info-bg); }
.status.plain { color: var(--text); border-color: var(--line); }
.kind-ad { color: var(--ad); font-weight: 500; }

/* ---------- calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.cal .dow { padding: 6px 8px; font-size: 12px; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--hover); }
.cal .day { min-height: 96px; padding: 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 3px; font: inherit; }
.cal .day:hover { background: var(--hover); }
.cal .day.out { background: var(--bg); cursor: default; }
.cal .day .d { font-weight: 500; color: var(--ink); }
.cal .day.today .d { color: var(--primary-ink); background: var(--primary); border-radius: 10px; padding: 0 6px; width: max-content; }
.cal .day .ad { font-size: 12px; color: var(--ad); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .day .own { font-size: 12px; color: var(--muted); margin-top: auto; }

/* ---------- preview ---------- */
.tg { background: #E8EDF2; border-radius: var(--r); padding: 14px; }
:root[data-theme="dark"] .tg { background: #0F1216; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tg { background: #0F1216; } }
.bubble { background: #fff; color: #111; border-radius: 10px 10px 10px 3px; max-width: 360px; overflow: hidden; box-shadow: 0 1px 1px #0002; }
:root[data-theme="dark"] .bubble { background: #212D3B; color: #E9EEF3; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bubble { background: #212D3B; color: #E9EEF3; } }
.bubble .ch { color: #2B7AC2; font-weight: 600; font-size: 13.5px; padding: 8px 12px 0; }
.bubble .media img, .bubble .media video { display: block; width: 100%; max-height: 260px; object-fit: cover; }
.bubble .media .file { padding: 8px 12px; font-size: 13px; }
.bubble .body { padding: 6px 12px 5px; white-space: pre-wrap; word-wrap: break-word; }
.bubble .body .spoiler { background: #8884; color: transparent; border-radius: 3px; }
.bubble .body blockquote { border-left: 3px solid #2B7AC2; margin: 4px 0; padding-left: 8px; }
.bubble .meta { text-align: right; font-size: 11px; color: #8A98A6; padding: 0 10px 6px; }
.kb { display: grid; gap: 3px; max-width: 360px; margin-top: 3px; }
.kb div { display: flex; gap: 3px; }
.kb span { flex: 1; text-align: center; background: #0003; color: #fff; border-radius: 7px; padding: 7px; font-size: 13px; font-weight: 500; }

/* ---------- modal, toast ---------- */
dialog { border: 1px solid var(--line); border-radius: 8px; padding: 0; max-width: min(640px, calc(100vw - 24px)); width: 100%; background: var(--surface); color: var(--text); }
dialog::backdrop { background: #0B0E1399; }
dialog .hd { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
dialog .bd { padding: 18px; display: grid; gap: 14px; max-height: 75vh; overflow: auto; }
dialog .ft { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
#toasts { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 50; }
#toasts div { background: var(--ink); color: var(--bg); padding: 9px 14px; border-radius: var(--r); box-shadow: 0 4px 16px #0003; max-width: 380px; font-size: 13.5px; }
#toasts div.bad { background: var(--bad); color: #fff; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { max-width: 400px; width: 100%; }
.qr { width: 200px; height: 200px; image-rendering: pixelated; background: #fff; border-radius: 6px; padding: 6px; border: 1px solid var(--line); }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .aside { position: static; }
  .cols-2 { grid-template-columns: 1fr; }
  main { padding: 16px 16px 48px; }
  .topbar .in { padding: 0 12px; gap: 12px; }
  .topbar .right .txt { display: none; }
  .cal .day { min-height: 64px; }
  .cal .day .ad { display: none; }
  .btnrow { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- editor, dropzone, post cards ---------- */
.editor-wrap { border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--field); position: relative; }
.editor-wrap .fmt { padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--hover); border-radius: var(--r) var(--r) 0 0; }
.editor { min-height: 170px; max-height: 420px; overflow: auto; padding: 10px 12px; outline: none; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.editor:empty::before { content: 'Текст поста'; color: var(--muted); }
.editor:focus-visible { outline: none; }
.editor-wrap:focus-within { border-color: var(--focus); box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus) 25%, transparent); }
.editor .spoiler { background: var(--line-strong); border-radius: 3px; padding: 0 2px; }
.editor code { background: var(--hover); border: 1px solid var(--line); border-radius: 3px; padding: 0 3px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.editor blockquote { border-left: 3px solid var(--line-strong); margin: 4px 0; padding: 2px 10px; color: var(--text); }
.editor a { color: var(--info); text-decoration: underline; }
.emoji-box { position: absolute; top: 40px; left: 8px; z-index: 5; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 6px; display: grid; grid-template-columns: repeat(8, 32px); gap: 2px; box-shadow: 0 6px 20px #0002; }
.emoji-box button { border: 0; background: none; font-size: 20px; cursor: pointer; border-radius: 4px; padding: 2px; }
.emoji-box button:hover { background: var(--hover); }
.dropzone { border: 1px dashed var(--line-strong); border-radius: var(--r); padding: 18px; text-align: center; cursor: pointer; display: grid; gap: 2px; color: var(--text); background: var(--field); }
.dropzone:hover, .dropzone.over { border-color: var(--focus); background: var(--hover); }
.attach { border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.pcard { overflow: hidden; display: flex; flex-direction: column; }
.pcard > img, .pcard > .ph { width: 100%; height: 140px; object-fit: cover; background: var(--hover); display: grid; place-items: center; color: var(--muted); border-bottom: 1px solid var(--line); }
.pcard .bd { flex: 1; }
.clamp { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.notice.small { padding: 7px 10px; }
