/* ───────────────────────────────────────────────
   Своё Медиа — themes
   data-theme picks the palette, data-scheme (light|dark) the
   brightness-dependent details. static/theme.js sets both.
   ─────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:wght@500;700&family=JetBrains+Mono:wght@400&display=swap');

:root {
  /* OLIVE — dark (default) */
  --bg:          #111110;
  --bg-card:     #1b1b19;
  --bg-card2:    #232320;
  --bg-input:    #171715;
  --border:      #2f2f2a;
  --border-glow: #5A5A40;
  --accent:      #9a9a68;
  --accent-2:    #b8b884;
  --accent-glow: color-mix(in srgb, var(--accent) 18%, transparent);
  --on-accent:   #fff;
  --danger:      #e57373;
  --danger-dark: #c62828;
  --success:     #67ad74;
  --warning:     #e0a43a;
  --waiting:     #9aa1ad;
  --text:        #E9E9E4;
  --text-muted:  #a3a39a;
  --text-dim:    #6f6f66;
  --tg-color:    #29b6f6;
  --vk-color:    #5181b8;
  --code-bg:     #0b0b0a;
  --code-text:   #d2d2a4;
  --bubble-bg:   #26261f;
  --glow-1:      color-mix(in srgb, var(--accent) 22%, transparent);
  --glow-2:      color-mix(in srgb, #3b82f6 10%, transparent);
  --header-bg:   color-mix(in srgb, var(--bg) 72%, transparent);
  --radius:      16px;
  --radius-sm:   10px;
  --shadow:      0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px -12px rgba(0,0,0,.6);
  --shadow-lift: 0 18px 40px -16px rgba(0,0,0,.7);
  --transition:  .2s cubic-bezier(.2,.7,.2,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  color-scheme: dark;
}

/* LINEN — light olive (former light theme) */
[data-theme="linen"] {
  --bg:          #F6F4EE;
  --bg-card:     #ffffff;
  --bg-card2:    #F0EDE5;
  --bg-input:    #ffffff;
  --border:      #E4DED0;
  --border-glow: #9a9a74;
  --accent:      #5A5A40;
  --accent-2:    #7A7A5C;
  --danger:      #d32f2f;
  --danger-dark: #b71c1c;
  --success:     #398848;
  --warning:     #a96a00;
  --waiting:     #667085;
  --text:        #1d1d1a;
  --text-muted:  #55554c;
  --text-dim:    #9a9a90;
  --code-bg:     #f3f1ea;
  --code-text:   #4a4a32;
  --bubble-bg:   #f1eee6;
  --glow-1:      color-mix(in srgb, var(--accent) 12%, transparent);
  --glow-2:      color-mix(in srgb, #e8b04a 12%, transparent);
}

/* MIDNIGHT — indigo dark */
[data-theme="midnight"] {
  --bg:          #0c0e1a;
  --bg-card:     #141729;
  --bg-card2:    #1b1f36;
  --bg-input:    #10132a;
  --border:      #272c4a;
  --border-glow: #4b4f9a;
  --accent:      #8b7cf6;
  --accent-2:    #b3a8ff;
  --text:        #e8e9f7;
  --text-muted:  #a3a6c6;
  --text-dim:    #6b6f94;
  --code-bg:     #090b16;
  --code-text:   #c7c0ff;
  --bubble-bg:   #1e2240;
  --glow-1:      color-mix(in srgb, #8b7cf6 26%, transparent);
  --glow-2:      color-mix(in srgb, #22d3ee 14%, transparent);
}

/* FOREST — emerald dark */
[data-theme="forest"] {
  --bg:          #0b1310;
  --bg-card:     #121d18;
  --bg-card2:    #18261f;
  --bg-input:    #0f1914;
  --border:      #23362c;
  --border-glow: #2f6b4f;
  --accent:      #3ec18c;
  --accent-2:    #7fe0b5;
  --on-accent:   #04130c;
  --text:        #e4f1ea;
  --text-muted:  #9cb8aa;
  --text-dim:    #5f7d6e;
  --code-bg:     #08100c;
  --code-text:   #9ff0c8;
  --bubble-bg:   #1a2c23;
  --glow-1:      color-mix(in srgb, #3ec18c 22%, transparent);
  --glow-2:      color-mix(in srgb, #d4e157 10%, transparent);
}

/* SKY — cool light */
[data-theme="sky"] {
  --bg:          #f3f6fb;
  --bg-card:     #ffffff;
  --bg-card2:    #eef2f9;
  --bg-input:    #ffffff;
  --border:      #dbe3f0;
  --border-glow: #8fb0e8;
  --accent:      #2f6fed;
  --accent-2:    #5b8ff2;
  --danger:      #d32f2f;
  --danger-dark: #b71c1c;
  --success:     #2e8a4a;
  --warning:     #a96a00;
  --waiting:     #667085;
  --text:        #142033;
  --text-muted:  #4c5a72;
  --text-dim:    #8d99ad;
  --code-bg:     #eef3fc;
  --code-text:   #1e4fb8;
  --bubble-bg:   #eaf1fd;
  --glow-1:      color-mix(in srgb, #2f6fed 13%, transparent);
  --glow-2:      color-mix(in srgb, #a855f7 10%, transparent);
}

/* APRICOT — warm light */
[data-theme="apricot"] {
  --bg:          #fcf6f0;
  --bg-card:     #ffffff;
  --bg-card2:    #f8eee5;
  --bg-input:    #ffffff;
  --border:      #eedccc;
  --border-glow: #e6a37f;
  --accent:      #d9622b;
  --accent-2:    #ee8650;
  --danger:      #c62828;
  --danger-dark: #a51b1b;
  --success:     #3a8a47;
  --warning:     #a35f00;
  --waiting:     #74685f;
  --text:        #2a1d14;
  --text-muted:  #6a5547;
  --text-dim:    #a8958a;
  --code-bg:     #fbefe5;
  --code-text:   #9a3f12;
  --bubble-bg:   #fbeee3;
  --glow-1:      color-mix(in srgb, #ee8650 16%, transparent);
  --glow-2:      color-mix(in srgb, #f4c430 12%, transparent);
}

[data-scheme="light"] {
  --on-accent:   #fff;
  --header-bg:   color-mix(in srgb, var(--bg-card) 76%, transparent);
  --shadow:      0 1px 2px rgba(30,30,20,.04), 0 10px 28px -14px rgba(30,30,20,.16);
  --shadow-lift: 0 18px 38px -18px rgba(30,30,20,.28);
  color-scheme: light;
}


*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-glow); border-radius: 3px; }

/* ─── HEADER ────────────────────────────────── */
.site-header {
  background: linear-gradient(135deg, var(--code-bg) 0%, #1a1a18 60%, #202018 100%);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,.6);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon { font-size: 2rem; filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 60%, transparent)); }
.logo-text h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent-2), var(--code-text));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}
.logo-text p { font-size: .78rem; color: rgba(255,255,255,.5); letter-spacing: .5px; }
.header-meta { display: flex; gap: 8px; }
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity var(--transition);
}
.badge:hover { opacity: .8; }
.badge-tg { background: var(--tg-color); color: #fff; }
.badge-vk { background: var(--vk-color); color: #fff; }

/* ─── LAYOUT ────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  animation: fadeInUp 0.4s ease both;
}
.section-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 20px;
  font-family: 'Inter', sans-serif;
  letter-spacing: .01em;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.section-header .section-title { margin-bottom: 0; }
.section-toggle, .density-toggle { padding: 6px 12px; min-height: 34px; }
#ai-section.is-collapsed { padding-bottom: 20px; }
#ai-section.is-collapsed .section-header { margin-bottom: 0; }

/* ─── EDITOR ─────────────────────────────────── */
.editor-preview-grid {
  display: block;
  margin-bottom: 16px;
}
.editor-col { display: flex; flex-direction: column; gap: 6px; }

/* ─── UTM SWITCHES ──────────────────────────── */
.utm-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 20px;
  margin: 8px 0 20px;
  padding: 14px 16px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.utm-controls--compact { margin-top: 4px; }
.utm-controls-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-right: auto;
  color: var(--text);
  font-size: .9rem;
  font-weight: 600;
}
.utm-controls-title small {
  color: var(--text-dim);
  font-size: .72rem;
  font-weight: 400;
}
.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: .86rem;
  cursor: pointer;
  user-select: none;
}
.switch-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch-slider {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--border);
  transition: background var(--transition);
}
.switch-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform var(--transition);
}
.switch-control input:checked + .switch-slider { background: var(--accent); }
.switch-control input:checked + .switch-slider::after { transform: translateX(16px); }
.switch-control input:focus-visible + .switch-slider { box-shadow: 0 0 0 3px var(--accent-glow); }

/* ─── QUILL ──────────────────────────────────── */
.editor-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition);
  flex: 1;
}
.editor-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.ql-toolbar.ql-snow {
  background: var(--bg-card2) !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 8px !important;
  flex-wrap: wrap;
}
.ql-toolbar .ql-stroke { stroke: var(--text-muted) !important; }
.ql-toolbar .ql-fill { fill: var(--text-muted) !important; }
.ql-toolbar .ql-picker-label { color: var(--text-muted) !important; }
.ql-toolbar button:hover .ql-stroke,
.ql-toolbar button.ql-active .ql-stroke { stroke: var(--accent) !important; }
.ql-toolbar button:hover .ql-fill,
.ql-toolbar button.ql-active .ql-fill { fill: var(--accent) !important; }
.ql-toolbar button:hover, .ql-toolbar button.ql-active {
  background: var(--accent-glow) !important;
  border-radius: 4px;
}
/* Spoiler toolbar button */
.ql-toolbar .ql-spoiler::before {
  content: '👁';
  font-size: .85rem;
  line-height: 1.5;
}
.ql-container.ql-snow {
  background: var(--bg-input) !important;
  border: none !important;
  font-size: .98rem;
  color: var(--text) !important;
}
.ql-editor { min-height: 200px; padding: 14px 16px; }
.editor-wrap--edit {
  height: clamp(320px, 46vh, 480px);
  display: flex;
  flex-direction: column;
}
.editor-wrap--edit .ql-toolbar { flex: 0 0 auto; }
.editor-wrap--edit .ql-container {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow: hidden;
}
.editor-wrap--edit .ql-editor {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding-bottom: 28px;
}
.ql-editor img[src*="vk.com/emoji/e/"],
.ql-editor img[src*="vk.ru/emoji/e/"] {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  object-fit: contain;
  vertical-align: -0.18em;
  margin: 0 .05em;
}
.ql-editor.ql-blank::before { color: var(--text-dim) !important; font-style: normal !important; }
.ql-editor a { color: var(--accent) !important; }
.ql-editor blockquote {
  border-left: 3px solid var(--accent) !important;
  margin-left: 0 !important;
  padding-left: 12px !important;
  color: var(--text-muted) !important;
  background: var(--accent-glow);
  border-radius: 0 4px 4px 0;
}
.ql-editor pre.ql-syntax {
  background: var(--code-bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  color: var(--code-text) !important;
  font-size: .88rem !important;
  font-family: 'JetBrains Mono', monospace !important;
}
.ql-editor code {
  background: color-mix(in srgb, var(--accent) 12%, transparent) !important;
  color: var(--accent-2) !important;
  border-radius: 3px;
  padding: 1px 5px;
  font-family: 'JetBrains Mono', monospace;
}
.ql-editor .ql-spoiler {
  background: var(--text-dim);
  color: var(--text-dim);
  border-radius: 3px;
  padding: 0 2px;
  cursor: pointer;
  transition: color var(--transition);
}
.ql-editor .ql-spoiler:hover { color: var(--text); }
.ql-snow .ql-tooltip {
  background: var(--bg-card2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow) !important;
}
.ql-snow .ql-tooltip input[type=text] {
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: 4px;
  padding: 4px 8px;
}

/* ─── CHAR COUNTER ───────────────────────────── */
.char-counter {
  font-size: .75rem;
  color: var(--text-dim);
  text-align: right;
  padding: 0 2px;
}
.counter-caution { color: var(--accent-2) !important; }
.counter-warn { color: var(--danger) !important; font-weight: 700; }

/* ─── LIVE PREVIEW PANEL ─────────────────────── */
.preview-panel {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 258px;
  overflow: hidden;
}
.preview-header {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
  gap: 2px;
  flex-shrink: 0;
}
.preview-hint {
  margin-left: auto;
  font-size: .7rem;
  color: var(--text-dim);
  padding-right: 10px;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 9px 14px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .82rem;
  transition: all var(--transition);
}
.tab-btn:hover { color: var(--accent); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--accent-glow);
}
.tab-pane {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
  font-size: .88rem;
  line-height: 1.6;
}
.preview-empty { color: var(--text-dim); font-style: italic; font-size: .85rem; }

/* TG preview rendered HTML */
.tab-pane b, .tab-pane strong { font-weight: 700; }
.tab-pane i, .tab-pane em { font-style: italic; }
.tab-pane u { text-decoration: underline; }
.tab-pane s { text-decoration: line-through; color: var(--text-muted); }
.tab-pane a { color: var(--accent); }
.tab-pane code {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-2);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: .85em;
  font-family: 'JetBrains Mono', monospace;
}
.tab-pane pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: .82rem;
  color: var(--code-text);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'JetBrains Mono', monospace;
  margin: 4px 0;
}
.tab-pane blockquote {
  border-left: 3px solid var(--accent);
  margin: 4px 0;
  padding: 6px 12px;
  background: var(--accent-glow);
  border-radius: 0 6px 6px 0;
  color: var(--text-muted);
}
.tg-spoiler {
  background: var(--text-dim);
  color: var(--text-dim);
  border-radius: 3px;
  padding: 0 3px;
  cursor: pointer;
  transition: color var(--transition);
}
.tg-spoiler:hover { color: var(--text); }
.vk-pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: .88rem;
  color: var(--text);
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
}
.preview-photo-note {
  margin-top: 8px;
  font-size: .78rem;
  color: var(--text-muted);
  background: var(--accent-glow);
  border-radius: 6px;
  padding: 5px 10px;
}
.preview-photos {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.preview-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.preview-more {
  width: 72px;
  height: 72px;
  background: var(--bg-card);
  border: 1px dashed var(--border-glow);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: .85rem;
}

/* ─── CAPTION WARNING ───────────────────────── */
.caption-warning {
  margin-top: 6px;
  padding: 8px 12px;
  background: rgba(229,115,115,.1);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  font-size: .78rem;
  color: var(--danger);
  line-height: 1.5;
}
.caption-warning strong { color: #ef9a9a; }

/* ─── UPLOAD ─────────────────────────────────── */
.upload-section { margin-bottom: 14px; }
.photo-platform-controls { display:flex; flex-wrap:wrap; align-items:center; gap:12px 20px; margin-top:14px; }
.photo-platform-controls small { display:block; flex-basis:100%; color:var(--text-muted); font-size:.75rem; line-height:1.5; }
.photo-platform-controls .switch-control { margin:0; min-height:24px; }
.photo-dropzone {
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.015);
}
.photo-dropzone.is-dragover { border-color: var(--accent); background: var(--accent-glow); }
.upload-hint { color: var(--text-dim); font-size: .72rem; line-height: 1.35; }
.upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.upload-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1.5px dashed var(--border-glow);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .85rem;
  color: var(--text-muted);
  transition: all var(--transition);
}
.upload-label:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}
.upload-label input[type=file] { display: none; }

.photo-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.thumb-wrap {
  position: relative;
  flex-shrink: 0;
  cursor: grab;
  border-radius: var(--radius-sm);
  outline: 2px solid transparent;
  outline-offset: 2px;
}
.thumb-wrap:focus-visible { outline-color: var(--accent); }
.thumb-wrap.is-dragging { opacity: .5; }
.thumb-wrap.is-drag-target { outline-color: var(--accent-2); }
.thumb-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  background: rgba(0,0,0,0.3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: block;
}
.thumb-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  background: var(--danger-dark);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: .65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.thumb-drag {
  position: absolute;
  top: 4px;
  left: 4px;
  color: #fff;
  background: rgba(0,0,0,.68);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: .72rem;
  line-height: 1.35;
  pointer-events: none;
}
.thumb-num {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: .65rem;
  padding: 1px 5px;
  border-radius: 4px;
}
.thumb-source {
  position: absolute;
  right: 4px;
  bottom: 4px;
  max-width: 54px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(0,0,0,.72);
  color: #fff;
  border-radius: 4px;
  padding: 1px 4px;
  font-size: .56rem;
}
.btn-remove-photo {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--danger);
  font-size: .78rem;
  padding: 5px 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-remove-photo:hover { background: rgba(229,115,115,.1); border-color: var(--danger); }

/* ─── FIELDS ─────────────────────────────────── */
.field-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.field-label { font-size: .85rem; color: var(--text-muted); white-space: nowrap; }
.field-row--group { gap: 10px; }

.radio-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: .85rem;
  color: var(--text-muted);
  transition: all var(--transition);
  user-select: none;
}
.radio-card input[type=radio] { display: none; }
.destination-option, .destination-icons { display:inline-flex; align-items:center; gap:6px; }
.destination-icons { gap:3px; }
.radio-card:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.radio-card.selected {
  border-color: var(--accent);
  color: var(--text);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 15%, transparent), color-mix(in srgb, var(--accent-2) 8%, transparent));
}

.datetime-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 12px;
  font-size: .9rem;
  outline: none;
  transition: border-color var(--transition);
  }
.datetime-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ─── BUTTONS ────────────────────────────────── */
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 20px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border: none;
  border-radius: 24px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--on-accent);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--accent) 30%, transparent);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 4px 20px color-mix(in srgb, var(--accent) 50%, transparent); transform: translateY(-1px); }
.btn-ghost { background: none; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }
.btn-danger { background: var(--danger-dark); color: #fff; }
.btn-danger:hover { background: #b71c1c; }

/* ─── STATUS ─────────────────────────────────── */
.status-msg {
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 500;
}
.status-msg.success { background: color-mix(in srgb, var(--success) 14%, transparent); border: 1px solid var(--success); color: var(--success); }
.status-msg.error { background: rgba(229,115,115,.12); border: 1px solid var(--danger); color: var(--danger); }

/* ─── QUEUE FILTERS ──────────────────────────── */
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: .78rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.queue-controls { display:flex; align-items:center; justify-content:flex-end; gap:10px; flex-wrap:wrap; }
.queue-summary { display:flex; align-items:center; gap:8px 18px; flex-wrap:wrap; margin:-6px 0 18px; padding:9px 12px; color:var(--text-muted); background:var(--bg-card2); border:1px solid var(--border); border-radius:var(--radius-sm); font-size:.78rem; }
.queue-summary strong { color:var(--text); font-variant-numeric:tabular-nums; }
.queue-summary .summary-attention.has-attention, .queue-summary .summary-attention.has-attention strong { color:var(--warning); }

/* ─── POST CARDS ─────────────────────────────── */
.posts-group-title {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: .8px;
  text-transform: uppercase;
  margin: 14px 0 8px;
}
.posts-group-title:first-child { margin-top: 0; }
.posts-day-divider { display:flex; align-items:center; gap:10px; margin:12px 2px 8px; color:var(--text-dim); font-size:.76rem; font-weight:600; font-variant-numeric:tabular-nums; }
.posts-day-divider::after { content:''; height:1px; flex:1; background:var(--border); }
.post-card {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color var(--transition), box-shadow var(--transition);
  display:flex;
  flex-direction:row;
}
.post-card-enter { animation: postAppear 0.2s ease both; }
@keyframes postAppear { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .post-card-enter { animation: none; }
}
.post-card:hover { border-color: var(--border-glow); box-shadow: 0 2px 12px rgba(0,0,0,.2); }
.status-border-pending  { border-left-color: var(--waiting); }
.status-border-published { border-left-color: var(--success); }
.status-border-failed   { border-left-color: var(--danger); }
.status-border-partial  { border-left-color: var(--warning); }
.status-border-attention { border-left-color: var(--warning); }
.status-border-publishing { border-left-color: var(--tg-color); animation: sendingEdge 1.6s ease-in-out infinite; }
@keyframes sendingEdge { 50% { border-left-color: color-mix(in srgb, var(--tg-color) 35%, transparent); } }
.send-spinner { width: 11px; height: 11px; flex: none; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sendSpin .8s linear infinite; }
@keyframes sendSpin { to { transform: rotate(360deg); } }
.platform-publishing { animation: pulse 1.6s ease-in-out infinite; }
.send-elapsed { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) {
  .status-border-publishing, .platform-publishing { animation: none; }
  .send-spinner { animation-duration: 2.4s; }
}
.post-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.post-time { font-size: .8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.post-dest {
  font-size: .75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 10px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.platform-icon { width:18px; height:18px; flex:0 0 18px; display:inline-flex; align-items:center; justify-content:center; vertical-align:middle; color:#fff; font-size:7px; line-height:1; font-weight:800; }
.platform-icon-tg { border-radius:50%; background:#229ed9; }
.platform-icon-tg svg { width:12px; height:12px; fill:#fff; }
.platform-icon-vk { border-radius:5px; background:#2787f5; }
.platform-icon.compact { width:15px; height:15px; flex-basis:15px; font-size:6px; }
.platform-icon.compact svg { width:10px; height:10px; }
.post-photo-badge {
  font-size: .72rem;
  background: rgba(41,182,246,.1);
  border: 1px solid rgba(41,182,246,.3);
  border-radius: 12px;
  padding: 2px 8px;
  color: var(--tg-color);
}
.post-status {
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 12px;
}
.status-pending  { background: color-mix(in srgb, var(--waiting) 13%, transparent); color: var(--waiting); }
.status-published { background: color-mix(in srgb, var(--success) 13%, transparent); color: var(--success); }
.status-failed   { background: rgba(229,115,115,.12); color: var(--danger); }
.status-partial  { background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--warning); }
.post-actions { margin-left: auto; display: flex; gap: 4px; }
.btn-icon {
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--accent-glow); border-color: var(--border); }
.post-preview { font-size: .88rem; color: var(--text-muted); line-height: 1.5; }
.post-photo-block { position:relative; flex-shrink:0; width:120px; height:120px; margin-right:16px; border-radius:8px; overflow:hidden; border:1px solid var(--border); }
.post-photo-block img { width:100%; height:100%; object-fit:cover; display:block; }
.post-photo-more { position:absolute; right:4px; bottom:4px; padding:2px 6px; border-radius:4px; color:#fff; background:rgba(0,0,0,.72); font-size:.75rem; }
.external-vk-card { background: color-mix(in srgb, var(--vk-color) 9%, var(--bg-card2)); border-color: color-mix(in srgb, var(--vk-color) 48%, var(--border)); }
.external-vk-card:hover { border-color:var(--vk-color); }
.queue-compact .post-card { padding:9px 11px; margin-bottom:6px; }
.queue-compact .post-photo-block { width:68px; height:68px; margin-right:11px; }
.queue-compact .post-card-top { gap:7px; margin-bottom:3px !important; }
.queue-compact .post-preview { overflow:hidden; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:1; margin-bottom:4px !important; }
.queue-compact .post-attribution { display:none; }
.queue-compact .external-source { margin-bottom:4px; }
.queue-compact .post-card-footer { min-height:26px; }
.queue-compact .post-status, .queue-compact .post-dest { padding-top:1px; padding-bottom:1px; }
.error-text {
  margin-top: 8px;
  font-size: .78rem;
  color: var(--danger);
  background: rgba(229,115,115,.07);
  border-radius: 6px;
  padding: 6px 10px;
}
.empty-msg { text-align: center; color: var(--text-dim); padding: 32px 0; font-size: .9rem; }
.loading { text-align: center; color: var(--text-dim); padding: 24px; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .4; } 50% { opacity: 1; } }

/* ─── MODAL ──────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 380px;
  width: 90%;
  box-shadow: var(--shadow);
  animation: fadeInUp 0.25s ease both;
}
.modal-large { max-width: 800px; width: 95%; }
.modal h3 { font-size: 1.1rem; color: var(--text); margin-bottom: 10px; }
.modal p { font-size: .88rem; color: var(--text-muted); margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ─── FOOTER ─────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 24px;
  font-size: .75rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  margin-top: 12px;
}

/* ─── LOGIN PAGE ─────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-wrap {
  width: 100%;
  max-width: 380px;
  padding: 20px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  box-shadow: 0 8px 48px rgba(0,0,0,.7);
  animation: fadeInUp 0.4s ease both;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 12px color-mix(in srgb, var(--accent) 60%, transparent));
}
.login-logo h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}
.login-logo p {
  font-size: .8rem;
  color: var(--text-muted);
}
.login-error {
  background: rgba(229,115,115,.12);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .85rem;
  margin-bottom: 20px;
  text-align: center;
}
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field label {
  font-size: .82rem;
  color: var(--text-muted);
  font-weight: 500;
}
.login-field input[type=password],
.login-field input[type=text] {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 14px;
  font-size: 1rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.login-field input[type=password] { letter-spacing: .1em; }
.login-field input[type=password]:focus,
.login-field input[type=text]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.login-btn {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 1rem;
  margin-top: 4px;
}
.login-footer {
  text-align: center;
  margin-top: 28px;
  font-size: .72rem;
  color: var(--text-dim);
}

/* ─── LOGOUT BUTTON ──────────────────────────── */
.btn-logout {
  background: none;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 20px;
  color: rgba(255,255,255,.6);
  font-size: .75rem;
  padding: 5px 12px;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); }

/* ─── QUICK TIME GRID ────────────────────────── */
.quick-time-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
  margin-top: 14px;
  width: 100%;
}
.btn-time {
  background: linear-gradient(135deg, var(--bg-card2), var(--bg-card));
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: .85rem;
  padding: 8px 0;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
  z-index: 1;
}
.btn-time::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 20%, transparent), color-mix(in srgb, var(--accent-2) 10%, transparent));
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: -1;
}
.btn-time:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 25%, transparent);
}
.btn-time:hover::before { opacity: 1; }
.btn-time:active {
  transform: translateY(1px);
  box-shadow: 0 1px 4px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* ─── TOAST NOTIFICATIONS ───────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  border-left: 4px solid var(--accent);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  transform: translateX(110%);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  max-width: 360px;
}
.toast.toast-visible {
  opacity: 1;
  transform: translateX(0);
}
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-success { border-left-color: var(--accent); }
.toast-icon { font-size: 1rem; flex-shrink: 0; }

/* ─── REALISTIC PREVIEW ────────────────────────── */
.preview-tg-wrap { display: flex; gap: 8px; align-items: flex-end; max-width: 95%; margin-top: 10px; }
.preview-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--border-glow); display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.preview-bubble {
  background: var(--bubble-bg);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  padding: 8px 10px 4px 10px;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 0.95rem;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
  width: 100%;
  border: 1px solid var(--border);
}
.preview-bubble .preview-photos { margin-bottom: 8px; margin-top: -2px; }
.preview-tg-meta { font-size: 0.7rem; color: var(--accent); float: right; margin-left: 10px; margin-top: 6px; }

.preview-vk-card {
  background: var(--bg-card2);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Roboto", "Helvetica Neue", sans-serif;
  font-size: 0.95rem;
  line-height: 1.4;
  border: 1px solid var(--border);
  margin-top: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.preview-vk-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.preview-vk-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--border-glow); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.preview-vk-name-wrap { display: flex; flex-direction: column; }
.preview-vk-name { font-weight: 500; color: var(--text); font-size: 0.9rem; margin-bottom: 2px; }
.preview-vk-time { color: var(--text-dim); font-size: 0.8rem; }
.vk-text { white-space: pre-wrap; font-family: inherit; margin: 0; font-size: 0.95rem; }

/* ─── LIMIT PROGRESS BARS ──────────────────────── */
.limits-dashboard { display: flex; flex-direction: column; gap: 8px; background: var(--bg-card2); padding: 12px; border-radius: 8px; border: 1px solid var(--border); margin-top: 15px; }
.limit-wrapper { display: flex; flex-direction: column; gap: 5px; }
.limit-header { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--text-muted); }
.limit-title { font-weight: 500; }
.limit-track { width: 100%; height: 6px; background: var(--bg-input); border-radius: 3px; overflow: hidden; }
.limit-fill { height: 100%; background: var(--accent); transition: width 0.3s ease, background-color 0.3s ease; width: 0%; }
.limit-fill.limit-warn { background: #fbc02d; box-shadow: 0 0 5px rgba(251,192,45,0.4); }
.limit-fill.limit-danger { background: var(--danger); box-shadow: 0 0 5px rgba(229,115,115,0.4); }
.limit-header span.danger { color: var(--danger); font-weight: bold; }

/* ─── DAILY TIMELINE ───────────────────────────── */
.timeline-module { margin-top: 12px; background: var(--bg-card2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.timeline-title { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 10px; font-weight: 500; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.timeline-title strong { color: var(--accent); }
.timeline-selection { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.timeline-selection.warning { color: var(--warning); }
.timeline-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.timeline-slot { min-width: 0; white-space: nowrap; font-family: inherit; font-size: 0.75rem; min-height: 34px; padding: 6px 4px; text-align: center; border-radius: 5px; background: var(--bg-input); color: var(--text-muted); transition: border-color var(--transition), background var(--transition); border: 1px solid transparent; }
.timeline-slot.free { cursor: pointer; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); font-weight: 500; }
.timeline-slot.free:hover { background: color-mix(in srgb, var(--accent) 25%, transparent); border-color: var(--accent); }
.timeline-slot.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.timeline-slot.busy { background: rgba(224,164,58,.08); border-color:rgba(224,164,58,.35); color:#e0a43a; cursor:pointer; font-size:0.68rem; display:flex; flex-direction:column; align-items:center; }
.timeline-slot.busy small { font-size: .58rem; opacity: .8; }
.timeline-platforms { display:flex; gap:3px; align-items:center; min-height:15px; }
.timeline-slot.busy.compatible { background: color-mix(in srgb, var(--accent) 8%, transparent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent); }

/* ─── LINK INSPECTOR ─────────────────────────── */
.link-inspector { margin: -10px 0 20px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card2); }
.link-inspector-head { display:flex; justify-content:space-between; gap:12px; color:var(--text-muted); font-size:.75rem; margin-bottom:7px; }
.link-inspector-row { display:grid; grid-template-columns:24px minmax(160px,1fr) auto auto; gap:8px; align-items:center; padding:6px 0; border-top:1px solid var(--border); font-size:.76rem; }
.link-number { color:var(--text-dim); }
.link-origin { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text); }
.link-chip, .platform-state { border:1px solid var(--border); border-radius:999px; padding:2px 8px; white-space:nowrap; color:var(--text-muted); }

/* ─── HISTORY AND USERS ──────────────────────── */
.load-more-wrap { display:flex; justify-content:center; margin-top:14px; }
.post-card-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:auto; }
.post-attribution { display:flex; gap:6px 14px; flex-wrap:wrap; margin:0 0 9px; color:var(--text-dim); font-size:.72rem; }
.post-attribution span { white-space:nowrap; }
.platform-states, .post-actions-inline, .user-actions { display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.platform-state { display:inline-flex; align-items:center; gap:5px; }
.platform-state-link { text-decoration:none; cursor:pointer; transition:border-color var(--transition), background var(--transition), transform var(--transition); }
.platform-state-link:hover { border-color:var(--accent); background:var(--accent-glow); transform:translateY(-1px); }
.platform-missing, .platform-unverified { border-color:color-mix(in srgb, var(--warning) 60%, transparent); color:var(--warning); }
.external-source { display:flex; align-items:center; gap:6px; margin:0 0 9px; color:var(--vk-color); font-size:.72rem; font-weight:600; }
.vk-crosspost { display:flex; align-items:center; gap:6px; margin:-4px 0 9px; font-size:.72rem; font-weight:600; }
.vk-crosspost-copy { color:var(--vk-color); }
.vk-crosspost-in-vk, .vk-crosspost-skip { color:var(--text-muted); }
.vk-crosspost-skip { font-weight:500; }
.queue-compact .vk-crosspost { margin:-2px 0 4px; }
.publish-menu { position:relative; }
.publish-menu > summary { list-style:none; display:inline-flex; align-items:center; justify-content:center; }
.publish-menu > summary::-webkit-details-marker { display:none; }
.publish-menu-popover { position:absolute; right:0; bottom:calc(100% + 6px); z-index:100; width:max-content; min-width:190px; padding:6px; background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-sm); box-shadow:0 8px 24px rgba(0,0,0,.35); }
.publish-menu-item { width:100%; display:flex; align-items:center; gap:8px; border:0; border-radius:6px; padding:7px 9px; background:transparent; color:var(--text); font:inherit; font-size:.78rem; text-align:left; cursor:pointer; }
.publish-menu-item:hover, .publish-menu-item:focus-visible { background:var(--bg-card2); outline:2px solid var(--accent); outline-offset:-2px; }
.publish-menu-item:disabled { opacity:.55; cursor:wait; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.platform-published { color:var(--success); border-color:var(--success); }
.platform-failed { color:var(--danger); border-color:var(--danger); }
.platform-publishing { color:var(--tg-color); border-color:var(--tg-color); }
.current-user { font-size:.78rem; color:rgba(255,255,255,.75); }
.users-modal { max-height:90vh; overflow:auto; }
.user-create-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin-bottom:18px; }
.user-row { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:10px 0; border-top:1px solid var(--border); }
.user-row small { display:block; color:var(--text-dim); margin-top:3px; }
.user-disabled { opacity:.55; }
.tg-account-modal { max-width:460px; }
.tg-account-state p { margin:0 0 8px; }
.tg-account-form { display:grid; gap:10px; margin-top:6px; }
.tg-account-form label { display:grid; gap:4px; font-size:.78rem; color:var(--text-muted); }
.tg-account-hint { margin:0; font-size:.78rem; color:var(--text-dim); }
.tg-account-hint a { color:var(--accent); }
.tg-account-warning { color:var(--warning); font-size:.8rem; }
.tg-account-keys { display:grid; gap:8px; font-size:.78rem; color:var(--text-muted); }
.tg-account-keys summary { cursor:pointer; }
.tg-account-keys[open] { gap:10px; }
.tg-qr-panel { display:grid; gap:10px; justify-items:center; text-align:left; }
.tg-qr-panel.hidden { display:none; }
.tg-qr-image { width:220px; height:220px; padding:8px; background:#fff; border-radius:var(--radius-sm); }
.tg-qr-image svg { width:100%; height:100%; display:block; }
.tg-qr-panel ol { margin:0; padding-left:18px; justify-self:stretch; }
.tg-account-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:6px; }
.audit-title { font-size:.9rem; color:var(--accent); margin:22px 0 8px; }
.audit-list { max-height:220px; overflow:auto; }
.audit-row { display:grid; grid-template-columns:145px 110px 1fr; gap:10px; padding:7px 0; border-top:1px solid var(--border); font-size:.75rem; color:var(--text-muted); }

@media (max-width: 700px) {
  .queue-controls { align-items:stretch; justify-content:flex-start; }
  .density-toggle { width:max-content; }
  .post-card { align-items:flex-start; }
  .post-photo-block { width:82px; height:82px; margin-right:10px; }
  .queue-compact .post-photo-block { width:56px; height:56px; }
  .link-inspector-row { grid-template-columns:24px 1fr; }
  .link-chip { grid-column:2; width:max-content; }
  .user-create-form { grid-template-columns:1fr; }
  .user-row { align-items:flex-start; flex-direction:column; }
  .audit-row { grid-template-columns:1fr; gap:2px; }
}

/* ─── AI TYPE CONTROLS ─────────────────────────── */
.ai-controls {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
  padding-bottom: 2px;
  flex-wrap: nowrap;
}
.ai-controls::-webkit-scrollbar { display: none; }
.ai-controls .radio-card { flex-shrink: 0; }

/* ─── ERROR PANEL ──────────────────────────────── */
mark.error-highlight {
  background: rgba(239,68,68,.18);
  color: inherit;
  border-radius: 2px;
  border-bottom: 2px solid #ef4444;
  cursor: help;
  padding: 0 1px;
}

/* ─── ANIMATIONS ───────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes bulbPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(251,191,36,.5); }
  50%       { opacity: .7; box-shadow: 0 0 0 6px rgba(251,191,36,0); }
}
.bulb-pulsing { animation: bulbPulse 1.4s ease-in-out infinite; }

/* ─── STATUS DOT ──────────────────────────────── */
.status-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid rgba(255,255,255,0.3);
  position: relative;
  flex-shrink: 0;
}
.status-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0;
  transition: opacity 0.3s;
}
.status-dot:hover::after { opacity: 0.4; }

.status-dot-ok { 
  background: #00e676; 
  color: #00e676;
  box-shadow: 0 0 15px rgba(0, 230, 118, 0.6); 
}
.status-dot-error { 
  background: #ff1744; 
  color: #ff1744;
  box-shadow: 0 0 15px rgba(255, 23, 68, 0.6); 
}
.status-dot-checking { 
  background: #ffea00; 
  color: #ffea00;
  animation: pulse-yellow 1s infinite; 
  box-shadow: 0 0 15px rgba(255, 234, 0, 0.6);
}
.status-dot-unknown { 
  background: #757575; 
  color: #757575;
  box-shadow: 0 0 10px rgba(0,0,0,0.4);
}

.ai-select option {
  background-color: var(--bg-card2);
  color: var(--text);
  padding: 10px;
}
[data-scheme="light"] .ai-select option {
  background-color: var(--bg-card);
  color: #1a1a1a;
}

@keyframes pulse-yellow {
  0% { transform: scale(1); box-shadow: 0 0 5px rgba(255, 234, 0, 0.4); }
  50% { transform: scale(1.15); box-shadow: 0 0 20px rgba(255, 234, 0, 0.8); }
  100% { transform: scale(1); box-shadow: 0 0 5px rgba(255, 234, 0, 0.4); }
}

/* ─── UTILS ──────────────────────────────────── */
.hidden { display: none !important; }

/* ─── RESPONSIVE ─────────────────────────────── */
@media (max-width: 800px) {
  .editor-preview-grid { grid-template-columns: 1fr; }
  .preview-col { min-height: 200px; }
  .card { padding: 18px; }
  .header-inner { flex-wrap: wrap; }
  .form-actions { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
}

/* Queue: shared layout with distinct comfortable and compact densities. */
.queue-heading { align-items:center; gap:16px; }
.queue-heading .section-title { margin:0; color:var(--text); text-wrap:balance; }
.queue-subtitle { margin:4px 0 0; color:var(--text-muted); font-size:.78rem; }
.queue-toolbar { display:flex; flex-direction:column; gap:14px; margin-bottom:16px; }
.queue-toolbar .filter-tabs { gap:8px; }
.queue-toolbar .filter-btn { display:inline-flex; align-items:center; gap:8px; min-height:38px; border-radius:8px; padding:7px 12px; }
.filter-count { min-width:22px; padding:1px 5px; border-radius:5px; background:var(--bg-card2); font-size:.7rem; font-variant-numeric:tabular-nums; }
.filter-btn.active .filter-count { background:var(--accent-glow); }
.queue-search-wrap { display:flex; align-items:center; gap:8px; }
#queue-search { width:100%; min-width:0; min-height:42px; padding:10px 13px; border:1px solid var(--border); border-radius:8px; background:var(--bg-input); color:var(--text); font:inherit; font-size:.85rem; }
#queue-search::placeholder { color:var(--text-muted); }
#queue-section :is(button, input, summary):focus-visible { outline:2px solid var(--accent-2); outline-offset:3px; }
.queue-search-status { color:var(--text-muted); font-size:.8rem; margin-bottom:14px; }
#queue-section .queue-summary { margin:0; background:transparent; border:0; border-top:1px solid var(--border); border-radius:0; padding:14px 0 0; }
.queue-sync-status { min-height:20px; margin:7px 0 20px; font-size:.73rem; color:var(--text-muted); font-variant-numeric:tabular-nums; }
.queue-sync-status.is-stale { color:var(--warning); }
#queue-section .post-card { padding:16px; gap:16px; }
#queue-section .post-photo-block { width:96px; height:96px; margin:0; }
.post-card-body { flex:1; min-width:0; display:flex; flex-direction:column; }
#queue-section .post-time { color:var(--text); font-weight:600; font-size:.85rem; }
#queue-section .post-preview { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:3; overflow:hidden; overflow-wrap:anywhere; margin-bottom:12px; color:var(--text); text-wrap:pretty; }
.post-details { margin-top:8px; font-size:.78rem; color:var(--text-muted); }
.post-details summary { width:fit-content; cursor:pointer; padding:4px 0; color:var(--accent-2); }
.post-details[open] { border-top:1px solid var(--border); padding-top:8px; }
.post-full-text { white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.65; margin:8px 0 12px; color:var(--text); }
#queue-section .post-details .post-attribution { display:flex; }
#queue-section.queue-compact .post-card { padding:10px 12px; gap:10px; }
#queue-section.queue-compact .post-photo-block { width:56px; height:56px; }
#queue-section.queue-compact .post-preview { -webkit-line-clamp:1; margin-bottom:5px; font-size:.82rem; }
#queue-section.queue-compact .post-time { font-size:.78rem; }
#queue-section.queue-compact .post-details { margin-top:2px; font-size:.72rem; }
#queue-section.queue-compact .post-details[open] { margin-top:8px; }
@media (max-width:640px) {
  .queue-heading { align-items:flex-start; }
  .queue-toolbar .filter-tabs { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .queue-toolbar .filter-btn { justify-content:space-between; padding:7px 8px; font-size:.7rem; text-align:left; }
  #queue-section .post-card { padding:12px; gap:10px; }
  #queue-section .post-photo-block { width:64px; height:64px; }
  #queue-section.queue-compact .post-photo-block { width:44px; height:44px; }
  #queue-section .post-card-top { gap:6px; }
  #queue-section .post-status { margin-left:0 !important; }
  #queue-section .post-card-footer { align-items:flex-start; }
  .queue-heading .density-toggle { flex-shrink:0; }
}
/* Day planning and editor recovery */
.schedule-navigation, .platform-filter { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.schedule-navigation { margin:12px 0 8px; }
.schedule-navigation .active, .platform-filter .active { color:var(--accent-2); border-color:var(--accent); background:var(--accent-glow); }
.schedule-date-label { display:flex; align-items:center; gap:8px; color:var(--text-muted); font-size:.78rem; }
.schedule-date-label input { border:1px solid var(--border); border-radius:8px; background:var(--bg-input); color:var(--text); padding:7px; font:inherit; }
#schedule-day-count { color:var(--text-muted); font-size:.78rem; margin-left:auto; font-variant-numeric:tabular-nums; }
.schedule-hint { font-size:.75rem; color:var(--text-muted); margin-bottom:12px; }
.timeline-slot.past { opacity:.55; }
.timeline-slot:disabled { cursor:default; }
.schedule-slot-details { border:1px solid var(--border); border-radius:8px; padding:12px; margin-top:12px; }
.slot-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; font-size:.82rem; margin-bottom:8px; }
.slot-post { width:100%; display:flex; gap:10px; align-items:center; padding:10px; margin:6px 0; border:1px solid var(--border); background:var(--bg-card2); color:var(--text); border-radius:8px; text-align:left; cursor:pointer; }
.slot-post img { width:44px; height:44px; object-fit:cover; border-radius:6px; }
.slot-post>span:nth-child(2) { flex:1; min-width:0; }
.slot-post strong { display:block; font-size:.78rem; margin-bottom:3px; }
.slot-post>span>span { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; overflow-wrap:anywhere; color:var(--text-muted); font-size:.78rem; }
.next-publication { width:100%; display:flex; align-items:center; gap:12px; background:var(--accent-glow); color:var(--text); border:1px solid var(--border-glow); border-radius:10px; padding:14px 16px; margin-bottom:18px; text-align:left; cursor:pointer; }
.next-icon { font-size:1.35rem; }
.next-publication>span:nth-child(2) { flex:1; min-width:0; }
.next-publication strong { display:block; font-size:.86rem; }
.next-publication>span>span { display:block; color:var(--text-muted); font-size:.78rem; margin-top:3px; }
.next-publication .next-preview { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.post-card.post-highlight { outline:2px solid var(--accent-2); outline-offset:3px; }
#queue-section, #create-section { scroll-margin-top:100px; }
.draft-status { color:var(--text-muted); font-size:.76rem; margin:-8px 0 14px; min-height:20px; }
.draft-recovery { display:flex; flex-wrap:wrap; align-items:center; gap:8px; border:1px solid var(--border-glow); background:var(--accent-glow); padding:12px; border-radius:8px; margin-bottom:18px; font-size:.82rem; }
.draft-recovery>span { flex:1; min-width:180px; }
#schedule-row :is(button,input):focus-visible { outline:2px solid var(--accent-2); outline-offset:3px; }
@media(max-width:640px) {
  .slot-heading { align-items:flex-start; }
  .schedule-navigation { gap:6px; }
  .schedule-date-label { flex-wrap:wrap; }
  #schedule-day-count { width:100%; margin:0; }
  .next-publication { padding:12px; }
  .platform-filter .btn { padding:7px 10px; font-size:.75rem; }
}

.slot-posts-list { max-height:320px; overflow:auto; margin-bottom:8px; }
:root { --link-tools-gap: 10px; }
.link-tools-toggle { width:100%; display:flex; align-items:center; gap:6px; padding:10px 0; border:0; background:none; color:inherit; text-align:left; cursor:pointer; }
.link-tools-arrow { margin-left:auto; font-size:11px; color:var(--accent); }
.link-tools-row { padding:10px 0; border-bottom:1px solid var(--border); overflow-wrap:anywhere; }
.link-tools-row > div { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
.utm-builder { display:flex; flex-direction:column; gap:var(--link-tools-gap); padding-top:14px; }
.utm-builder label { display:flex; flex-direction:column; gap:5px; font-size:12px; min-width:0; }
.utm-builder input,.utm-builder select,.utm-builder textarea { width:100%; box-sizing:border-box; padding:9px; background:var(--bg); color:var(--text); border:1px solid var(--border); border-radius:8px; font:inherit; }
.utm-builder textarea { resize:vertical; overflow-wrap:anywhere; }
.utm-builder-grid,.utm-template-tools { display:grid; grid-template-columns:1fr 1fr; gap:10px; align-items:end; }
.utm-builder small { color:var(--text-muted); line-height:1.5; }
#utm-copy { align-self:flex-start; width:auto; }
.status-reviewed,.platform-reviewed { color:var(--text-muted); background:var(--bg-card2); }
.status-border-reviewed { border-left-color:var(--border); }
.status-deleted,.platform-deleted { color:var(--text-muted); background:var(--bg-card2); text-decoration:line-through; }
.status-border-deleted { border-left-color:var(--border); opacity:.8; }
.publish-menu-item.danger { color:var(--danger, #d9534f); }
#edit-modal-overlay[data-mode="published"] .edit-scheduled-only { display:none; }
#edit-modal-overlay:not([data-mode="published"]) .edit-published-only { display:none; }
.edit-published-hint { margin:0 0 14px; color:var(--text-muted); font-size:.82rem; }
.utm-advanced { border-top:1px solid var(--border); padding-top:10px; }
.utm-advanced summary { cursor:pointer; color:var(--text-muted); font-size:12px; }
.utm-advanced[open] > summary { margin-bottom:12px; }
.utm-advanced .utm-template-tools { margin-top:12px; }
#utm-error { color:var(--danger); font-size:12px; }
@media(max-width:600px) { .utm-builder-grid,.utm-template-tools { grid-template-columns:1fr; } .link-tools-toggle { flex-wrap:wrap; } }

/* ═══════════════════════════════════════════════
   REDESIGN LAYER — surfaces, motion, theme picker, responsive
   ═══════════════════════════════════════════════ */

/* Soft ambient light behind the page, tinted by the theme. */
body::before {
  content: '';
  position: fixed;
  inset: -20vmax;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40vmax 32vmax at 18% 12%, var(--glow-1), transparent 70%),
    radial-gradient(36vmax 30vmax at 88% 30%, var(--glow-2), transparent 70%),
    radial-gradient(30vmax 26vmax at 50% 100%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%);
  animation: ambientDrift 38s ease-in-out infinite alternate;
}
@keyframes ambientDrift {
  from { transform: translate3d(0,0,0) scale(1); }
  to   { transform: translate3d(-3vmax,2vmax,0) scale(1.06); }
}
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--accent) 45%, var(--border)); }

/* ─── Header: frosted glass bar ─── */
.site-header {
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  box-shadow: 0 8px 24px -18px rgba(0,0,0,.5);
  padding: 12px 24px;
}
.header-inner { max-width: 1160px; }
.logo-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  font-size: 1.5rem;
  border-radius: 14px;
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 30%, var(--bg-card)), var(--bg-card2));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--accent) 70%, transparent);
  filter: none;
  transition: transform .5s var(--ease-spring);
}
.logo:hover .logo-icon { transform: rotate(-8deg) scale(1.06); }
.logo-text h1 {
  background: linear-gradient(90deg, var(--text), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
}
.logo-text p, [data-scheme="light"] .logo-text p { color: var(--text-muted); }
.header-meta { align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.current-user { color: var(--text-muted); }
.btn-logout {
  border-color: var(--border);
  color: var(--text-muted);
  background: color-mix(in srgb, var(--bg-card) 60%, transparent);
  min-height: 32px;
}
.btn-logout:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
a.btn-logout[href="/logout"]:hover { border-color: var(--danger); color: var(--danger); }
.badge { padding: 6px 12px; transition: transform var(--transition), box-shadow var(--transition); }
.badge:hover { opacity: 1; transform: translateY(-1px); box-shadow: 0 6px 14px -6px currentColor; }
.badge-tg { background: linear-gradient(135deg, #2aabee, #229ed9); }
.badge-vk { background: linear-gradient(135deg, #4c8bf5, #2787f5); }

/* ─── Theme picker ─── */
.theme-picker { position: relative; }
#theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  color: var(--text);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-card) 60%, transparent);
}
#theme-toggle .theme-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: conic-gradient(from 200deg, var(--accent), var(--accent-2), var(--bg-card2), var(--accent));
  box-shadow: 0 0 0 2px var(--bg-card), 0 0 10px var(--accent);
  transition: transform .5s var(--ease-spring);
}
#theme-toggle:hover .theme-dot, #theme-toggle[aria-expanded="true"] .theme-dot { transform: rotate(180deg) scale(1.1); }
.theme-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 200;
  width: 260px;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lift);
  transform-origin: top right;
  animation: menuIn .22s var(--ease-spring) both;
}
.theme-menu[hidden] { display: none; }
.theme-menu-title { grid-column: 1 / -1; padding: 2px 4px 4px; font-size: .72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.theme-option {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card2);
  color: var(--text);
  font: inherit;
  font-size: .76rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}
.theme-option:hover { transform: translateY(-2px); border-color: var(--accent); }
.theme-option[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.theme-option:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-swatch {
  position: relative;
  height: 38px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--sw-bg);
  border: 1px solid color-mix(in srgb, var(--sw-accent) 25%, transparent);
}
.theme-swatch::before { content: ''; position: absolute; left: 7px; right: 26px; top: 8px; height: 8px; border-radius: 4px; background: var(--sw-card); }
.theme-swatch::after { content: ''; position: absolute; right: 7px; bottom: 7px; width: 14px; height: 14px; border-radius: 50%; background: var(--sw-accent); box-shadow: 0 0 10px var(--sw-accent); }
.theme-option-auto .theme-swatch { background: linear-gradient(115deg, #f6f4ee 50%, #111110 50%); }
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(.96); } to { opacity: 1; transform: none; } }

/* Theme change: circular reveal (View Transitions API) */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: themeReveal .6s cubic-bezier(.4,0,.2,1) both; }
@keyframes themeReveal {
  from { clip-path: circle(0 at var(--reveal-x, 50%) var(--reveal-y, 0)); }
  to   { clip-path: circle(150vmax at var(--reveal-x, 50%) var(--reveal-y, 0)); }
}

/* ─── Surfaces ─── */
.container { max-width: 1160px; gap: 24px; }
.card {
  background: color-mix(in srgb, var(--bg-card) 92%, transparent);
  border-color: color-mix(in srgb, var(--border) 90%, transparent);
  box-shadow: var(--shadow);
  animation: cardIn .6s cubic-bezier(.2,.7,.2,1) both;
}
main > .card:nth-of-type(2) { animation-delay: .07s; }
main > .card:nth-of-type(3) { animation-delay: .14s; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px) scale(.985); filter: blur(4px); }
  to   { opacity: 1; transform: none; filter: none; }
}
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0;
}
.section-title::after {
  content: '';
  width: 28px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.queue-heading .section-title::after { display: none; }
.editor-wrap, .datetime-input, #queue-search, .schedule-date-label input { border-radius: var(--radius-sm); }
.datetime-input, #queue-search {
  transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}
