:root {
  --orange: #F2693C;
  --green: #16A34A;
  --ink: #1f2433;
  --ink-soft: #5b6478;
  --line: rgba(255, 255, 255, 0.7);
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --shadow: 0 10px 40px rgba(31, 38, 80, 0.10);
  --shadow-sm: 0 4px 18px rgba(31, 38, 80, 0.08);
  --radius: 22px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, #eef2ff 0%, #fdf3ec 45%, #ecfdf5 100%);
  background-attachment: fixed;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
/* мягкие цветные блобы на фоне */
body::before, body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
}
body::before { width: 460px; height: 460px; background: #ffd0b8; top: -120px; right: 8%; }
body::after  { width: 520px; height: 520px; background: #c7f5dc; bottom: -160px; left: 30%; }

.app { position: relative; z-index: 1; display: flex; height: 100vh; padding: 16px; gap: 16px; }

/* ---------- sidebar ---------- */
.sidebar {
  width: 234px; flex-shrink: 0;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 16px; display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px 22px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--orange), #ff9a3c);
  display: grid; place-items: center; font-size: 20px;
  box-shadow: 0 6px 16px rgba(242, 105, 60, 0.4);
}
.brand .title { font-weight: 700; font-size: 15px; line-height: 1.15; }
.brand .subtitle { font-size: 11px; color: var(--ink-soft); }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: 13px; cursor: pointer;
  color: var(--ink-soft); font-size: 14px; font-weight: 500;
  border: 1px solid transparent; transition: all .16s ease; user-select: none;
}
.nav-item .ico { font-size: 17px; width: 20px; text-align: center; }
.nav-item:hover { background: rgba(255, 255, 255, 0.55); color: var(--ink); }
.nav-item.active {
  background: var(--glass-strong); color: var(--ink); font-weight: 600;
  border-color: var(--line); box-shadow: var(--shadow-sm);
}
.nav-item .badge {
  margin-left: auto; background: var(--orange); color: #fff;
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
}
.sidebar-foot { margin-top: auto; font-size: 11px; color: var(--ink-soft); padding: 12px 6px 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.on { background: var(--green); } .dot.off { background: #cbd2e0; }

/* ---------- main ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 4px 6px 16px; }
.topbar h1 { font-size: 22px; margin: 0; font-weight: 700; }
.topbar .sub { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.topbar .spacer { flex: 1; }

.btn {
  border: 1px solid var(--line); background: var(--glass-strong);
  backdrop-filter: blur(12px); padding: 9px 15px; border-radius: 12px;
  font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; transition: all .15s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: linear-gradient(135deg, var(--orange), #ff8a4c); color: #fff; border-color: transparent; }
.btn.ghost { background: rgba(255,255,255,0.4); box-shadow: none; }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.danger { color: #d11d3c; }

.content { flex: 1; overflow: auto; padding: 2px 6px 24px; }

/* ---------- glass card generic ---------- */
.glass {
  background: var(--glass); backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ---------- dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat { padding: 18px 20px; }
.stat .label { font-size: 12.5px; color: var(--ink-soft); }
.stat .value { font-size: 32px; font-weight: 700; margin-top: 8px; line-height: 1; }
.stat .hint { font-size: 12px; margin-top: 8px; color: var(--green); font-weight: 600; }
.stat .ico-r { float: right; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 18px; background: rgba(242,105,60,.12); }

.cols-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
.panel { padding: 20px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 16px; font-size: 15px; }

.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 11px; font-size: 13px; }
.bar-row .name { width: 130px; flex-shrink: 0; color: var(--ink-soft); display: flex; align-items: center; gap: 7px; }
.bar-track { flex: 1; height: 10px; background: rgba(0,0,0,0.05); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; }
.bar-row .num { width: 28px; text-align: right; font-weight: 700; }

.feed-item { display: flex; gap: 11px; padding: 9px 0; border-bottom: 1px solid rgba(0,0,0,0.05); font-size: 13px; }
.feed-item:last-child { border-bottom: none; }
.feed-item .fdot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.feed-item .ftime { color: var(--ink-soft); font-size: 11px; margin-top: 2px; }

/* ---------- kanban ---------- */
.board { display: flex; gap: 14px; height: 100%; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.column {
  width: 290px; flex-shrink: 0; max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--glass); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-sm);
}
.col-head { padding: 13px 14px 11px; display: flex; align-items: center; gap: 9px; border-bottom: 1px solid rgba(0,0,0,0.05); }
.col-head .cico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; color: #fff; }
.col-head .cname { font-weight: 700; font-size: 13.5px; }
.col-head .ccount { margin-left: auto; font-size: 12px; color: var(--ink-soft); background: rgba(0,0,0,0.05); padding: 1px 8px; border-radius: 999px; }
.cvoice { padding: 7px 14px 9px; min-height: 62px; display: flex; flex-direction: column; justify-content: center; font-size: 11px; line-height: 1.35; color: var(--ink-soft); border-bottom: 1px solid rgba(0,0,0,0.05); background: rgba(242,105,60,0.05); }
.cvoice b { color: var(--orange); font-weight: 700; }
.cacc { display: flex; align-items: center; gap: 6px; padding: 7px 14px; font-size: 11px; border-bottom: 1px solid rgba(0,0,0,0.05); background: rgba(0,0,0,0.015); }
.cacc-link { flex: 1; min-width: 0; color: var(--orange); font-weight: 600; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cacc-link:hover { text-decoration: underline; }
.cacc-empty { flex: 1; min-width: 0; color: var(--ink-soft); opacity: 0.7; font-style: italic; }
.cacc-edit { flex: none; border: none; background: transparent; cursor: pointer; font-size: 12px; padding: 2px 4px; border-radius: 6px; line-height: 1; opacity: 0.65; }
.cacc-edit:hover { opacity: 1; background: rgba(0,0,0,0.06); }
.col-body { padding: 10px; overflow-y: auto; flex: 1; min-height: 60px; display: flex; flex-direction: column; gap: 9px; }
.col-add { width: 100%; justify-content: center; border-style: dashed; background: rgba(255,255,255,0.35); box-shadow: none; }

.card {
  background: var(--glass-strong); border: 1px solid var(--line);
  border-radius: 13px; padding: 12px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .12s, box-shadow .12s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(31,38,80,.14); }
.card-cover img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; margin-bottom: 9px; display: block; background: rgba(0,0,0,.04); }
.article-cover img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; margin-bottom: 14px; display: block; box-shadow: var(--shadow-sm); }
.card .ctitle { font-size: 13.5px; font-weight: 600; line-height: 1.32; margin-bottom: 9px; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 11px; color: var(--ink-soft); }
.tag { background: rgba(0,0,0,0.05); padding: 2px 8px; border-radius: 999px; }
.tag.warn { background: rgba(234,88,12,0.12); color: #c2410c; font-weight: 600; }
.missing-list { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow-y: auto; }
.missing-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: rgba(255,255,255,0.5); }
.missing-row:hover { background: rgba(242,105,60,0.07); border-color: var(--orange); }
.missing-ch { flex: none; font-size: 11px; font-weight: 700; color: var(--orange); min-width: 92px; }
.missing-title { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.sortable-ghost { opacity: .4; }
.sortable-drag { transform: rotate(2deg); }

/* status chip (select) */
.chip {
  appearance: none; -webkit-appearance: none; border: none; cursor: pointer;
  font-size: 11.5px; font-weight: 700; padding: 4px 24px 4px 11px; border-radius: 999px;
  background-repeat: no-repeat; background-position: right 8px center;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='3'><path d='M6 9l6 6 6-6'/></svg>");
}
.chip.s-review { background-color: #fef3c7; color: #92600a; }
.chip.s-publishing { background-color: #dbeafe; color: #1e50a8; }
.chip.s-editing { background-color: #ede9fe; color: #6d28d9; }
.chip.s-published { background-color: #dcfce7; color: #166534; }
.chip.s-rejected { background-color: #fee2e2; color: #b91c1c; }
.mini { font-size: 11px; color: var(--ink-soft); margin-left: auto; }

/* ---------- article detail ---------- */
.article-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 16px; height: 100%; }
.editor-pane { padding: 18px; display: flex; flex-direction: column; min-height: 0; }
.editor-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab { padding: 6px 14px; border-radius: 10px; font-size: 13px; cursor: pointer; color: var(--ink-soft); }
.tab.active { background: var(--glass-strong); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }
.editor-area { flex: 1; min-height: 0; }
textarea.md {
  width: 100%; height: 100%; resize: none; border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 13.5px; line-height: 1.6; background: rgba(255,255,255,0.6); color: var(--ink);
}
.preview { height: 100%; overflow: auto; padding: 4px 8px; line-height: 1.65; font-size: 14.5px; }
.preview h1 { font-size: 24px; } .preview h2 { font-size: 19px; margin-top: 22px; }
.preview img { max-width: 100%; border-radius: 10px; }
.preview a { color: var(--orange); }
.side-pane { display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.field { margin-bottom: 12px; }
.field label { font-size: 11.5px; color: var(--ink-soft); display: block; margin-bottom: 4px; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
  font-size: 13px; background: rgba(255,255,255,0.6); color: var(--ink); font-family: inherit;
}
.comment { background: rgba(255,255,255,0.5); border-radius: 10px; padding: 9px 11px; font-size: 13px; margin-bottom: 8px; }
.comment .ctime { font-size: 10.5px; color: var(--ink-soft); margin-top: 4px; }

/* ---------- article reading view ---------- */
.article-topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.article-page { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.article-main { padding: 30px 38px 34px; }
.a-read-title { font-size: 30px; line-height: 1.22; font-weight: 800; letter-spacing: -0.01em; margin: 6px 0 20px; color: var(--ink); }
.article-read { font-size: 17px; line-height: 1.8; color: #2b3145; max-width: 760px; }
.article-read h1 { font-size: 26px; font-weight: 800; margin: 30px 0 12px; line-height: 1.25; }
.article-read h2 { font-size: 22px; font-weight: 700; margin: 28px 0 10px; line-height: 1.3; }
.article-read h3 { font-size: 18.5px; font-weight: 700; margin: 22px 0 8px; }
.article-read p { margin: 0 0 16px; }
.article-read ul, .article-read ol { margin: 0 0 16px; padding-left: 24px; }
.article-read li { margin: 7px 0; }
.article-read strong { font-weight: 700; color: var(--ink); }
.article-read em { font-style: italic; }
.article-read a { color: var(--orange); text-decoration: underline; text-underline-offset: 2px; }
.article-read blockquote { margin: 18px 0; padding: 12px 20px; border-left: 3px solid var(--orange); background: rgba(242,105,60,.06); border-radius: 0 12px 12px 0; color: #555; }
.article-read code { background: rgba(0,0,0,.05); padding: 1px 6px; border-radius: 6px; font-size: 14px; }
.article-read img { max-width: 100%; border-radius: 12px; margin: 10px 0; }
.article-read hr { border: none; border-top: 1px solid rgba(0,0,0,.08); margin: 26px 0; }
.a-title-input { width: 100%; font-size: 22px; font-weight: 700; border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; margin-bottom: 14px; background: rgba(255,255,255,.6); color: var(--ink); }
.a-body-edit { width: 100%; min-height: 62vh; resize: vertical; border: 1px solid var(--line); border-radius: 14px; padding: 18px; font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: 14px; line-height: 1.7; background: rgba(255,255,255,.6); color: var(--ink); }

/* ---------- SEO panel ---------- */
.seo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.seo-grid > div { background: rgba(255,255,255,.5); border-radius: 10px; padding: 8px 10px; }
.seo-grid b { display: block; font-size: 16px; color: var(--ink); }
.seo-grid span { font-size: 10.5px; color: var(--ink-soft); }
.seo-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.seo-flag { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; }
.seo-flag.ok { background: #dcfce7; color: #166534; }
.seo-flag.no { background: #fee2e2; color: #b91c1c; }
.seo-meta { font-size: 12.5px; color: var(--ink); background: rgba(255,255,255,.5); border-radius: 8px; padding: 7px 9px; word-break: break-word; }
.seo-h4 { margin: 14px 0 8px; font-size: 13px; }
.seo-rec { font-size: 12.5px; padding: 5px 0; display: flex; gap: 7px; align-items: flex-start; }
.seo-rec.ok { color: #166534; } .seo-rec.warn { color: #92600a; } .seo-rec.bad { color: #b91c1c; }

/* ---------- archive / jobs tables ---------- */
.list-row {
  display: flex; align-items: center; gap: 14px; padding: 13px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.05); font-size: 13.5px; cursor: pointer;
}
.list-row:hover { background: rgba(255,255,255,0.4); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .ttl { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .sm { font-size: 12px; color: var(--ink-soft); }
.badge-status { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.b-queued { background: #fef3c7; color: #92600a; }
.b-running { background: #dbeafe; color: #1e50a8; }
.b-done { background: #dcfce7; color: #166534; }
.b-error { background: #fee2e2; color: #b91c1c; }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; }
.toolbar input, .toolbar select {
  border: 1px solid var(--line); border-radius: 11px; padding: 9px 13px; font-size: 13px;
  background: var(--glass-strong); color: var(--ink);
}
.empty { text-align: center; color: var(--ink-soft); padding: 50px 20px; font-size: 14px; }

/* ---------- modal ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(40, 44, 70, 0.32);
  backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 100; padding: 20px;
}
.modal {
  width: 100%; max-width: 520px; background: var(--glass-strong);
  backdrop-filter: blur(30px) saturate(160%); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: 0 24px 70px rgba(31,38,80,.28); padding: 24px;
  max-height: 86vh; overflow: auto;
}
.modal.wide { max-width: 760px; }
.modal h2 { margin: 0 0 6px; font-size: 18px; }
.modal .desc { color: var(--ink-soft); font-size: 13px; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
pre.log {
  background: #11131c; color: #cdd3e0; border-radius: 12px; padding: 14px;
  font-size: 12px; line-height: 1.5; max-height: 50vh; overflow: auto; white-space: pre-wrap; word-break: break-word;
}

/* ---------- calendar ---------- */
#calendar { padding: 18px; }
.fc { --fc-border-color: rgba(0,0,0,0.06); font-size: 13px; }
.fc .fc-toolbar-title { font-size: 17px; }
.fc .fc-button { background: var(--glass-strong); border: 1px solid var(--line); color: var(--ink); box-shadow: var(--shadow-sm); text-transform: none; }
.fc .fc-button-primary:not(:disabled).fc-button-active { background: var(--orange); border-color: var(--orange); }
.fc-daygrid-day:hover { background: rgba(255,255,255,0.4); cursor: pointer; }
.fc-event { border: none !important; border-radius: 6px; padding: 1px 5px; font-weight: 600; cursor: pointer; }

/* toast */
#toast-root { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--glass-strong); backdrop-filter: blur(20px); border: 1px solid var(--line);
  border-radius: 13px; padding: 13px 17px; font-size: 13.5px; box-shadow: var(--shadow);
  min-width: 240px; animation: slidein .25s ease;
}
.toast.err { border-left: 3px solid #e11d48; }
.toast.ok { border-left: 3px solid var(--green); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.14); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }
