/* ==========================================================================
   FOMIN MEDIA 7.3 — UI/UX DESIGN SYSTEM (fomin-media-ui-ux v7.3)
   Brand Palette (Coral #FF5F5D · #FF6F61 · #F9978B | Light #F7FAFC/#FFFFFF/#2D3748 | Dark #292A2F/#2D3748/#FFFFFF/#D3D3D3)
   Responsive: Desktop ≥1280px · Tablet 768–1279px · Mobile 320–767px (375/390/430px)
   ========================================================================== */

:root,
[data-theme="dark"] {
  /* Surfaces (Fomin Media 7.3 Dark Graphite Scale) */
  --bg-primary: #292A2F;
  --bg-secondary: #2D3748;
  --bg-card: #2D3748;
  --bg-elevated: #212226;
  --bg-hover: #364153;
  --bg-input: #212226;
  --bg-glass: rgba(45, 55, 72, 0.92);

  /* Typography Colors */
  --text-primary: #FFFFFF;
  --text-secondary: #D3D3D3;
  --text-muted: #D3D3D3;

  /* Primary Brand Accent (Coral #FF5F5D / #FF6F61 / #F9978B) */
  --accent: #FF5F5D;
  --accent-hover: #FF6F61;
  --accent-active: #E04F4D;
  --accent-secondary: #FF6F61;
  --accent-muted: #F9978B;
  --accent-soft: rgba(255, 95, 93, 0.18);
  --accent-border: #F9978B;
  --accent-gradient: linear-gradient(135deg, #FF5F5D 0%, #FF6F61 100%);
  --accent-glow: 0 0 16px rgba(255, 95, 93, 0.35);

  /* Semantic Status Colors (Aligned with Brand Palette, no 7.0 green theme) */
  --success: #FF6F61;
  --success-hover: #FF5F5D;
  --success-soft: rgba(255, 111, 97, 0.16);
  --success-border: #F9978B;

  --warning: #F59E0B;
  --warning-hover: #D97706;
  --warning-soft: rgba(245, 158, 11, 0.16);
  --warning-border: rgba(245, 158, 11, 0.38);

  --danger: #EF4444;
  --danger-hover: #DC2626;
  --danger-soft: rgba(239, 68, 68, 0.16);
  --danger-border: rgba(239, 68, 68, 0.38);

  /* 1px Structural Borders */
  --border: rgba(211, 211, 211, 0.24);
  --border-strong: #D3D3D3;
  --border-focus: #FF5F5D;

  /* Low-Noise Elevation & Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.30);
  --shadow-modal: 0 20px 48px rgba(0, 0, 0, 0.60);

  /* Typography Stacks */
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* 4px Spacing Scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;

  /* Restrained Corner Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-pill: 9999px;
}

[data-theme="light"] {
  /* Surfaces (Fomin Media 7.3 Light Scale) */
  --bg-primary: #F7FAFC;
  --bg-secondary: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-elevated: #EDF2F7;
  --bg-hover: #E2E8F0;
  --bg-input: #FFFFFF;
  --bg-glass: rgba(255, 255, 255, 0.94);

  /* Typography Colors */
  --text-primary: #2D3748;
  --text-secondary: #4A5568;
  --text-muted: #64748B;

  /* Primary Brand Accent (Coral #FF5F5D / #FF6F61 / #F9978B) */
  --accent: #FF5F5D;
  --accent-hover: #FF6F61;
  --accent-active: #E04F4D;
  --accent-secondary: #FF6F61;
  --accent-muted: #F9978B;
  --accent-soft: rgba(255, 95, 93, 0.12);
  --accent-border: #F9978B;
  --accent-gradient: linear-gradient(135deg, #FF5F5D 0%, #FF6F61 100%);
  --accent-glow: 0 0 14px rgba(255, 95, 93, 0.22);

  /* Semantic Status Colors */
  --success: #FF6F61;
  --success-hover: #FF5F5D;
  --success-soft: rgba(255, 111, 97, 0.12);
  --success-border: #F9978B;

  --warning: #D97706;
  --warning-hover: #B45309;
  --warning-soft: rgba(217, 119, 6, 0.12);
  --warning-border: rgba(217, 119, 6, 0.30);

  --danger: #DC2626;
  --danger-hover: #B91C1C;
  --danger-soft: rgba(220, 38, 38, 0.10);
  --danger-border: rgba(220, 38, 38, 0.28);

  /* 1px Structural Borders */
  --border: #D3D3D3;
  --border-strong: #2D3748;
  --border-focus: #FF5F5D;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(45, 55, 72, 0.05);
  --shadow-md: 0 6px 18px rgba(45, 55, 72, 0.08);
  --shadow: 0 2px 8px rgba(45, 55, 72, 0.06);
  --shadow-modal: 0 16px 40px rgba(45, 55, 72, 0.18);
}

/* Base Accessibility Focus Ring */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Tabular Numbers for Counters, Codes & Versions */
.tabular-nums,
#editor-pub-code,
#editor-version-badge,
#editor-live-char-counter,
#editor-live-hashtag-counter,
#editor-schedule-utc-preview,
#editor-master-accounts-count,
#editor-media-count-badge,
.metric-value {
  font-variant-numeric: tabular-nums;
}

#editor-pub-code,
#editor-version-badge {
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

/* Brand Identity (Purple rounded square logo) */
.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

/* ==========================================================================
   DESKTOP SIDEBAR NAVIGATION (Grouped & Collapsible)
   ========================================================================== */
.sidebar {
  width: 256px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  z-index: 35;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1), padding 0.22s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
}

.sidebar.collapsed {
  width: 72px;
  padding: 16px 8px;
}

.sidebar.collapsed .brand-title,
.sidebar.collapsed .brand-subtitle,
.sidebar.collapsed .nav-group-title,
.sidebar.collapsed .nav-btn-text,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .mac-widget-body {
  display: none !important;
}

.sidebar.collapsed .brand-header {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.sidebar.collapsed .nav-btn {
  justify-content: center;
  padding: 10px 0;
}

.sidebar.collapsed .sidebar-mac-widget {
  padding: 8px;
  text-align: center;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  position: relative;
}

.brand-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--text-primary);
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Sidebar Collapse Toggle Button */
.sidebar-collapse-toggle {
  position: absolute;
  right: -4px;
  top: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  transition: all 0.15s ease;
}

.sidebar-collapse-toggle:hover {
  background: var(--bg-hover);
  color: var(--accent);
  border-color: var(--accent-border);
}

/* Grouped Navigation */
.nav-group {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 6px 10px 4px;
  user-select: none;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.14s ease;
  position: relative;
}

.nav-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-border);
  font-weight: 600;
}