#queue-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
.utm-controls, .limits-dashboard, .timeline-module, .link-inspector, .queue-summary { border-radius: 12px; }

/* AI controls row (was inline styles) */
.ai-controls-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.ai-model-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 12px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.ai-model-selector .field-label { margin: 0; font-size: .8rem; }
.ai-model-selector .ai-status-label { font-weight: 600; font-size: .85rem; color: var(--text); }
.ai-model-divider { width: 1px; height: 18px; background: var(--border); }
.ai-select.datetime-input { min-width: 180px; padding: 4px 8px; font-size: .85rem; border: none; background: transparent; cursor: pointer; color: var(--accent-2); font-weight: 500; }
.ai-select.datetime-input:focus { box-shadow: none; }
.ai-input-wrap { position: relative; margin-bottom: 14px; }
#ai-input { width: 100%; height: 160px; resize: vertical; padding: 14px 48px 14px 14px; font-family: inherit; line-height: 1.55; }
#ai-toolbar { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; }

/* ─── Buttons & chips ─── */
.btn {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  transition: transform var(--transition), box-shadow var(--transition), background-color var(--transition), border-color var(--transition), color var(--transition);
}
.btn:active:not(:disabled) { transform: translateY(0) scale(.97); }
.btn-primary {
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 20px -10px var(--accent);
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform .7s ease;
}
.btn-primary:hover:not(:disabled)::after { transform: translateX(120%); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 14px 26px -12px var(--accent); }
.btn-ghost { background: color-mix(in srgb, var(--bg-card2) 70%, transparent); }
.btn-ghost:hover:not(:disabled) { transform: translateY(-1px); background: var(--accent-glow); }
.btn-danger { box-shadow: 0 8px 20px -10px var(--danger-dark); }
.btn-icon { border-radius: 10px; transition: transform var(--transition), background-color var(--transition), border-color var(--transition); }
.btn-icon:hover { transform: translateY(-1px) scale(1.06); }
.btn-icon:active { transform: scale(.94); }
.radio-card { border-radius: 12px; transition: transform var(--transition), border-color var(--transition), background-color var(--transition), color var(--transition), box-shadow var(--transition); }
.radio-card:hover { transform: translateY(-1px); }
.radio-card.selected {
  color: var(--text);
  border-color: var(--accent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 20%, transparent), color-mix(in srgb, var(--accent-2) 8%, transparent));
  box-shadow: 0 6px 16px -10px var(--accent);
}
.filter-btn, .queue-toolbar .filter-btn { transition: all var(--transition); }
.filter-btn.active { box-shadow: inset 0 0 0 1px var(--accent); }
.switch-slider { transition: background-color .25s ease; }
.switch-slider::after { transition: transform .35s var(--ease-spring); }
.switch-control input:checked + .switch-slider { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn-time, .timeline-slot { border-radius: 9px; }
.timeline-slot { transition: transform var(--transition), background-color var(--transition), border-color var(--transition); }
.timeline-slot.free:hover, .timeline-slot.busy:hover { transform: translateY(-2px); }
.timeline-slot.selected { color: var(--on-accent); box-shadow: 0 8px 16px -8px var(--accent); animation: slotPop .35s var(--ease-spring); }
@keyframes slotPop { from { transform: scale(.9); } to { transform: scale(1); } }
.limit-track { height: 7px; border-radius: 99px; }
.limit-fill { border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s cubic-bezier(.2,.7,.2,1), background-color .3s ease; }

/* ─── Queue cards ─── */
.post-card {
  border-radius: 14px;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}
.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.post-card-enter { animation: postIn .45s cubic-bezier(.2,.7,.2,1) both; }
#posts-list > .post-card-enter:nth-child(2) { animation-delay: .03s; }
#posts-list > .post-card-enter:nth-child(3) { animation-delay: .06s; }
#posts-list > .post-card-enter:nth-child(4) { animation-delay: .09s; }
#posts-list > .post-card-enter:nth-child(5) { animation-delay: .12s; }
#posts-list > .post-card-enter:nth-child(n+6) { animation-delay: .15s; }
@keyframes postIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.post-photo-block { border-radius: 12px; }
.post-photo-block img { transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.post-card:hover .post-photo-block img { transform: scale(1.06); }
.post-status, .post-dest, .platform-state, .link-chip { border-radius: 999px; }
.next-publication { border-radius: 14px; transition: transform var(--transition), box-shadow var(--transition); }
.next-publication:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.publish-menu-popover { border-radius: 12px; box-shadow: var(--shadow-lift); animation: menuIn .18s var(--ease-spring) both; transform-origin: bottom right; }
.thumb-wrap { transition: transform var(--transition); }
.thumb-wrap:hover { transform: translateY(-2px); }
.thumb-img { border-radius: 10px; }

/* ─── Modals & toasts ─── */
.modal-overlay { background: color-mix(in srgb, #000 55%, transparent); animation: overlayIn .2s ease both; }
.modal { border-radius: 18px; box-shadow: var(--shadow-lift); animation: modalIn .32s var(--ease-spring) both; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
.toast { border-radius: 14px; background: color-mix(in srgb, var(--bg-card) 92%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border: 1px solid var(--border); border-left-width: 4px; }
.toast.toast-success { border-left-color: var(--success); }

/* ─── Third-party widgets follow the theme ─── */
.flatpickr-calendar { background: var(--bg-card) !important; border: 1px solid var(--border) !important; border-radius: 14px !important; box-shadow: var(--shadow-lift) !important; }
.flatpickr-calendar.arrowTop::after, .flatpickr-calendar.arrowTop::before { border-bottom-color: var(--bg-card) !important; }
.flatpickr-months .flatpickr-month, .flatpickr-weekdays, span.flatpickr-weekday, .flatpickr-current-month .flatpickr-monthDropdown-months { background: var(--bg-card) !important; color: var(--text) !important; fill: var(--text) !important; }
.flatpickr-months .flatpickr-prev-month svg, .flatpickr-months .flatpickr-next-month svg { fill: var(--text-muted) !important; }
.flatpickr-day { color: var(--text) !important; border-radius: 9px !important; }
.flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay, .flatpickr-day.flatpickr-disabled { color: var(--text-dim) !important; }
.flatpickr-day:hover { background: var(--accent-glow) !important; border-color: transparent !important; }
.flatpickr-day.today { border-color: var(--accent) !important; }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: var(--accent) !important; border-color: var(--accent) !important; color: var(--on-accent) !important; }
.flatpickr-time, .flatpickr-time input, .flatpickr-time .flatpickr-am-pm, .flatpickr-time .flatpickr-time-separator { background: var(--bg-card) !important; color: var(--text) !important; }
.flatpickr-calendar.hasTime .flatpickr-time { border-top-color: var(--border) !important; }

/* ─── Login ─── */
.login-body { background: var(--bg); }
.login-card { border-radius: 20px; box-shadow: var(--shadow-lift); }
.login-icon { filter: drop-shadow(0 0 16px var(--accent)); animation: floatY 5s ease-in-out infinite; }
@keyframes floatY { 50% { transform: translateY(-6px); } }

/* ─── Focus ─── */
:where(button, a, input, select, textarea, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .site-header { padding: 10px 16px; }
  .header-inner { flex-wrap: wrap; gap: 10px; }
  .header-meta { width: 100%; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
  .header-meta::-webkit-scrollbar { display: none; }
  .header-meta > * { flex: none; }
  .theme-picker { position: static; }
  .theme-menu { right: 16px; top: auto; margin-top: 8px; }
}
@media (max-width: 800px) {
  .container { margin: 18px auto; padding: 0 12px; gap: 16px; }
  .card { padding: 18px 16px; border-radius: 14px; }
  .section-title { font-size: 1.15rem; }
  .ai-model-selector { width: 100%; flex-wrap: wrap; }
  .ai-select.datetime-input { min-width: 0; flex: 1 1 160px; }
  .header-meta .btn-icon, .header-meta .btn { width: auto; }
  .form-actions .btn { width: 100%; justify-content: center; }
  .queue-toolbar .btn, .schedule-navigation .btn, .platform-filter .btn, .section-header .btn, .modal .btn, .post-card .btn, .load-more-wrap .btn, .draft-recovery .btn { width: auto; }
}
@media (max-width: 700px) {
  .site-header { position: relative; }
  .current-user { display: none; }
  .post-card-footer { flex-wrap: wrap; }
  .post-actions-inline { flex-wrap: wrap; }
  .post-actions-inline .btn { white-space: normal; padding: 8px 12px; }
}
@media (max-width: 520px) {
  .logo-icon { width: 38px; height: 38px; font-size: 1.25rem; border-radius: 12px; }
  .logo-text h1 { font-size: 1.1rem; }
  .theme-menu { left: 12px; right: 12px; width: auto; }
  .card { padding: 16px 12px; }
  .utm-controls { padding: 12px; }
  .utm-controls-title { flex-basis: 100%; }
  .field-row--group { gap: 8px; }
  .radio-card { padding: 8px 11px; }
  .modal { padding: 20px 16px; }
  .modal-actions { flex-wrap: wrap; }
  .toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
}

/* ─── Interactive states: hover is a hint, selection is unmistakable ─── */
.radio-card:hover:not(.selected),
.filter-btn:hover:not(.active),
.btn-ghost:hover:not(:disabled):not(.active),
.schedule-navigation .btn:hover:not(.active),
.platform-filter .btn:hover:not(.active) {
  color: var(--text);
  background: var(--bg-card2);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: none;
}
.radio-card.selected,
.filter-btn.active,
.schedule-navigation .btn.active,
.platform-filter .btn.active {
  color: var(--text);
  font-weight: 600;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 22%, var(--bg-card));
  box-shadow: 0 0 0 1px var(--accent) inset, 0 6px 16px -10px var(--accent);
}
.radio-card.selected { padding-left: 12px; }
.radio-card.selected::before {
  content: '';
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: slotPop .3s var(--ease-spring);
}
.filter-btn.active .filter-count { background: var(--accent); color: var(--on-accent); }
.schedule-date-label input { width: 120px; cursor: pointer; }

/* ─── Line icons ─── */
.ui-icon { width: 1.05em; height: 1.05em; flex: none; vertical-align: -0.16em; stroke-width: 2; }
.section-title .ui-icon { width: .95em; height: .95em; color: var(--accent); }
.btn .ui-icon, .btn-logout .ui-icon, .radio-card .ui-icon, .filter-btn .ui-icon, .upload-label .ui-icon { margin-right: 2px; }
.radio-card > span, .timeline-title > span, .utm-controls-title > span { display: inline-flex; align-items: center; gap: 6px; }
.radio-card > span > .ui-icon { margin-right: 0; }
.btn-icon.icon-only { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; color: var(--text-muted); }
.btn-icon.icon-only:hover { color: var(--accent); }
.btn-icon.icon-only .ui-icon { width: 17px; height: 17px; }
.btn-delete.icon-only:hover, .publish-menu summary.icon-only[title^="Удалить"]:hover { color: var(--danger); }
#ai-toolbar .btn-icon.icon-only { width: 30px; height: 30px; background: var(--bg-card2); border-color: var(--border); }
.next-icon .ui-icon { width: 22px; height: 22px; color: var(--accent); }
.posts-group-title .ui-icon { width: 14px; height: 14px; margin-right: 4px; }
.publish-menu-item .ui-icon { width: 15px; height: 15px; }

/* ─── Custom accent in the theme menu ─── */
.theme-accent { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 2px; padding: 8px 6px 2px; border-top: 1px solid var(--border); font-size: .78rem; color: var(--text-muted); }
.theme-accent label { margin-right: auto; }
.theme-accent input[type=color] { width: 34px; height: 26px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: none; cursor: pointer; }
.theme-accent input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
.theme-accent input[type=color]::-webkit-color-swatch { border: 0; border-radius: 6px; }
.theme-accent-reset { border: 1px solid var(--border); background: var(--bg-card2); color: var(--text-muted); border-radius: 8px; padding: 4px 8px; font: inherit; font-size: .74rem; cursor: pointer; }
.theme-accent-reset:hover { color: var(--text); border-color: var(--accent); }

/* ─── Skeleton loading ─── */
.skeleton-list { display: flex; flex-direction: column; gap: 10px; }
.skeleton-card { display: flex; gap: 16px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-card2); }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.sk.sk-chips { display: flex; gap: 8px; margin-top: 4px; background: none; animation: none; }
.sk {
  display: block;
  border-radius: 8px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--text) 6%, transparent) 25%, color-mix(in srgb, var(--text) 13%, transparent) 50%, color-mix(in srgb, var(--text) 6%, transparent) 75%);
  background-size: 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.sk-photo { width: 96px; height: 96px; flex: none; border-radius: 12px; }
.sk-line { height: 12px; }
.sk-line.w40 { width: 40%; height: 14px; }
.sk-line.w90 { width: 90%; }
.sk-line.w70 { width: 70%; }
.sk-chip { width: 120px; height: 26px; border-radius: 999px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (max-width: 640px) { .sk-photo { width: 64px; height: 64px; } .sk-chip { width: 90px; } }

/* ─── Publish celebration ─── */
.celebrate { position: fixed; inset: 0; z-index: 10000; pointer-events: none; display: grid; place-items: center; }
.celebrate-badge {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 22px 28px; border-radius: 22px;
  background: color-mix(in srgb, var(--bg-card) 90%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--border); box-shadow: var(--shadow-lift);
  color: var(--text); font-weight: 600;
  animation: badgeIn 1.8s var(--ease-spring) both;
}
.celebrate-badge svg { width: 64px; height: 64px; fill: none; stroke: var(--success); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.celebrate-badge circle { stroke-dasharray: 145; stroke-dashoffset: 145; animation: drawStroke .5s .1s ease-out forwards; }
.celebrate-badge path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: drawStroke .35s .5s ease-out forwards; }
@keyframes drawStroke { to { stroke-dashoffset: 0; } }
@keyframes badgeIn {
  0% { opacity: 0; transform: scale(.6); }
  15% { opacity: 1; transform: scale(1); }
  80% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(.94) translateY(-10px); }
}
.celebrate i {
  position: absolute; left: 50%; top: 50%;
  width: 9px; height: 14px; border-radius: 2px;
  animation: confetti 1.5s cubic-bezier(.15,.7,.3,1) both;
}
.celebrate i:nth-child(3n) { width: 8px; height: 8px; border-radius: 50%; }
@keyframes confetti {
  0% { opacity: 1; transform: translate(-50%, -50%) rotate(0) scale(.6); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 160px)) rotate(var(--rot)) scale(1); }
}

