:root {
  color-scheme: light;
  --ink: #192421;
  --ink-2: #32423d;
  --muted: #6d7a75;
  --paper: #f3f0e8;
  --card: #fffdf8;
  --card-2: #f8f4eb;
  --line: #ded8cb;
  --line-strong: #cfc7b7;
  --grid-line: rgba(25, 36, 33, .035);
  --topbar: #14201e;
  --topbar-ink: #f8f5ed;
  --topbar-muted: #a9b6b1;
  --soft: #efeae0;
  --soft-2: #e8e1d4;
  --seg: #e8e3d8;
  --text-bg: #f8f4eb;
  --text-line: #e9e2d5;
  --text-ink: #35423e;
  --shadow-color: rgba(33, 44, 40, .09);
  --orange: #b5502f;
  --orange-dark: #93422a;
  --orange-soft: #f6e7de;
  --gold: #b8902e;
  --gold-soft: #f4ecd5;
  --teal: #4f6f68;
  --teal-soft: #e4ece8;
  --blue: #2563a6;
  --blue-soft: #e3eefb;
  --red: #b42318;
  --red-soft: #fde7e4;
  --amber: #a16207;
  --amber-soft: #fbf0d5;
  --shadow: 0 14px 40px rgba(33, 44, 40, .09);
  --radius: 18px;
  --radius-sm: 11px;
  --sans: "Segoe UI", "Inter", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

/* Тёмная тема: переключается кнопкой в шапке и запоминается в браузере. */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8eeea;
  --ink-2: #c3cec8;
  --muted: #93a29b;
  --paper: #0f1614;
  --card: #17211e;
  --card-2: #1c2824;
  --line: #2a3833;
  --line-strong: #3a4a44;
  --grid-line: rgba(232, 238, 234, .04);
  --topbar: #0a0f0e;
  --topbar-ink: #f2f6f3;
  --topbar-muted: #94a39d;
  --soft: #22302b;
  --soft-2: #2a3a34;
  --seg: #1d2a26;
  --text-bg: #131d1a;
  --text-line: #27352f;
  --text-ink: #d5ded9;
  --orange-soft: #3a221a;
  --teal-soft: #14302c;
  --blue-soft: #17283c;
  --red-soft: #3a1d1a;
  --amber-soft: #372b12;
  --shadow-color: rgba(0, 0, 0, .45);
  --shadow: 0 14px 40px rgba(0, 0, 0, .5);
}