.nav-btn-icon {
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  flex-shrink: 0;
}

.nav-btn-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 600;
}

.nav-btn.active .nav-badge {
  background: var(--accent);
  color: #ffffff;
}

/* Sidebar Bottom Mac Widget */
.sidebar-mac-widget {
  margin-top: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.mac-widget-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mac-widget-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.mac-widget-info {
  flex: 1;
  min-width: 0;
}

.mac-widget-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.mac-widget-role {
  font-size: 10.5px;
  color: var(--text-muted);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  box-shadow: 0 0 6px var(--success);
}

.mac-widget-btn {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.mac-widget-btn:hover {
  background: var(--accent);
  color: #ffffff;
}

/* ==========================================================================
   GLOBAL TOPBAR (Sticky, Responsive SaaS Header)
   ========================================================================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
  flex-wrap: wrap;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Project Selector Dropdown */
.project-selector-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2px 8px;
  transition: border-color 0.15s ease;
}

.project-selector-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.project-selector-wrapper select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 4px;
  outline: none;
  cursor: pointer;
}

/* Topbar Global Search */
.topbar-search-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  width: 220px;
  transition: all 0.15s ease;
}

.topbar-search-box:focus-within {
  width: 280px;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.topbar-search-box input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 12.5px;
  width: 100%;
  outline: none;
}

/* Topbar Notification & User Badge */
.topbar-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.14s ease;
}

.topbar-icon-btn:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.topbar-icon-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--bg-secondary);
}

/* Theme Toggle Button (Dark / Light / System) */
.theme-toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  transition: all 0.14s ease;
}

.theme-toggle-pill:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

/* User Profile Pill */
.topbar-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.user-avatar-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION & OFFCANVAS DRAWER (375 / 390 / 430px)
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.25);
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 6px 10px;
  min-height: 48px;
  min-width: 58px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  touch-action: manipulation;
}

.mobile-nav-btn:hover,
.mobile-nav-btn:active {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.mobile-nav-btn.active {
  color: var(--accent);
  font-weight: 700;
}

.mobile-nav-btn .mobile-icon {
  font-size: 18px;
  line-height: 1;
}

/* Center Elevated FAB for Mac in Mobile Nav */
.mobile-nav-btn.mobile-nav-fab {
  transform: translateY(-8px);
  background: var(--accent-gradient);
  color: #ffffff !important;
  width: 52px;
  height: 52px;
  min-height: 52px;
  min-width: 52px;
  border-radius: 50%;
  box-shadow: var(--shadow-md), var(--accent-glow);
  padding: 0;
  border: 2px solid var(--bg-secondary);
}

.mobile-nav-btn.mobile-nav-fab .mobile-icon {
  font-size: 22px;
}

/* Mobile Slide-Up Drawer / Bottom Sheet («Ещё» и «Контент») */
.mobile-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 60;
  touch-action: none;
}

