:root {
  --bg: #f3f4f6; --card: #fff; --ink: #17191c; --muted: #6b7280; --line: #e5e7eb;
  --accent: #2f6df6; --accent-soft: #eaf1ff; --ok: #16a34a; --ok-soft: #e8f7ee; --off-soft: #f4f4f5;
  --bad: #dc2626; --side: #14171c; --side-ink: #c9cdd4; --r: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 "Onest", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin: 0 0 18px; line-height: 1.2; }
h3 { font-size: 15px; margin: 0 0 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label > input, label > select, label > textarea { color: var(--ink); font-size: 15px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
code, pre { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
pre { background: #f8f9fb; padding: 12px; border-radius: 8px; overflow: auto; }
.muted { color: var(--muted); } .small { font-size: 12px; } .nowrap { white-space: nowrap; }
.err { color: var(--bad); min-height: 1em; }
.boot { padding: 40px; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { border-color: #c7cbd1; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: #fff; border-color: var(--line); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn.wide { width: 100%; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin-bottom: 16px; }
.card.empty { color: var(--muted); text-align: center; padding: 40px; }
.card.narrow { max-width: 420px; display: flex; flex-direction: column; gap: 12px; }

/* вход */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.login p { margin: 0; }
.brand { font-weight: 700; font-size: 17px; color: inherit; }
.brand.big { font-size: 22px; }

/* каркас */
.layout { display: flex; min-height: 100vh; }
.side { width: 250px; flex: none; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { color: #fff; padding: 0 10px 14px; text-decoration: none; }
.side .search input { width: 100%; background: #22262d; border-color: #2c313a; color: #fff; }
.side nav { display: flex; flex-direction: column; gap: 1px; margin-top: 12px; flex: 1; }
.side nav a { color: var(--side-ink); padding: 7px 10px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; text-decoration: none; }
.side nav a:hover { background: #22262d; color: #fff; }
.side nav a.on { background: var(--accent); color: #fff; }
.side .cnt { font-size: 12px; opacity: .6; }
.nav-h { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6f7681; padding: 14px 10px 4px; }
.me { border-top: 1px solid #2c313a; padding: 14px 10px 0; display: flex; flex-direction: column; gap: 6px; }
.me b { color: #fff; }
.me a { color: var(--side-ink); font-size: 13px; }
.main { flex: 1; min-width: 0; }
.top { display: none; }
.content { padding: 28px 32px 60px; max-width: 1200px; }

.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.head h1 { margin-bottom: 12px; }
.head-r { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.week { font-weight: 600; min-width: 120px; text-align: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 .card { margin-bottom: 0; }
.grid2 + .card { margin-top: 16px; }
ul.plain { padding-left: 18px; }

/* список статей */
.group { margin-bottom: 22px; }
.arts { display: flex; flex-direction: column; }
.group .arts { background: #fff; border: 1px solid var(--line); border-radius: var(--r); }
.art { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; padding: 11px 16px; color: var(--ink); border-bottom: 1px solid var(--line); }
.card .art { padding: 10px 0; }
.art:last-child { border-bottom: 0; }
.art:hover { text-decoration: none; background: #fafbfc; }
.art-t { font-weight: 500; }
.art-m { display: flex; gap: 10px; align-items: center; }
.snip { flex-basis: 100%; font-size: 13px; color: var(--muted); }
.tag { background: var(--accent-soft); color: var(--accent); font-size: 12px; padding: 2px 8px; border-radius: 99px; }
.pin { margin-right: 6px; }

/* статья */
.prose { font-size: 16px; line-height: 1.65; }
.prose h2 { font-size: 20px; margin: 22px 0 8px; } .prose h3 { font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--ink); margin: 18px 0 6px; } .prose h4 { margin: 14px 0 4px; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 12px; }
.prose blockquote { margin: 12px 0; padding: 10px 14px; background: #fff8e6; border-left: 3px solid #f0b429; border-radius: 6px; }
.prose mark { background: #fff1a8; padding: 0 2px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.say { display: flex; gap: 12px; align-items: baseline; margin: 6px 0; padding: 9px 14px; border-radius: 10px; }
.say .who { flex: none; width: 76px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.say-manager { background: var(--accent-soft); } .say-manager .who { color: var(--accent); }
.say-client { background: #f3f4f6; margin-left: 28px; } .say-client .who { color: var(--muted); }

/* редактор */
.editor { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 12px; align-items: flex-end; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.split textarea { min-height: 460px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 14px; line-height: 1.55; }
.lbl { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.preview { border: 1px dashed var(--line); border-radius: 8px; padding: 14px; min-height: 460px; max-height: 640px; overflow: auto; }
.hint summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; }

/* таблицы */
.table-wrap { overflow-x: auto; padding: 6px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
tr.mine td { background: #f6f9ff; }
tr.off td { opacity: .55; }
.inl { border-color: transparent; background: transparent; padding: 5px 7px; width: 100%; }
.inl:hover { border-color: var(--line); }
.sched th, .sched td { text-align: center; }
.sched .who, .sched th:first-child { text-align: left; white-space: nowrap; }
.sched th.today { color: var(--accent); }
.sched td { padding: 4px; }
.sched td.work { background: var(--ok-soft); }
.sched td.off { background: var(--off-soft); color: var(--muted); }
.sched td.dirty { box-shadow: inset 0 0 0 2px #f0b429; }
.sched input { width: 100%; min-width: 96px; border-color: transparent; background: transparent; text-align: center; padding: 6px 4px; font-size: 13px; }
.sched input:hover { border-color: var(--line); background: #fff; }
.sched tfoot td { border-bottom: 0; font-size: 13px; }

/* статистика */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.kpis div { background: #f8f9fb; border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; }
.kpis span { font-size: 12px; color: var(--muted); }
.kpis b { font-size: 26px; }
.bar { position: relative; background: #eef0f3; border-radius: 6px; height: 22px; min-width: 120px; overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; background: #bfe3cc; }
.bar span { position: relative; font-size: 13px; font-weight: 600; padding-left: 8px; line-height: 22px; }

/* настройки */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #17191c; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 50; box-shadow: 0 8px 30px rgba(0,0,0,.2); max-width: 90vw; }
.toast.bad { background: var(--bad); }

@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .content { padding: 18px 14px 50px; }
  .grid2, .split, .form-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .row { flex-wrap: wrap; }
  .preview, .split textarea { min-height: 260px; }
}