html[data-theme="dark"] .warning { background: #32280f; border-color: #55441a; color: #f1d68a; }
html[data-theme="dark"] .post-text { color: #c9d3ce; }
html[data-theme="dark"] .post-text:not(.expanded)::after { background: linear-gradient(transparent, #131d1a); }
html[data-theme="dark"] .photo-placeholder {
  background: repeating-linear-gradient(135deg, #1c2723, #1c2723 9px, #202c28 9px, #202c28 18px);
  color: #7f8e88;
}
html[data-theme="dark"] .photo-placeholder strong { color: #a9b8b2; }
html[data-theme="dark"] .badge-pillar { background: #22302b; color: #a9b8b2; }
html[data-theme="dark"] .file-drop { background: #131d1a; }
html[data-theme="dark"] .file-drop:hover, html[data-theme="dark"] .file-drop.dragging { background: #241a15; }
html[data-theme="dark"] .markdown blockquote { background: #221a14; }
html[data-theme="dark"] .markdown pre { background: #131d1a; }
html[data-theme="dark"] .day-head { background: #1c2824; }
html[data-theme="dark"] .brand-mark { color: #fff; }
html[data-theme="dark"] .btn-soft:hover { background: #2c3d37; }
html[data-theme="dark"] .btn-outline:hover { background: #22302b; }
html[data-theme="dark"] .icon-btn { background: #22302b; color: #d5ded9; }
html[data-theme="dark"] .icon-btn:hover { background: #2c3d37; }
html[data-theme="dark"] code { background: #22302b; color: #d9e3de; }
html[data-theme="dark"] .stat-card { box-shadow: 0 5px 16px rgba(0, 0, 0, .3); }
html[data-theme="dark"] .post-card { box-shadow: 0 6px 22px rgba(0, 0, 0, .3); }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .14);
  color: #f7f2e9; border-radius: 10px; height: 36px; padding: 0 10px; font-size: 15px;
}
.theme-toggle:hover { background: rgba(255, 255, 255, .14); }
.theme-ico-moon { display: none; opacity: .6; }
.theme-ico-sun { display: inline; }
html[data-theme="dark"] .theme-ico-sun { display: none; }
html[data-theme="dark"] .theme-ico-moon { display: inline; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(circle at 8% -5%, rgba(223, 91, 43, .10), transparent 34rem),
    radial-gradient(circle at 92% 4%, rgba(15, 118, 110, .08), transparent 30rem),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    var(--paper);
  background-size: auto, auto, 38px 38px, 38px 38px, auto;
  min-height: 100vh;
  line-height: 1.55;
  transition: background-color .2s ease, color .2s ease;
}

h1, h2, h3, h4, p { margin: 0; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--teal); }
code {
  font-family: var(--mono);
  background: var(--soft);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: .9em;
}
.shell { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0 40px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.eyebrow { text-transform: uppercase; letter-spacing: .13em; font-size: 11px; font-weight: 800; color: var(--orange); }

/* topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  background: var(--topbar);
  color: var(--topbar-ink);
  border-radius: 22px;
  padding: 18px 22px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, .08);
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark {
  width: 48px; height: 48px; flex: 0 0 48px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, #f9844a, var(--orange));
  color: #fff;
  font-weight: 900; letter-spacing: -.04em; font-size: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}
.brand-text { min-width: 0; }
.brand-text h1 { font-size: 20px; line-height: 1.15; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text p { color: var(--topbar-muted); font-size: 12.5px; margin-top: 3px; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.live-dot { font-size: 11.5px; color: #b9c6c1; display: inline-flex; align-items: center; gap: 6px; }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #56c78e; box-shadow: 0 0 0 4px rgba(86, 199, 142, .12); }

/* buttons */
.btn {
  border: 1px solid transparent; border-radius: 10px;
  padding: 9px 14px; font-weight: 700; font-size: 13px;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--orange); color: #fff; box-shadow: 0 7px 18px rgba(223, 91, 43, .22); }
.btn-primary:hover { background: var(--orange-dark); }
.btn-ghost { background: rgba(255, 255, 255, .07); color: #f7f2e9; border-color: rgba(255, 255, 255, .14); }
.btn-ghost:hover { background: rgba(255, 255, 255, .13); }
.btn-soft { background: var(--soft); color: var(--ink-2); border-color: var(--line); }
.btn-soft:hover { background: var(--soft-2); }
.btn-success { background: var(--teal); color: #fff; }
.btn-success:hover { background: #0a5c55; }
.btn-danger-soft { background: var(--red-soft); color: var(--red); border-color: #f5c6c0; }
.btn-outline { background: transparent; border-color: var(--line-strong); color: var(--ink-2); }
.btn-outline:hover { background: var(--soft-2); }
.btn-sm { padding: 7px 10px; font-size: 12px; border-radius: 8px; }
.icon-btn { border: 0; background: var(--soft); width: 34px; height: 34px; border-radius: 9px; font-size: 22px; line-height: 1; color: var(--ink-2); display: grid; place-items: center; }
.icon-btn:hover { background: var(--soft-2); }

/* warnings/stats */
.warnings { margin-top: 14px; display: grid; gap: 8px; }
.warning {
  display: flex; gap: 10px; align-items: flex-start;
  background: #fff8e7; border: 1px solid #ead8a6; color: #654b0c;
  padding: 10px 14px; border-radius: 12px; font-size: 13px;
}
.warning::before { content: "!"; font-weight: 900; color: var(--amber); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.stat-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px 15px;
  position: relative; overflow: hidden; box-shadow: 0 5px 16px rgba(33, 44, 40, .04);
}
.stat-card::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: 0; height: 3px; background: var(--accent, var(--orange)); border-radius: 3px 3px 0 0; opacity: .75; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 32px; line-height: 1.1; font-weight: 900; letter-spacing: -.04em; margin-top: 5px; }
.stat-note { color: var(--muted); font-size: 11.5px; margin-top: 3px; min-height: 17px; }
.stat-card.pending { --accent: var(--orange); }
.stat-card.approved { --accent: var(--teal); }
.stat-card.published { --accent: var(--blue); }
.stat-card.manual { --accent: #a16207; }

/* tabs */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 22px 0 16px; }
.tabs { display: flex; gap: 4px; background: var(--seg); padding: 4px; border-radius: 12px; overflow-x: auto; }
.tab { border: 0; background: transparent; color: #5f6c67; padding: 9px 14px; border-radius: 9px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { background: var(--card); color: var(--ink); box-shadow: 0 2px 8px rgba(33, 44, 40, .08); }
.tab span { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 20px; background: var(--orange); color: #fff; font-size: 10.5px; margin-left: 3px; }
.tab span:empty { display: none; }
.toolbar-actions { display: flex; gap: 8px; }
.tab-panel { display: none; animation: fade .22s ease; }
.tab-panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* section */
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin: 8px 0 16px; }
.section-head h2 { font-size: 22px; letter-spacing: -.03em; }
.section-head p { margin-top: 4px; font-size: 13px; }
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* queue */
.queue-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.queue-clear { display: flex; justify-content: flex-end; margin: 8px 0 2px; }
.filter { border: 1px solid var(--line); background: rgba(255, 253, 248, .7); color: #5d6a65; border-radius: 30px; padding: 6px 12px; font-size: 12px; font-weight: 700; }
.filter:hover { border-color: var(--line-strong); color: var(--ink); }
.filter.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.post-list { display: grid; gap: 16px; }
.post-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: 0 6px 22px rgba(33, 44, 40, .05);
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 22px;
}
.post-main { min-width: 0; }
.post-side { min-width: 0; border-left: 1px solid var(--line); padding-left: 22px; }
.post-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.badge { display: inline-flex; align-items: center; border-radius: 30px; padding: 3px 9px; font-size: 10.5px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.badge-pillar { background: var(--soft); color: var(--ink-2); }
.badge-status { background: var(--amber-soft); color: var(--amber); }
.badge-status.approved { background: var(--teal-soft); color: var(--teal); }
.badge-status.published { background: var(--blue-soft); color: var(--blue); }
.badge-status.partial { background: var(--blue-soft); color: var(--blue); }
.badge-status.rejected, .badge-status.publish_failed { background: var(--red-soft); color: var(--red); }
.badge-demo { background: #f1e7ff; color: #6d3ba7; }
.post-date { color: var(--muted); font-size: 12px; white-space: nowrap; }
.post-title { font-size: 19px; letter-spacing: -.025em; line-height: 1.3; margin: 4px 0 12px; }
.platform-switch { display: flex; gap: 4px; margin-bottom: 9px; }
.platform-pill { border: 1px solid var(--line); background: var(--card-2); border-radius: 7px; padding: 4px 9px; font-size: 11px; font-weight: 700; color: #69736e; }
.platform-pill.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.platform-pill.tg.active { background: #229ed9; border-color: #229ed9; }
.platform-pill.max.active { background: #5b4bdc; border-color: #5b4bdc; }
.platform-pill.vk.active { background: #0077ff; border-color: #0077ff; }
.post-text {
  margin: 0; white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--text-bg); border: 1px solid var(--text-line); border-radius: 12px;
  padding: 13px 14px; font-family: var(--sans); font-size: 13px; line-height: 1.62;
  color: var(--text-ink); max-height: 265px; overflow: hidden; position: relative;
}
.post-text.expanded { max-height: none; }
.post-text:not(.expanded)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 52px; background: linear-gradient(transparent, var(--text-bg)); pointer-events: none; }
.text-tools { display: flex; justify-content: space-between; align-items: center; margin-top: 7px; gap: 8px; }
.link-btn { border: 0; background: transparent; padding: 2px 0; color: var(--teal); font-size: 11.5px; font-weight: 700; }
.link-btn:hover { text-decoration: underline; }
.post-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.post-actions .btn { font-size: 12px; }
.photo-box { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--soft); margin-bottom: 12px; }
.photo-box img { display: block; width: 100%; height: 156px; object-fit: cover; }
.photo-placeholder { height: 136px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); background: repeating-linear-gradient(135deg, var(--soft), var(--soft) 9px, var(--text-line) 9px, var(--text-line) 18px); text-align: center; padding: 12px; }
.photo-placeholder strong { color: var(--ink-2); font-size: 12px; }
.photo-placeholder span { font-size: 11px; max-width: 220px; }
.meta-row { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--muted); margin-top: 7px; }
.attach-row { display: flex; gap: 6px; align-items: center; margin-top: 9px; }
.attach-row select { flex: 1; min-width: 0; }
.attach-row .btn { flex-shrink: 0; }
details.brief { margin-top: 10px; border: 1px dashed var(--line-strong); border-radius: 10px; padding: 8px 10px; }
details.brief summary { cursor: pointer; font-size: 11.5px; font-weight: 700; color: var(--ink-2); }
details.brief p { font-size: 11.5px; color: var(--muted); white-space: pre-wrap; margin-top: 7px; }
.empty { padding: 54px 20px; text-align: center; background: var(--card); border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

/* forms */
label { display: grid; gap: 5px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
input[type="text"], input[type="password"], input[type="datetime-local"], textarea, select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--card); padding: 9px 10px; color: var(--ink); outline: none;
  font-size: 13px; font-weight: 400;
}
input:focus, textarea:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 118, 110, .10); }
textarea { resize: vertical; min-height: 92px; line-height: 1.5; }

/* media */
.upload-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.upload-main { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: stretch; }
.file-drop { border: 1.5px dashed var(--line-strong); border-radius: 13px; min-height: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; background: var(--text-bg); cursor: pointer; text-align: center; padding: 12px; }
.file-drop:hover, .file-drop.dragging { border-color: var(--orange); background: var(--orange-soft); }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-title { font-size: 14px; color: var(--orange-dark); }
.file-hint { font-size: 11px; color: var(--muted); font-weight: 400; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-fields { display: grid; gap: 9px; align-content: start; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 13px; }
.media-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: 0 4px 14px rgba(33, 44, 40, .04); }
.media-card img { width: 100%; height: 140px; object-fit: cover; display: block; background: var(--soft); }
.media-card .media-meta { padding: 9px 11px; display: grid; gap: 4px; }
.media-card .media-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-card .media-sub { font-size: 10.5px; color: var(--muted); }
.media-card .media-actions { display: flex; justify-content: flex-end; padding: 0 9px 9px; }

/* calendar */
.calendar-list { display: grid; gap: 12px; }
.day-block { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.day-head { display: flex; justify-content: space-between; gap: 10px; padding: 11px 16px; background: var(--card-2); border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 800; }
.day-head span:last-child { color: var(--muted); font-weight: 600; }
.cal-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.cal-row:last-child { border-bottom: 0; }
.cal-time { font-family: var(--mono); font-size: 12px; color: var(--ink-2); font-weight: 700; }
.cal-title { min-width: 0; font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-platforms { display: flex; gap: 4px; }
.plat-dot { width: 23px; height: 23px; border-radius: 7px; display: grid; place-items: center; font-size: 9px; font-weight: 800; color: #fff; }
.plat-dot.tg { background: #229ed9; } .plat-dot.max { background: #5b4bdc; } .plat-dot.vk { background: #0077ff; }
.plat-dot.off { background: #d9d4ca; color: #8a918a; }

/* reports */
.reports-list { display: grid; gap: 10px; }
.report-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 13px 16px; }
.report-row h3 { font-size: 14px; }
.report-row p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.report-actions { display: flex; gap: 7px; }
.markdown { font-size: 13.5px; line-height: 1.65; color: var(--text-ink); }
.markdown h1 { font-size: 23px; margin: 4px 0 12px; letter-spacing: -.03em; }
.markdown h2 { font-size: 17px; margin: 20px 0 7px; }
.markdown h3 { font-size: 14px; margin: 15px 0 5px; }
.markdown p { margin: 7px 0; }
.markdown ul { margin: 5px 0 10px; padding-left: 20px; }
.markdown li { margin: 3px 0; }
.markdown hr { border: 0; border-top: 1px solid var(--line); margin: 17px 0; }
.markdown blockquote { margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--orange); background: var(--orange-soft); font-size: 12.5px; }
.markdown a { color: var(--teal); }
.markdown pre { background: var(--soft); padding: 11px; border-radius: 9px; overflow: auto; font-size: 11.5px; }

/* integrations */
.integration-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.integration-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 17px; }
.integration-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.integration-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 12px; }
.integration-icon.tg { background: #229ed9; } .integration-icon.max { background: #5b4bdc; } .integration-icon.vk { background: #0077ff; }
.integration-card h3 { font-size: 15px; margin-top: 10px; }
.integration-card p { font-size: 12px; color: var(--muted); margin-top: 4px; min-height: 36px; }
.integration-card .btn { margin-top: 12px; width: 100%; }
.integration-state { font-size: 10.5px; font-weight: 800; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.integration-state.on { background: var(--teal-soft); color: var(--teal); }
.integration-state.off { background: var(--soft); color: var(--muted); }
.integration-note { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.settings-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-top: 14px; }
.settings-card h3 { font-size: 15px; margin-bottom: 6px; }
.settings-card p { font-size: 12.5px; color: #56625c; margin: 5px 0; }

/* footer */
.footer { display: flex; justify-content: space-between; gap: 14px; margin-top: 34px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 11px; color: #8b948e; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(19, 29, 26, .55); backdrop-filter: blur(3px); }
.modal-card { position: relative; width: min(760px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--card); border-radius: 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 1; }
.modal-head h2 { font-size: 18px; letter-spacing: -.02em; }
.modal-body { padding: 18px 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--card); }
.edit-grid { display: grid; gap: 12px; }
.edit-grid h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-top: 6px; }

/* toast */
.toast { position: fixed; z-index: 80; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(620px, calc(100% - 30px)); background: #16211e; color: #fff; padding: 12px 17px; border-radius: 11px; box-shadow: 0 18px 40px rgba(0, 0, 0, .25); font-size: 13px; line-height: 1.4; }
.toast.error { background: #8f2419; }
.toast[hidden] { display: none; }

/* login */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 32px; box-shadow: var(--shadow); }
.login-card .brand-mark { margin-bottom: 16px; width: 54px; height: 54px; }
.login-card h1 { font-size: 24px; letter-spacing: -.03em; margin: 4px 0 6px; }
.login-form { display: grid; gap: 12px; margin: 22px 0 16px; }
.login-form .btn { width: 100%; margin-top: 4px; }

@media (max-width: 1000px) {
  .post-card { grid-template-columns: 1fr; gap: 15px; }
  .post-side { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 15px; }
  .integration-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .shell { width: min(100% - 22px, 1240px); padding-top: 11px; }
  .topbar { border-radius: 16px; padding: 14px; align-items: flex-start; flex-direction: column; }
  .brand-text h1 { font-size: 18px; white-space: normal; }
  .top-actions { width: 100%; justify-content: space-between; }
  .stats { gap: 9px; margin: 13px 0; }
  .stat-card { padding: 12px 13px; border-radius: 14px; }
  .stat-value { font-size: 26px; }
  .toolbar { align-items: flex-start; flex-direction: column; gap: 10px; }
  .tabs { width: 100%; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions .btn { width: 100%; }
  .post-card { padding: 15px; border-radius: 15px; }
  .post-title { font-size: 17px; }
  .queue-head { align-items: flex-start; flex-direction: column; }
  .upload-main { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; }
  .section-actions { width: 100%; }
  .section-actions .btn { flex: 1; }
  .cal-row { grid-template-columns: 48px minmax(0, 1fr) auto; }
  .cal-platforms { display: none; }
  .report-row { align-items: flex-start; flex-direction: column; }
  .report-actions { width: 100%; }
  .report-actions .btn { flex: 1; }
  .footer { flex-direction: column; gap: 4px; }
  .modal { padding: 8px; }
  .modal-card { max-height: calc(100vh - 16px); border-radius: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* ===== контакты и телефоны ===== */
.contact-card {
  border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px;
  background: var(--card-2); font-size: 12.5px; line-height: 1.6; color: var(--ink-2);
  margin-top: 10px;
}
.contact-card .contact-brand { font-weight: 800; color: var(--ink); margin-bottom: 6px; letter-spacing: .01em; }
.contact-card .contact-line { display: flex; gap: 8px; align-items: flex-start; margin: 3px 0; }
.contact-card .contact-ico { flex: 0 0 16px; text-align: center; opacity: .8; }
.phone-chip {
  display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap;
  border: 1px solid var(--line); background: var(--card); border-radius: 10px;
  padding: 4px 9px; margin: 2px 4px 2px 0; font-size: 12.5px;
}
.phone-chip .phone-full { font-weight: 800; color: var(--ink); letter-spacing: .01em; }
.phone-chip .phone-short {
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--teal);
  background: var(--teal-soft); border-radius: 6px; padding: 1px 6px; white-space: nowrap;
}
.phone-chip .phone-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.booking-chip {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px;
  border-radius: 9px; padding: 4px 9px; background: var(--teal-soft); color: var(--teal); font-weight: 700;
  word-break: break-all;
}
.booking-chip.empty { background: var(--amber-soft); color: var(--amber); font-weight: 600; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.var-chip {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line);
  background: var(--soft); color: var(--ink-2); border-radius: 20px; padding: 3px 9px;
  font-size: 11px; font-weight: 700; font-family: var(--mono);
}
.var-chip.off { opacity: .55; text-decoration: line-through; }

/* ===== ИИ-промпт ===== */
.ai-prompt { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); padding: 10px 11px; }
.ai-prompt h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.ai-prompt textarea {
  width: 100%; min-height: 92px; resize: vertical; font-family: var(--sans); font-size: 11.5px; line-height: 1.5;
  background: var(--card); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 9px;
}
.ai-prompt .ai-actions { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.ai-prompt .btn { font-size: 11px; padding: 5px 9px; }

/* ===== кнопка «Новый пост за секунду» ===== */
.btn-quick {
  background: linear-gradient(135deg, #f9844a, var(--orange));
  color: #fff; box-shadow: 0 8px 20px rgba(223, 91, 43, .28); border: 1px solid rgba(255,255,255,.15);
  font-weight: 800;
}
.btn-quick:hover { background: linear-gradient(135deg, #e9713a, var(--orange-dark)); }

/* ===== переменные ===== */
.var-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .8fr); gap: 16px; align-items: start; }
.var-list { display: grid; gap: 12px; }
.var-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: 0 5px 16px var(--shadow-color);
}
.var-card.off { opacity: .62; }
.var-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.var-head h3 { font-size: 15px; letter-spacing: -.01em; }
.var-token { font-family: var(--mono); font-size: 11px; color: var(--teal); background: var(--teal-soft); border-radius: 6px; padding: 1px 6px; }
.var-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.var-text {
  white-space: pre-wrap; background: var(--text-bg); border: 1px solid var(--text-line);
  border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.55; color: var(--text-ink);
}
.var-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.var-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.var-actions .btn { font-size: 11.5px; padding: 6px 10px; }
.contact-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  box-shadow: 0 5px 16px var(--shadow-color); position: sticky; top: 14px;
}
.contact-panel h3 { font-size: 15px; margin-bottom: 8px; }
.phone-preview { margin-bottom: 12px; }
.contact-form { display: grid; gap: 9px; }
.check-row { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-2); }
.check-row input { width: 16px; height: 16px; accent-color: var(--orange); }
.switch-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 20px; padding: 3px 9px; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--soft); cursor: pointer; }
.switch-pill.on { color: var(--teal); background: var(--teal-soft); border-color: transparent; }

/* ===== форма «Новый пост» ===== */
.form-grid { display: grid; gap: 12px; }
.form-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pill-row-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.elapsed { font-size: 11px; color: var(--teal); font-weight: 700; }
@media (max-width: 1000px) {
  .var-layout { grid-template-columns: 1fr; }
  .contact-panel { position: static; }
}
@media (max-width: 720px) {
  .form-row2 { grid-template-columns: 1fr; }
  .theme-toggle { height: 32px; }
}
html[data-theme="dark"] .filter { background: var(--card); color: var(--ink-2); border-color: var(--line); }
html[data-theme="dark"] .filter.active { background: var(--orange); color: #fff; border-color: var(--orange); }
html[data-theme="dark"] .platform-pill { background: var(--soft); color: var(--ink-2); }
html[data-theme="dark"] .tab { color: var(--ink-2); }
html[data-theme="dark"] .tab.active { background: var(--topbar); color: var(--topbar-ink); }
html[data-theme="dark"] .btn-soft { color: var(--ink); }
html[data-theme="dark"] .btn-ghost { color: var(--topbar-ink); }
html[data-theme="dark"] .toggle-theme { background: #1f2b27; }

/* ===== загрузка фото ===== */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.file-drop { cursor: pointer; }
.file-trigger { width: 100%; max-width: 240px; }
.file-hint { display: block; }
.upload-preview { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: var(--soft); }
.upload-preview img { display: block; width: 100%; max-height: 220px; object-fit: cover; }
.upload-progress {
  font-size: 12px; font-weight: 700; color: var(--teal); background: var(--teal-soft);
  border-radius: 8px; padding: 6px 10px; text-align: center;
}

/* ===== мобильная версия ===== */
@media (max-width: 720px) {
  .topbar { position: sticky; top: 6px; z-index: 20; }
  .top-actions { flex-wrap: wrap; }
  .top-actions .btn { flex: 1; }
  .toolbar-actions { flex-direction: column; }
  .toolbar-actions .btn { width: 100%; }
  .post-actions .btn { flex: 1 1 40%; }
  .tabs { scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .upload-fields .btn { width: 100%; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .contact-panel { padding: 14px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  .day-head { font-size: 11.5px; }
  .post-text { font-size: 12.5px; max-height: 300px; }
  .ai-prompt textarea { font-size: 12px; }
  input, textarea, select { font-size: 16px !important; }
}
@media (max-width: 480px) {
  .brand-mark { width: 40px; height: 40px; flex-basis: 40px; font-size: 15px; }
  .brand-text p { font-size: 11px; }
  .stat-value { font-size: 22px; }
  .stat-note { min-height: 0; }
}

/* ===== резервный выбор фото ===== */
.picker-fallback { margin-top: 12px; display: grid; gap: 10px; }
.picker-fallback-head { display: flex; flex-direction: column; gap: 2px; }
.picker-drop {
  border: 1.5px dashed var(--line-strong); border-radius: 11px; padding: 18px; text-align: center;
  background: var(--card-2); color: var(--ink-2); display: grid; gap: 3px; font-weight: 700; font-size: 13px;
}
.picker-drop.dragging { border-color: var(--orange); background: var(--orange-soft); }
.picker-drop:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.picker-path { display: grid; gap: 7px; }
.access-list { display: grid; gap: 8px; margin: 10px 0; }
.access-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--line); border-radius: 11px; padding: 9px 12px; background: var(--card-2);
  flex-wrap: wrap;
}
.access-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.access-url { font-family: var(--mono); font-size: 12.5px; word-break: break-all; color: var(--teal); background: transparent; padding: 0; }
.access-row.lan { border-color: var(--teal); }

/* ===== идея поста ===== */
.idea-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  background: var(--card-2); flex-wrap: wrap;
}
.idea-hero p { margin-top: 2px; }
.var-buttons { display: grid; gap: 6px; }
.var-mark {
  display: inline-block; background: var(--amber-soft); color: var(--amber);
  border-radius: 5px; padding: 0 5px; font-size: 11px; font-weight: 700; font-family: var(--sans);
}
@media (max-width: 720px) {
  .idea-hero { flex-direction: column; align-items: stretch; }
  .idea-hero .btn { width: 100%; }
}

/* ===== спокойная палитра: красный и жёлтый акцентами ===== */
.btn-primary { background: var(--orange); box-shadow: 0 4px 12px rgba(181, 80, 47, .18); }
.btn-primary:hover { background: var(--orange-dark); }
.btn-quick, .btn-soft.btn-quick { background: var(--gold); color: #fff; box-shadow: none; border: 1px solid rgba(0,0,0,.04); }
.btn-quick:hover { background: #a37f26; }
.btn-success { background: var(--teal); }
.btn-success:hover { background: #41605a; }
.brand-mark { background: linear-gradient(145deg, var(--gold), var(--orange)); }
.stat-card::after { opacity: .9; }
.stat-card.pending { --accent: var(--orange); }
.stat-card.approved { --accent: var(--teal); }
.stat-card.published { --accent: #6c7d93; }
.stat-card.manual { --accent: var(--gold); }
.topbar { background: #1c2321; }

/* ===== рамки карточек на одобрении ===== */
.post-card {
  border: 2px solid var(--line-strong);
  box-shadow: none;
  background: var(--card);
}
.post-card:hover { border-color: #bfb3a4; }
html[data-theme="dark"] .post-card { border-color: #3d4b45; }
html[data-theme="dark"] .post-card:hover { border-color: #55635c; }
.post-card .post-side { border-left: 1px solid var(--line); }
.post-divider { height: 1px; background: var(--line); margin: 14px 0; }

/* ===== выбор фото из фототеки ===== */
.photo-picker { display: grid; gap: 8px; }
.picker-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12px; font-weight: 800; color: var(--ink-2); }
.pick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pick-thumb {
  padding: 0; border: 2px solid transparent; border-radius: 9px; overflow: hidden;
  background: var(--soft); aspect-ratio: 1; cursor: pointer;
}
.pick-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick-thumb:hover { border-color: var(--gold); }
.pick-thumb.active { border-color: var(--orange); }
.picker-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.quick-upload { cursor: pointer; }
.badge-status { background: var(--gold-soft); color: #7a5f14; }
.badge-status.approved { background: var(--teal-soft); color: var(--teal); }