.mobile-drawer-backdrop.open {
  display: block;
}

.mobile-drawer-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  max-height: 82vh;
  overflow-y: auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 61;
  box-shadow: var(--shadow-modal);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-drawer-backdrop.open .mobile-drawer-sheet {
  transform: translateY(0);
}

.mobile-drawer-handle {
  width: 40px;
  height: 4px;
  background: var(--border-strong);
  border-radius: var(--radius-pill);
  margin: 0 auto 14px;
}

.mobile-drawer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 8px;
}

.mobile-drawer-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  min-height: 40px;
  font-size: 12.5px;
  font-weight: 600;
  transition: all 0.14s ease;
}

.mobile-drawer-card:active,
.mobile-drawer-card.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-border);
}

/* ==========================================================================
   STAGE 5.2 PUBLICATION EDITOR & SPLIT-PANE ARCHITECTURE
   ========================================================================== */
.editor-workspace-split {
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(330px, 0.85fr);
  gap: var(--space-4);
  align-items: start;
}

.editor-workspace-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.editor-workspace-inspector {
  position: sticky;
  top: 68px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.editor-top-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.editor-format-bar-surface {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.segmented-format-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--bg-primary);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.segmented-format-group .btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
}

.segmented-format-group .btn:hover:not(:disabled) {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.segmented-format-group .btn.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow-sm);
}

.editor-writing-canvas {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.editor-writing-canvas input[type="text"],
.editor-writing-canvas textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.editor-writing-canvas input[type="text"]:focus,
.editor-writing-canvas textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.account-toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: all 0.14s ease;
}

.account-toggle-chip:hover:not(.is-locked) {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.account-toggle-chip.is-selected {
  background: var(--success-soft);
  border-color: var(--success-border);
  color: var(--text-primary);
}

.account-toggle-chip.is-locked {
  background: var(--warning-soft);
  border-color: var(--warning-border);
  opacity: 0.68;
  cursor: not-allowed;
}

.publish-command-dock {
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-md);
}

.publish-dock-subpanel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 10px;
}

.publish-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.preview-inspector-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
}

.preview-mockup {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 14px;
  max-width: 100%;
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (Desktop ≥1280px · Tablet 768–1279px · Mobile 320–767px)
   ========================================================================== */
@media (max-width: 1120px) {
  .editor-workspace-split {
    grid-template-columns: minmax(0, 1fr);
  }
  .editor-workspace-inspector {
    position: static;
  }
}

#section-drafts:has(.editor-layout.editor-open) .drafts-page-subtitle {
  display: none;
}

#section-drafts:has(.editor-layout.editor-open) .drafts-page-header {
  margin-bottom: 10px;
}

@media (max-width: 900px) {
  .sidebar {
    display: none !important;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  .main-area {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .topbar {
    padding: 8px 12px !important;
    gap: 8px !important;
  }
  .topbar-search-box {
    display: none;
  }
}

@media (max-width: 768px) {
  #section-drafts:has(.editor-layout.editor-open) .drafts-page-header {
    display: none;
  }
  .editor-writing-canvas,
  .publish-command-dock,
  .preview-inspector-card {
    padding: 12px;
  }
  .segmented-format-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .segmented-format-group .btn {
    width: 100%;
    padding: 6px 4px;
    font-size: 11.5px;
  }
  .publish-actions-row {
    flex-direction: column;
    align-items: stretch;
  }
  .publish-actions-row > div {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .publish-actions-row > div .btn {
    flex: 1 1 auto;
    min-height: 40px;
  }
}

/* ==========================================================================
   STAGE 6.0 COMPLETE MOCKUP LAYOUTS (26 DESIGN REFERENCES PARITY)
   Desktop & Mobile · Dark (#0B0F19) & Light (#F4F6FB) Themes
   ========================================================================== */

/* 1. Tinted KPI Cards (Главная 04, 05, 06) */
.fm6-kpi-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.fm6-kpi-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.fm6-kpi-card {
  position: relative;
  border-radius: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  overflow: hidden;
}

.fm6-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.fm6-kpi-card.tint-purple {
  background: linear-gradient(135deg, rgba(255, 95, 93, 0.16) 0%, rgba(255, 95, 93, 0.05) 100%), var(--bg-card);
  border-color: rgba(255, 95, 93, 0.35);
}
[data-theme="light"] .fm6-kpi-card.tint-purple {
  background: linear-gradient(135deg, rgba(255, 95, 93, 0.10) 0%, rgba(255, 95, 93, 0.03) 100%), #FFFFFF;
  border-color: rgba(255, 95, 93, 0.28);
}

.fm6-kpi-card.tint-blue {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.16) 0%, rgba(59, 130, 246, 0.05) 100%), var(--bg-card);
  border-color: rgba(59, 130, 246, 0.32);
}
[data-theme="light"] .fm6-kpi-card.tint-blue {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.10) 0%, rgba(59, 130, 246, 0.03) 100%), #FFFFFF;
  border-color: rgba(59, 130, 246, 0.25);
}