/* ─── Mobile publish bar ─── */
.mobile-publish-bar { display: none; }
@media (max-width: 700px) {
  .mobile-publish-bar {
    display: block;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg-card) 82%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    transform: translateY(110%);
    transition: transform .35s var(--ease-spring);
  }
  .mobile-publish-bar.is-visible { transform: none; }
  .mobile-publish-bar .btn { width: 100%; justify-content: center; padding: 13px; font-size: 1rem; }
  body.has-mobile-bar { padding-bottom: 76px; }
  body.has-mobile-bar .toast-container { bottom: 84px; }
}

/* ─── Command palette ─── */
.cmdk-trigger kbd, .cmdk kbd {
  font: 500 .66rem/1 'JetBrains Mono', monospace;
  padding: 3px 5px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--bg-card2); color: var(--text-muted);
}
@media (max-width: 700px) { .cmdk-trigger span, .cmdk-trigger kbd { display: none; } }
.cmdk-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; justify-content: center; align-items: flex-start;
  padding: 12vh 16px 16px;
  background: color-mix(in srgb, #000 45%, transparent);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: overlayIn .15s ease both;
}
.cmdk-overlay[hidden] { display: none; }
.cmdk {
  width: min(560px, 100%); max-height: 70vh; display: flex; flex-direction: column;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow-lift); overflow: hidden;
  animation: modalIn .25s var(--ease-spring) both;
}
.cmdk-search { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.cmdk-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 1rem; }
.cmdk-input:focus-visible { outline: 0; }
.cmdk-list { overflow-y: auto; padding: 6px; }
.cmdk-group { padding: 10px 10px 4px; font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }
.cmdk-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; color: var(--text); font-size: .9rem; }
.cmdk-item.is-active { background: var(--accent-glow); box-shadow: inset 2px 0 0 var(--accent); }
.cmdk-item-icon { width: 22px; display: inline-grid; place-items: center; color: var(--text-muted); }
.cmdk-item.is-active .cmdk-item-icon { color: var(--accent); }
.cmdk-swatch { width: 16px; height: 16px; margin: 0 3px; border-radius: 50%; background: var(--sw); box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 3px var(--border); }
.cmdk-empty { padding: 20px; text-align: center; color: var(--text-dim); font-size: .85rem; }
.cmdk-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: .72rem; color: var(--text-dim); }
.cmdk-foot kbd { margin-right: 3px; }