.fm6-kpi-card.tint-pink {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.16) 0%, rgba(236, 72, 153, 0.05) 100%), var(--bg-card);
  border-color: rgba(236, 72, 153, 0.32);
}
[data-theme="light"] .fm6-kpi-card.tint-pink {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.10) 0%, rgba(236, 72, 153, 0.03) 100%), #FFFFFF;
  border-color: rgba(236, 72, 153, 0.25);
}

.fm6-kpi-card.tint-amber {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16) 0%, rgba(245, 158, 11, 0.05) 100%), var(--bg-card);
  border-color: rgba(245, 158, 11, 0.32);
}
[data-theme="light"] .fm6-kpi-card.tint-amber {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(245, 158, 11, 0.03) 100%), #FFFFFF;
  border-color: rgba(245, 158, 11, 0.28);
}

.fm6-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.fm6-kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
[data-theme="light"] .fm6-kpi-icon {
  background: rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 23, 42, 0.08);
}

.fm6-kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.fm6-kpi-val {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.fm6-kpi-lbl {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 4px;
}

.fm6-kpi-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* 2. Home 2-Column Main Grid (05, 06, 04) */
.fm6-home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 20px;
}

.fm6-home-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.fm6-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.fm6-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.fm6-card-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.fm6-card-link:hover {
  text-decoration: underline;
}

.fm6-news-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.fm6-news-row:last-child {
  margin-bottom: 0;
}
.fm6-news-row:hover {
  border-color: var(--accent-border);
  background: var(--bg-elevated);
}

.fm6-news-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
}

.fm6-ideas-subgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.fm6-idea-mini-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: border-color 0.14s ease;
}
.fm6-idea-mini-card:hover {
  border-color: var(--accent-border);
}

.fm6-task-check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.fm6-task-check-row:last-child {
  margin-bottom: 0;
}

.fm6-mac-assistant-card {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.22) 0%, rgba(79, 70, 229, 0.12) 100%), var(--bg-card);
  border: 1px solid var(--accent-border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
}

/* 3. Desktop 2-Column & Mobile 1-Column Drafts & Editor Workstation (26_Черновики - ПК.png & 25_Черновики - Моб.png) */
@media (min-width: 960px) {
  #section-drafts .editor-layout,
  #section-drafts .editor-layout.editor-fullscreen {
    display: grid !important;
    grid-template-columns: 360px minmax(0, 1fr) !important;
    gap: 16px !important;
    align-items: start !important;
  }
  #section-drafts .editor-layout.editor-fullscreen #drafts-list-card {
    display: block !important;
  }
  #section-drafts #btn-back-to-drafts-list,
  #section-drafts .fm6-mobile-active-draft-bar {
    display: none !important;
  }
}

@media (max-width: 959px) {
  .app-header {
    padding: 8px 12px !important;
  }
  .app-header .fm6-topbar-Search,
  .app-header #auth-status-badge,
  .app-header #btn-voice-mode-toggle,
  .app-header #btn-owner-prefs,
  .app-header .fm6-profile-pill {
    display: none !important;
  }
  #section-drafts .editor-layout,
  #section-drafts .editor-layout.editor-fullscreen {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }
  #section-drafts #drafts-list-card {
    display: none;
  }
  #section-drafts #drafts-list-card.mobile-list-open {
    display: block !important;
  }
  #section-drafts .fm6-mobile-active-draft-bar {
    display: flex !important;
  }
}

.fm6-drafts-tabs-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.fm6-draft-tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
}
.fm6-draft-tab-pill:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.fm6-draft-tab-pill.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}
.fm6-draft-tab-pill .tab-count {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
}
.fm6-draft-tab-pill:not(.active) .tab-count {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.fm6-mobile-active-draft-bar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  cursor: pointer;
}

.fm6-editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.fm6-format-Switch-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.fm6-format-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.14s ease;
}
.fm6-format-btn.btn-primary,
.fm6-format-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-sm);
  font-weight: 700;
}

.fm6-social-pills-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.fm6-plat-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.68;
  transition: all 0.14s ease;
}
.fm6-plat-pill:hover {
  opacity: 0.92;
  border-color: var(--border-strong);
}
.fm6-plat-pill.active {
  opacity: 1;
  color: var(--text-primary);
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.24);
  font-weight: 700;
}
.fm6-plat-pill[data-social-pill].active::after {
  content: "✓";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--success);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  margin-left: 2px;
}
.fm6-plat-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.fm6-plat-icon.tg { background: #0EA5E9; }
.fm6-plat-icon.yt { background: #EF4444; }
.fm6-plat-icon.vk { background: #2563EB; }
.fm6-plat-icon.ig { background: linear-gradient(135deg, #F59E0B, #EC4899, #8B5CF6); }
.fm6-plat-icon.tt { background: #111827; border: 1px solid rgba(255,255,255,0.2); }

@media (max-width: 640px) {
  .fm6-plat-pill {
    padding: 6px 10px;
  }
  .fm6-plat-pill .fm6-plat-name {
    display: none;
  }
}

.fm6-title-input-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px 12px;
  margin-bottom: 10px;
}
.fm6-title-input-box:focus-within {
  border-color: var(--accent);
}
.fm6-title-input-box input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 9px 0 !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  color: var(--text-primary) !important;
}
.fm6-title-counter {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-left: 8px;
  flex-shrink: 0;
}

.fm6-body-textarea-box {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px 32px 14px;
  margin-bottom: 12px;
}
.fm6-body-textarea-box:focus-within {
  border-color: var(--accent);
}
.fm6-body-textarea-box textarea {
  width: 100%;
  min-height: 360px !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  font-size: 14.5px !important;
  line-height: 1.65 !important;
  color: var(--text-primary) !important;
  resize: vertical;
}
@media (max-width: 768px) {
  .fm6-body-textarea-box textarea {
    min-height: 240px !important;
    font-size: 14px !important;
  }
}
.fm6-body-counter {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.fm6-schedule-chip.is-scheduled {
  border-color: var(--success-border);
  background: var(--success-soft);
  color: var(--success);
}

.editor-layout.mode-list-only {
  grid-template-columns: minmax(0, 1fr) !important;
}
.editor-layout.mode-list-only #visual-editor-panel {
  display: none !important;
}
.editor-layout.mode-list-only #drafts-list-card {
  display: block !important;
  max-height: none !important;
}
.editor-layout.editor-fullscreen {
  grid-template-columns: minmax(0, 1fr) !important;
}
.editor-layout.editor-fullscreen #drafts-list-card {
  display: none !important;
}
.editor-layout.editor-fullscreen #visual-editor-panel {
  display: block !important;
}

.fm6-media-strip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.fm6-media-thumb-tile {
  position: relative;
  width: 130px;
  height: 82px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}
.fm6-media-thumb-tile img,
.fm6-media-thumb-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.fm6-media-add-tile {
  width: 96px;
  height: 82px;
  border-radius: 10px;
  border: 1px dashed var(--border-strong);
  background: var(--bg-secondary);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
  flex-shrink: 0;
}
.fm6-media-add-tile:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.fm6-ai-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.fm6-ai-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.14s ease;
}
.fm6-ai-pill.primary-ai {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.fm6-ai-pill:hover {
  border-color: var(--accent);
}

.fm6-bottom-publish-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.fm6-schedule-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}
.fm6-publish-split-group {
  display: inline-flex;
  align-items: stretch;
  border-radius: 8px;
  overflow: hidden;
  background: var(--accent);
}
.fm6-publish-split-group button {
  background: var(--accent);
  color: #ffffff;
  border: none;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.fm6-publish-split-group button:hover:not(:disabled) {
  background: var(--accent-hover);
}
.fm6-publish-split-group .split-caret {
  padding: 8px 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
}

@media (max-width: 640px) {
  .fm6-bottom-publish-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .fm6-schedule-chip {
    justify-content: space-between;
    width: 100%;
  }
  .fm6-bottom-right-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .fm6-publish-split-group {
    grid-column: span 2;
    display: flex;
  }
  .fm6-publish-split-group button:first-child {
    flex: 1;
  }
}

/* Compact News Feed Row (21_Новости и Анализ - ПК.png) */
.fm6-news-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.fm6-news-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.14s ease;
}
.fm6-news-item-row:last-child {
  border-bottom: none;
}
.fm6-news-item-row:hover {
  background: var(--bg-elevated);
}
.fm6-news-brand-box {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  flex-shrink: 0;
}