/* ─── Undo / action toasts ─── */
.action-toasts { position: fixed; left: 50%; bottom: 20px; z-index: 10001; display: flex; flex-direction: column; gap: 8px; transform: translateX(-50%); width: min(460px, calc(100vw - 24px)); }
body.has-mobile-bar .action-toasts, body.has-bulk-bar .action-toasts { bottom: 92px; }
.action-toast {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 12px 16px;
  background: color-mix(in srgb, var(--bg-card) 94%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lift);
  color: var(--text); font-size: .88rem; font-weight: 500;
  animation: toastUp .35s var(--ease-spring) both;
}
.action-toast.is-leaving { animation: toastDown .25s ease both; }
.action-toast-text { flex: 1; min-width: 0; }
.action-toast .btn { padding: 7px 12px; flex: none; }
.action-toast-progress { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--accent); transform-origin: left; animation: drain linear both; }
.action-toast-ring { position: relative; flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: conic-gradient(var(--accent) var(--p, 100%), var(--border) 0); animation: ringDrain linear both; }
.action-toast-ring::before { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--bg-card); }
.action-toast-ring b { position: relative; font-size: .8rem; font-variant-numeric: tabular-nums; }
@property --p { syntax: '<percentage>'; inherits: false; initial-value: 100%; }
@keyframes ringDrain { from { --p: 100%; } to { --p: 0%; } }
@keyframes drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes toastUp { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastDown { to { opacity: 0; transform: translateY(12px); } }

/* ─── Best time suggestion ─── */
.best-time {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; width: 100%;
  margin: 0 0 12px; padding: 10px 14px; text-align: left; cursor: pointer;
  color: var(--text); font: inherit; font-size: .84rem;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--bg-card)), var(--bg-card));
  border: 1px dashed color-mix(in srgb, var(--accent) 60%, var(--border)); border-radius: 12px;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.best-time:hover { transform: translateY(-1px); border-style: solid; border-color: var(--accent); box-shadow: 0 8px 18px -12px var(--accent); }
.best-time .ui-icon { color: var(--accent); }
.best-time small { margin-left: auto; color: var(--text-muted); font-size: .74rem; }

/* ─── Drag to reschedule ─── */
.timeline-slot[draggable="true"], .slot-post[draggable="true"] { cursor: grab; }
.timeline-slot[draggable="true"]:active { cursor: grabbing; }
.timeline-slot.is-dragging, .slot-post.is-dragging { opacity: .45; }
.is-drag-active .timeline-slot.free:not(.past) { border-style: dashed; border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.timeline-slot.is-drop-target { background: var(--accent) !important; color: var(--on-accent) !important; border-color: var(--accent) !important; transform: scale(1.06); box-shadow: 0 8px 18px -8px var(--accent); }

/* ─── Bulk selection ─── */
.post-select { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: -2px; cursor: pointer; }
.post-select-input { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin: 0; border: 1.5px solid var(--border-glow); border-radius: 6px; background: var(--bg-input); cursor: pointer; display: grid; place-items: center; transition: background-color var(--transition), border-color var(--transition); }
.post-select-input::after { content: ''; width: 9px; height: 5px; border: 2px solid var(--on-accent); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform .2s var(--ease-spring); }
.post-select-input:checked { background: var(--accent); border-color: var(--accent); }
.post-select-input:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.post-select-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.post-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-lift); background: color-mix(in srgb, var(--accent) 7%, var(--bg-card2)); }
.bulk-bar {
  position: fixed; left: 50%; bottom: 18px; z-index: 95;
  display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 6px;
  max-width: calc(100vw - 24px); padding: 8px 8px 8px 16px;
  background: color-mix(in srgb, var(--bg-card) 92%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--accent); border-radius: 16px; box-shadow: var(--shadow-lift);
  transform: translate(-50%, 140%); opacity: 0; pointer-events: none;
  transition: transform .35s var(--ease-spring), opacity .2s ease;
}
.bulk-bar.is-visible { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.bulk-count { margin-right: 6px; font-size: .86rem; color: var(--text); font-variant-numeric: tabular-nums; }
.bulk-bar button {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card2);
  color: var(--text); font: inherit; font-size: .8rem; cursor: pointer;
  transition: border-color var(--transition), background-color var(--transition);
}
.bulk-bar button:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-glow); }
.bulk-bar button.danger { color: var(--danger); }
.bulk-bar button.danger:hover:not(:disabled) { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.bulk-bar button:disabled { opacity: .55; cursor: wait; }
.bulk-date-wrap { position: relative; }
.bulk-date { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; left: 0; bottom: 0; }
body.has-bulk-bar { padding-bottom: 80px; }
body.has-bulk-bar .mobile-publish-bar { display: none; }

/* ─── Header bell & shortcuts sheet ─── */
.notify-toggle { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--border) !important; border-radius: 50% !important; color: var(--text-muted); background: color-mix(in srgb, var(--bg-card) 60%, transparent); }
.notify-toggle[aria-pressed="true"] { color: var(--accent); border-color: var(--accent) !important; }
.shortcut-row { display: flex; align-items: center; gap: 14px; padding: 9px 10px; border-radius: 10px; font-size: .88rem; color: var(--text); }
.shortcut-row:nth-child(odd) { background: var(--bg-card2); }
.shortcut-row kbd { min-width: 104px; text-align: center; }
.shortcuts-title { display: inline-flex; align-items: center; gap: 8px; }

@media (max-width: 520px) {
  .bulk-bar { left: 12px; right: 12px; bottom: 12px; max-width: none; transform: translateY(140%); justify-content: flex-start; padding: 8px; }
  .bulk-bar.is-visible { transform: none; }
  .bulk-count { width: 100%; margin: 0 0 2px 4px; }
  .best-time small { margin-left: 0; }
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  body::before { animation: none; }
}

/* ─── Quick reschedule popover on queue cards ─── */
.reschedule-popover { top:calc(100% + 6px); bottom:auto; width:270px; padding:10px; display:grid; gap:8px; }
.reschedule-title { font-size:.78rem; font-weight:600; color:var(--text-muted, var(--text)); }
.reschedule-fields { display:grid; grid-template-columns:1fr 108px; gap:6px; }
.reschedule-fields input { min-width:0; padding:6px 8px; border:1px solid var(--border); border-radius:6px; background:var(--bg-card2); color:var(--text); font:inherit; font-size:.8rem; }
.reschedule-chips { display:flex; flex-wrap:wrap; gap:4px; }
.reschedule-chip { border:1px solid var(--border); border-radius:999px; padding:3px 8px; background:transparent; color:var(--text); font:inherit; font-size:.72rem; cursor:pointer; }
.reschedule-chip:hover, .reschedule-chip:focus-visible { background:var(--bg-card2); outline:2px solid var(--accent); outline-offset:-2px; }
.reschedule-note { margin:0; font-size:.72rem; color:var(--text-muted, var(--text)); opacity:.85; }
.reschedule-save { width:100%; padding:7px 10px; font-size:.8rem; }