.fm6-social-circles-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.fm6-social-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border: 2px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.fm6-social-circle.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.fm6-social-circle .check-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 9px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-secondary);
}

.fm6-social-circle.active .check-dot {
  display: flex;
}

.fm6-rich-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.fm6-toolbar-btn {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.fm6-toolbar-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.fm6-draft-queue-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.14s ease;
}
.fm6-draft-queue-item:hover {
  border-color: var(--accent-border);
  background: var(--bg-elevated);
}
.fm6-draft-queue-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.fm6-draft-thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: linear-gradient(135deg, #312E81 0%, #6D28D9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--border);
}

/* 4. News 2-Column Layout (21_Новости и Анализ - ПК.png) */
.fm6-news-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(310px, 0.95fr);
  gap: 18px;
  align-items: start;
}

/* 5. Sub-tabs Pill Bar (Ideas, Review, Tasks, Calendar, Team, Settings) */
.fm6-subtabs-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.fm6-subtab-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.14s ease;
}
.fm6-subtab-pill:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.fm6-subtab-pill.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* 6. Review 3-Column Master-Detail-Inspector Layout (17_На согласовании - ПК.png) */
.fm6-review-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1.35fr) 320px;
  gap: 16px;
  align-items: start;
}

/* 7. Tasks 4-Column Kanban + Sidebar (09_Задачи - ПК.png) */
.fm6-tasks-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}

.fm6-kanban-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.fm6-kanban-col {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fm6-kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 8. Calendar 7-Column Month Grid + Day Schedule (13_Календарь - ПК.png) */
.fm6-calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.fm6-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.fm6-cal-day-header {
  text-align: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 6px 0;
  text-transform: uppercase;
}

.fm6-cal-cell {
  min-height: 92px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
}
.fm6-cal-cell.today {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.fm6-cal-chip {
  padding: 3px 6px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* 9. Team & AI Office Visual Scene + Inspector (15_Команда и AI-офис - ПК.png) */
.fm6-office-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}

.fm6-office-scene {
  background: radial-gradient(circle at 50% 45%, rgba(255, 95, 93, 0.20) 0%, rgba(41, 42, 47, 0.94) 75%), var(--bg-secondary);
  border: 1px solid var(--accent-border);
  border-radius: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
}
[data-theme="light"] .fm6-office-scene {
  background: radial-gradient(circle at 50% 45%, rgba(255, 95, 93, 0.12) 0%, rgba(247, 250, 252, 0.96) 75%), #FFFFFF;
}

.fm6-office-desks-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  position: relative;
  z-index: 2;
}

.fm6-agent-desk {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.16s ease;
  box-shadow: var(--shadow-sm);
}
.fm6-agent-desk:hover,
.fm6-agent-desk.active {
  border-color: var(--accent);
  box-shadow: var(--accent-glow);
  transform: translateY(-2px);
}
.fm6-agent-desk.chief-desk {
  grid-column: span 2;
  background: linear-gradient(135deg, rgba(255, 95, 93, 0.22) 0%, rgba(255, 95, 93, 0.06) 100%), var(--bg-card);
  border-color: var(--accent);
}

/* 10. Settings 3-Column Bento Grid (19_Настройки- ПК.png) */
.fm6-settings-bento {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

/* 11. Toggle Switch Component */
.fm6-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.fm6-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.fm6-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--bg-hover);
  border: 1px solid var(--border-strong);
  transition: 0.2s;
  border-radius: 999px;
}
.fm6-switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  transition: 0.2s;
  border-radius: 50%;
}
.fm6-switch input:checked + .fm6-switch-slider {
  background-color: var(--accent);
  border-color: var(--accent);
}
.fm6-switch input:checked + .fm6-switch-slider:before {
  transform: translateX(18px);
}

/* ==========================================================================
   12. FOMIN MEDIA 7.3 — POSTMYPOST-STYLE WORKSPACE, RAIL, KANBAN SWIPE & EDITOR
   ========================================================================== */

/* Desktop Leftmost Project Avatar Rail (22.59.34.png – 23.04.14.png) */
.project-rail {
  width: 54px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 36;
  overflow-y: auto;
}
.rail-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
  transition: all 0.14s ease;
}
.rail-circle:hover {
  border-color: var(--accent);
}
.rail-circle.active {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent-muted);
}
.rail-circle.c2 { background: #2D3748; color: #FFFFFF; }
.rail-circle.c3 { background: #FF6F61; color: #FFFFFF; }
.rail-circle.c4 { background: #F9978B; color: #2D3748; }

/* Standalone Full-Page Editor Mode (Item 15: hide sidebars & drafts list when in standalone editor) */
body[data-standalone-editor="1"] .sidebar,
body[data-standalone-editor="1"] .project-rail,
body[data-standalone-editor="1"] #drafts-list-card,
body[data-standalone-editor="1"] #section-drafts .editor-layout #drafts-list-card,
body[data-standalone-editor="1"] #section-drafts .editor-layout.editor-fullscreen #drafts-list-card,
body[data-standalone-editor="1"] .drafts-page-header,
body[data-standalone-editor="1"] #drafts-top-status-tabs,
body[data-standalone-editor="1"] .fm6-mobile-active-draft-bar,
body[data-standalone-editor="1"] #section-drafts .fm6-mobile-active-draft-bar {
  display: none !important;
}
body[data-standalone-editor="1"] #drafts-editor-layout,
body[data-standalone-editor="1"] #section-drafts .editor-layout,
body[data-standalone-editor="1"] #section-drafts .editor-layout.editor-fullscreen {
  grid-template-columns: minmax(0, 1fr) !important;
  max-width: 960px;
  margin: 0 auto;
}

/* Postmypost Underline Subtabs & Segmented View Switchers */
.pmp-underline-tabs {
  display: flex;
  align-items: center;
  gap: 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  padding: 0 4px;
  scrollbar-width: none;
}
.pmp-utab,
.pmp-tab {
  padding: 8px 4px 9px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.pmp-utab.active,
.pmp-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
}
.pmp-segmented {
  display: inline-flex;
  background: var(--bg-elevated);
  padding: 3px;
  border-radius: 9px;
  gap: 2px;
  border: 1px solid var(--border);
}
.pmp-seg-btn {
  border: none;
  background: transparent;
  color: var(--text-primary);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.pmp-seg-btn.active {
  background: var(--accent);
  color: #FFFFFF;
}

/* Horizontal Swipe Kanban Boards (Items 5 & 6 + IMG_3842–3845) */
.pmp-kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 10px;
  -webkit-overflow-scrolling: touch;
}
.pmp-kanban-col {
  flex: 0 0 265px;
  scroll-snap-align: start;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 74vh;
  overflow-y: auto;
}
.pmp-col-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 3px 9px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 700;
  color: #FFFFFF;
  background: #2D3748;
}
.pmp-col-badge.coral { background: var(--accent); }
.pmp-col-badge.soft { background: var(--accent-hover); }

/* Postmypost Version Card inside Standalone Publication Editor (Item 1 & image2.png) */
.pmp-version-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.pmp-version-card.focused {
  border-color: var(--accent);
}
.pmp-acc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 5px;
  border-radius: 99px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}
.pmp-acc-chip.selected {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}
.pmp-acc-chip.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 3-Column Desktop Inbox (23.00.20.png) */
.inbox-3col {
  display: grid;
  grid-template-columns: 260px 1fr 240px;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  min-height: 440px;
}

/* Analytics Post Table with Progress Bars (23.02.16.png) */
.stat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.stat-table th, .stat-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.stat-bar {
  height: 4px;
  border-radius: 99px;
  background: var(--bg-elevated);
  margin-top: 4px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  background: var(--accent);
}

/* Rows / Compact Table View Mode (Item 7: Список / Строки) */
.view-mode-rows {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
}
.view-mode-rows > * {
  padding: 8px 12px !important;
  margin-bottom: 0 !important;
  border-radius: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
}

/* Responsive Collapse for Tablet & Mobile */
@media (max-width: 1180px) {
  .fm6-review-layout,
  .fm6-tasks-layout,
  .fm6-calendar-layout,
  .fm6-office-layout,
  .fm6-news-layout,
  .fm6-home-grid,
  .inbox-3col {
    grid-template-columns: minmax(0, 1fr);
  }
  .fm6-settings-bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .fm6-kpi-grid-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .project-rail {
    display: none !important;
  }
  .proj-content-split-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 768px) {
  .fm6-kpi-grid-4,
  .fm6-kpi-grid-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .analytics-charts-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }
  .analytics-header-controls {
    width: 100%;
  }
  .analytics-header-controls select {
    flex: 1 1 135px;
    min-width: 0 !important;
  }
  .fm6-ideas-subgrid,
  .fm6-settings-bento {
    grid-template-columns: minmax(0, 1fr);
  }
  .fm6-office-desks-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .fm6-agent-desk.chief-desk {
    grid-column: span 2;
  }
  /* Items 5 & 6: All Kanban boards scroll horizontally left/right on mobile! */
  #tasks-kanban-grid:not(.force-mobile-kanban) {
    display: none !important;
  }
  #tasks-kanban-grid.force-mobile-kanban:not(.hidden),
  .pmp-kanban-board:not(.hidden) {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory !important;
    gap: 10px !important;
    padding-bottom: 10px !important;
    -webkit-overflow-scrolling: touch;
  }
  #tasks-kanban-grid.force-mobile-kanban > *,
  .pmp-kanban-col {
    flex: 0 0 285px !important;
    min-width: 285px !important;
    scroll-snap-align: center !important;
  }
  .fm6-month-grid {
    gap: 3px;
  }
  .fm6-cal-cell {
    min-height: 68px !important;
    padding: 4px;
    font-size: 10px;
  }
  .fm6-cal-chip {
    font-size: 9px;
    padding: 2px 4px;
  }
  .top-header {
    padding: 8px 12px;
    gap: 6px;
  }
}

/* ==========================================================================
   STAGE 7.3 TELEGRAM DESKTOP UI/UX AUDIT REFINEMENTS
   ========================================================================== */
.topbar .project-selector-wrapper {
  max-width: 250px !important;
  flex: 1 1 auto;
}

#mobile-menu-btn {
  display: none !important;
}

@media (max-width: 520px) {
  .topbar .project-selector-prefix {
    display: none !important;
  }
  .topbar .project-selector-wrapper {
    max-width: 235px !important;
    min-width: 135px !important;
    padding: 2px 6px !important;
  }
  .topbar #global-project-select {
    font-size: 12px !important;
    padding: 2px 2px !important;
  }
}

/* Editor Top 4 Action Tiles (Mockup 1) */
.editor-top-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

@media (max-width: 720px) {
  .editor-top-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.editor-top-action-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.14s ease;
}

.editor-top-action-tile:hover,
.editor-top-action-tile.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.editor-expand-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

/* Media Source Chooser Menu (Device / Google Drive / News Source) */
.media-source-chooser-wrap {
  position: relative;
  display: inline-block;
}

.media-source-chooser-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 95;
  min-width: 235px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 6px;
  box-shadow: var(--shadow-lg);
}

.media-source-chooser-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.media-source-chooser-item:hover {
  background: var(--bg-elevated);
  color: var(--accent);
}

/* Version Media Thumbnails & Tiles */
.ver-media-grid {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.ver-media-tile {
  position: relative;
  width: 82px;
  height: 68px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-secondary);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ver-media-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ver-media-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ver-media-add-tile {
  width: 82px;
  height: 68px;
  border-radius: 10px;
  border: 1.5px dashed var(--border-strong);
  background: transparent;
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.14s ease;
}

.ver-media-add-tile:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.btn-save-version-coral {
  width: 100%;
  margin-top: 10px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 95, 93, 0.6);
  background: linear-gradient(135deg, #FF5F5D 0%, #E04846 100%);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.btn-save-version-coral:hover {
  filter: brightness(1.06);
}

/* Mobile Inbox Master-Detail Mode (<= 900px) */
.inbox-mobile-back-btn {
  display: none;
}

@media (max-width: 900px) {
  .inbox-mobile-back-btn {
    display: inline-flex !important;
  }
  .inbox-3col[data-mobile-detail="0"] .inbox-chat-pane,
  .inbox-3col[data-mobile-detail="0"] .inbox-profile-pane {
    display: none !important;
  }
  .inbox-3col[data-mobile-detail="1"] .inbox-threads-pane {
    display: none !important;
  }
}

/* AI Scenarios 2-Column Grid */
.ai-scenarios-grid-2col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 350px) {
  .ai-scenarios-grid-2col {
    grid-template-columns: minmax(0, 1fr);
  }
}





/* At phone widths the date and the word "Сегодня" cannot fit side by side
   in one of seven columns. Use a dot while retaining the accessible text. */
@media (max-width: 480px) {
  .fm6-cal-cell .cal-today-label {
    display: block;
    width: 6px;
    height: 6px;
    flex: 0 0 6px;
    overflow: hidden;
    text-indent: 12px;
    padding: 0 !important;
    background: var(--accent);
    border-radius: 50%;
  }
}
