/* ============================================================
   DIIS CMS v2 — Design System
   Inspired by: Linear precision, Vercel shadow-as-border,
                Stripe multi-layer depth.
   Palette: warm earth-tones per ARCHITECTURE.md
   ============================================================ */

/* ----- CSS Custom Properties ----- */
:root {
  /* Brand */
  --brand-primary: #0F766E;
  --brand-primary-hover: #115e59;
  --brand-primary-muted: #ccfbf1;
  --brand-accent: #D97706;
  --brand-accent-hover: #b45309;
  --brand-accent-muted: #fef3c7;

  /* Surfaces */
  --surface-page: #f8fafc;
  --surface-card: #ffffff;
  --surface-card-hover: #f1f5f9;
  --surface-card-alt: #f8fafc;
  --surface-elevated: #FFFFFF;
  --surface-overlay: rgba(15, 23, 42, 0.5);

  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-tertiary: #64748b;
  --text-inverse: #FFFFFF;
  --text-muted: #94a3b8;

  /* Borders */
  --border-default: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-focus: #0F766E;

  /* Status */
  --status-success: #15803d;
  --status-success-bg: #dcfce7;
  --status-warning: #b45309;
  --status-warning-bg: #fef3c7;
  --status-danger: #dc2626;
  --status-danger-bg: #fef2f2;
  --status-info: #0369a1;
  --status-info-bg: #e0f2fe;

  /* Priority */
  --priority-high: #dc2626;
  --priority-mid: #b45309;
  --priority-low: #15803d;

  /* Shadows — multi-layer system */
  --shadow-ring: 0 0 0 1px rgba(15, 23, 42, 0.06);
  --shadow-card: 0 0 0 1px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-card-hover: 0 0 0 1px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(15, 23, 42, 0.06), 0 8px 16px -4px rgba(15, 23, 42, 0.04);
  --shadow-elevated: 0 0 0 1px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(15, 23, 42, 0.06), 0 12px 28px -8px rgba(15, 23, 42, 0.06);
  --shadow-modal: 0 0 0 1px rgba(15, 23, 42, 0.06), 0 8px 32px rgba(15, 23, 42, 0.1), 0 20px 48px -12px rgba(15, 23, 42, 0.12);

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Cascadia Code", "Source Code Pro", Consolas, monospace;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;
}

/* ----- Reset & Base ----- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-sans);
  background: var(--surface-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ----- Header — Warm navy gradient ----- */
.header {
  background: linear-gradient(135deg, #0F172A 0%, #1e293b 60%, #0f172a 100%);
  color: var(--text-inverse);
  padding: 0 var(--space-6);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06), 0 4px 12px rgba(0,0,0,0.15);
}

.header-left { display: flex; align-items: center; gap: var(--space-3); }
.header-logo {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  border: 1px solid rgba(255,255,255,0.1);
}
.header-brand { display: flex; flex-direction: column; line-height: 1.2; }
.header-title { font-size: 0.92rem; font-weight: 700; letter-spacing: -0.3px; }
.header-subtitle { font-size: 0.68rem; opacity: 0.55; font-weight: 500; }

.header-right { display: flex; align-items: center; gap: var(--space-3); }
.header-badge {
  background: rgba(255,255,255,0.1);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.08);
  letter-spacing: 0.3px;
}
.header-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700;
  border: 1px solid rgba(255,255,255,0.12);
}

/* ----- Tab Bar — Clean, shadow-bordered ----- */
.tab-bar {
  background: var(--surface-elevated);
  padding: 0 var(--space-6);
  display: flex;
  gap: var(--space-1);
  position: sticky;
  top: 56px;
  z-index: 99;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.05);
}
.tab-btn {
  padding: 13px var(--space-5);
  border: none;
  background: none;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color var(--duration-fast) var(--ease-out);
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  letter-spacing: -0.2px;
}
.tab-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 12px; right: 12px;
  height: 2.5px;
  border-radius: 2px 2px 0 0;
  background: transparent;
  transition: background var(--duration-fast) var(--ease-out);
}
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active { color: var(--brand-primary); }
.tab-btn.active::after { background: var(--brand-primary); }
.tab-icon { font-size: 0.95rem; line-height: 1; }
.tab-badge {
  background: var(--brand-accent-muted);
  color: var(--brand-accent);
  font-size: 0.65rem;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-weight: 700;
  line-height: 1.4;
}

/* ----- Main Content ----- */
.main {
  flex: 1;
  padding: var(--space-6);
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.module { display: none; }
.module.active { display: block; animation: fadeSlideIn 0.25s var(--ease-out); }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ----- Common Components ----- */
.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.9px;
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Cards */
.card {
  background: var(--surface-card);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--duration-normal) var(--ease-out), transform var(--duration-normal) var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-card-hover); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  line-height: 1.5;
}
.badge-priority-high { background: var(--status-danger-bg); color: var(--priority-high); }
.badge-priority-mid  { background: var(--status-warning-bg); color: var(--priority-mid); }
.badge-priority-low  { background: var(--status-success-bg); color: var(--priority-low); }
.badge-info          { background: var(--status-info-bg);    color: var(--status-info); }
.badge-success       { background: var(--status-success-bg); color: var(--status-success); }
.badge-warning       { background: var(--status-warning-bg); color: var(--status-warning); }
.badge-accent        { background: var(--brand-accent-muted); color: var(--brand-accent); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  font-family: var(--font-sans);
  letter-spacing: -0.2px;
  line-height: 1.4;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--brand-accent);
  color: white;
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.25), 0 4px 8px -2px rgba(15, 118, 110, 0.15);
}
.btn-primary:hover {
  background: var(--brand-accent-hover);
  box-shadow: 0 2px 4px rgba(15, 118, 110, 0.3), 0 6px 12px -2px rgba(15, 118, 110, 0.15);
}

.btn-secondary {
  background: var(--surface-card);
  color: var(--text-secondary);
  box-shadow: var(--shadow-ring);
}
.btn-secondary:hover {
  background: var(--surface-card-hover);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.1);
  color: var(--text-primary);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: rgba(15, 23, 42, 0.04); color: var(--text-primary); }

.btn-sm { padding: 5px 12px; font-size: 0.73rem; }
.btn-xs { padding: 3px 8px; font-size: 0.68rem; }

/* Heat bar */
.heat-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--border-subtle);
  overflow: hidden;
}
.heat-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s var(--ease-out);
}
.heat-high { background: var(--status-danger); }
.heat-mid  { background: var(--status-warning); }
.heat-low  { background: var(--status-success); }

/* Platform tag */
.platform-tag {
  display: inline-block;
  font-size: 0.64rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--brand-primary-muted);
  color: #0f766e;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* ============================================================
   Module 1: Topic Selection
   ============================================================ */
.m1-layout {
  display: grid;
  grid-template-columns: 260px 1fr 250px;
  gap: var(--space-5);
  min-height: calc(100vh - 190px);
}

/* Hotspot panel */
.m1-hotspot {}
.data-source-tabs {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}
.source-tab {
  padding: 5px 12px;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-card);
  color: var(--text-tertiary);
  font-family: var(--font-sans);
  transition: all var(--duration-fast) var(--ease-out);
  box-shadow: var(--shadow-ring);
}
.source-tab:hover { color: var(--text-secondary); background: var(--surface-card-hover); }
.source-tab.active { background: var(--brand-primary); color: white; box-shadow: none; }

.hot-list { display: flex; flex-direction: column; gap: 2px; }
.hot-item {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  border-left: 2px solid transparent;
}
.hot-item:hover {
  background: var(--surface-card-hover);
  border-left-color: var(--brand-primary);
}
.hot-rank {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--brand-accent);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1.5;
}
.hot-rank.top3 { color: var(--status-danger); }
.hot-content { flex: 1; min-width: 0; }
.hot-title { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); line-height: 1.35; }
.hot-meta {
  font-size: 0.67rem;
  color: var(--text-muted);
  display: flex;
  gap: var(--space-3);
  margin-top: 2px;
}

/* Topic grid */
.m1-center { display: flex; flex-direction: column; gap: var(--space-4); }
.topic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
.topic-card {
  background: var(--surface-card);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  border: 1px solid transparent;
}
.topic-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--brand-primary);
  transform: translateY(-1px);
}
.topic-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-2);
  gap: var(--space-2);
}
.topic-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}
.topic-card-body {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.topic-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-2);
}
.topic-platforms { display: flex; gap: var(--space-1); flex-wrap: wrap; }
.topic-action { font-size: 0.73rem; color: var(--brand-primary); font-weight: 700; }

/* Progress panel */
.m1-progress {}
.progress-item {
  padding: 10px 12px;
  margin-bottom: var(--space-2);
  background: var(--surface-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-ring);
  border-left: 3px solid;
  transition: box-shadow var(--duration-fast) var(--ease-out);
}
.progress-item:hover { box-shadow: var(--shadow-card); }
.progress-item.p-active { border-left-color: var(--status-success); }
.progress-item.p-pending { border-left-color: var(--status-warning); }
.progress-item.p-done { border-left-color: var(--status-info); }
.progress-name { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); }
.progress-status { font-size: 0.68rem; color: var(--text-tertiary); margin-top: 2px; }
.progress-link { font-size: 0.67rem; color: var(--brand-primary); cursor: pointer; margin-top: 3px; font-weight: 600; }
.progress-link:hover { text-decoration: underline; }

/* ============================================================
   Module 2: Content Calendar
   ============================================================ */
.m2-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.m2-view-toggle {
  display: flex;
  background: var(--surface-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-ring);
  overflow: hidden;
}
.m2-view-btn {
  padding: 7px 20px;
  border: none;
  background: none;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-tertiary);
  font-family: var(--font-sans);
  transition: all var(--duration-fast) var(--ease-out);
}
.m2-view-btn.active { background: var(--brand-primary); color: white; }
.m2-view-btn:not(.active):hover { color: var(--text-secondary); }

.m2-stats { display: flex; gap: var(--space-5); font-size: 0.75rem; }
.stat-item { display: flex; align-items: center; gap: var(--space-2); color: var(--text-tertiary); font-weight: 500; }
.stat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Kanban Board */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-3);
  min-height: 480px;
}
.kanban-col {
  background: var(--surface-card-alt);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-ring);
}
.kanban-col-header {
  font-size: 0.73rem;
  font-weight: 700;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: 0.3px;
}
.kc-drafting  { background: var(--status-info-bg);    color: var(--status-info); }
.kc-reviewing { background: var(--status-warning-bg); color: var(--status-warning); }
.kc-approved  { background: var(--brand-primary-muted); color: #0f766e; }
.kc-scheduled { background: var(--brand-primary-muted); color: var(--brand-primary); }
.kc-published { background: var(--status-success-bg); color: var(--status-success); }
.kanban-col-count { font-size: 0.68rem; opacity: 0.7; }

.kanban-card {
  background: var(--surface-elevated);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: var(--space-2);
  box-shadow: var(--shadow-card);
  cursor: grab;
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
  border: 1px solid transparent;
}
.kanban-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-default);
}
.kanban-card:active { cursor: grabbing; transform: scale(1.02); }
.kanban-card-title { font-size: 0.8rem; font-weight: 600; margin-bottom: var(--space-1); color: var(--text-primary); }
.kanban-card-meta { font-size: 0.66rem; color: var(--text-tertiary); display: flex; gap: var(--space-3); }
.kanban-card-topic {
  font-size: 0.64rem;
  color: var(--brand-accent);
  margin-top: var(--space-1);
}
.kanban-card-date {
  font-size: 0.64rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.kanban-card-platform {
  font-size: 0.62rem;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--brand-primary-muted);
  color: #0f766e;
  font-weight: 700;
}
.kanban-drag-hint {
  position: absolute;
  top: 6px; right: 8px;
  color: var(--text-muted);
  font-size: 0.6rem;
  opacity: 0;
  transition: opacity var(--duration-fast);
  letter-spacing: 1px;
}
.kanban-card:hover .kanban-drag-hint { opacity: 0.5; }

/* Calendar View */
.calendar-view { display: none; }
.calendar-view.active { display: block; }

.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}
.cal-nav-btn {
  padding: 7px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  box-shadow: var(--shadow-ring);
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease-out);
}
.cal-nav-btn:hover { background: var(--surface-card-hover); color: var(--text-primary); }
.cal-month-title { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.3px; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day-header {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-tertiary);
  padding: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cal-day {
  min-height: 80px;
  background: var(--surface-card);
  border-radius: var(--radius-sm);
  padding: 7px 8px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  box-shadow: var(--shadow-ring);
  border: 1px solid transparent;
}
.cal-day:hover { background: var(--surface-card-hover); border-color: var(--border-default); }
.cal-day.other-month { opacity: 0.3; }
.cal-day.today {
  border-color: var(--brand-accent);
  border-width: 2px;
  background: #f0fdfa;
}
.cal-day-num { font-weight: 700; margin-bottom: 3px; font-size: 0.82rem; }
.cal-event-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 3px;
  vertical-align: middle;
  flex-shrink: 0;
}
.cal-event-label {
  font-size: 0.6rem;
  color: var(--text-secondary);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.6;
}

/* ============================================================
   Module 3: AI Creation
   ============================================================ */
.m3-layout {
  display: grid;
  grid-template-columns: 290px 1fr 280px;
  gap: var(--space-5);
  min-height: calc(100vh - 190px);
}

/* Platform selector */
.platform-select {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.platform-option {
  padding: 10px 8px;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  font-size: 0.73rem;
  font-weight: 600;
  transition: all var(--duration-fast) var(--ease-out);
  background: var(--surface-card);
  color: var(--text-secondary);
}
.platform-option:hover { border-color: var(--brand-primary); background: var(--surface-card-hover); }
.platform-option.selected {
  border-color: var(--brand-primary);
  background: #f0fdfa;
  color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(15,118,110,0.1);
}
.platform-option .pf-emoji { font-size: 1.15rem; display: block; margin-bottom: 3px; }

/* Form controls */
.form-group { margin-bottom: var(--space-3); }
.form-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: block;
  margin-bottom: var(--space-1);
  letter-spacing: 0.2px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  background: var(--surface-card);
  color: var(--text-primary);
  transition: border-color var(--duration-fast) var(--ease-out);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(15,118,110,0.1);
}
.form-textarea { resize: vertical; min-height: 65px; }
.form-select { cursor: pointer; }

/* Editor */
.m3-editor { display: flex; flex-direction: column; gap: var(--space-3); }
.editor-toolbar {
  display: flex;
  gap: 2px;
  padding: 5px 8px;
  background: var(--surface-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-ring);
  flex-wrap: wrap;
}
.editor-tool-btn {
  padding: 5px 9px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.8rem;
  border-radius: var(--radius-xs);
  color: var(--text-tertiary);
  font-family: var(--font-sans);
  font-weight: 600;
  transition: all var(--duration-fast) var(--ease-out);
}
.editor-tool-btn:hover { background: var(--surface-card-hover); color: var(--text-primary); }
.editor-area {
  flex: 1;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  line-height: 1.75;
  background: var(--surface-elevated);
  overflow-y: auto;
  color: var(--text-primary);
  min-height: 320px;
  transition: border-color var(--duration-fast) var(--ease-out);
}
.editor-area:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(15,118,110,0.1); }
.editor-area .ai-placeholder { color: var(--text-muted); font-style: italic; }
.editor-actions { display: flex; gap: var(--space-2); }

/* Preview */
.preview-frame {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 14px;
  background: var(--surface-elevated);
  min-height: 320px;
  font-size: 0.8rem;
  line-height: 1.65;
  box-shadow: var(--shadow-card);
}
.preview-frame .pf-header {
  font-size: 0.67rem;
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
}
.preview-frame .pf-title { font-size: 0.88rem; font-weight: 700; margin: var(--space-3) 0; color: var(--text-primary); }
.preview-frame .pf-body { color: var(--text-secondary); }
.preview-frame .pf-meta {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

/* ============================================================
   Module 4: Publishing Engine
   ============================================================ */
.m4-layout { display: flex; flex-direction: column; gap: var(--space-5); }

/* Pipeline */
.pipeline {
  display: flex;
  align-items: center;
  background: var(--surface-elevated);
  border-radius: var(--radius-lg);
  padding: 22px var(--space-8);
  box-shadow: var(--shadow-card);
}
.pipeline-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.pipeline-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--border-subtle);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  margin-bottom: var(--space-2);
  transition: all var(--duration-normal) var(--ease-out);
  border: 2px solid transparent;
}
.pipeline-step.active .pipeline-icon {
  background: var(--brand-primary);
  color: white;
  box-shadow: 0 0 0 4px rgba(15,118,110,0.15);
}
.pipeline-step.done .pipeline-icon {
  background: var(--status-success);
  color: white;
  box-shadow: 0 0 0 4px rgba(21,128,61,0.12);
}
.pipeline-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
}
.pipeline-step.active .pipeline-label { color: var(--brand-primary); }
.pipeline-step.done .pipeline-label { color: var(--status-success); }
.pipeline-arrow {
  font-size: 1.3rem;
  color: var(--border-default);
  margin: 0 var(--space-2);
  margin-bottom: 22px;
  flex-shrink: 0;
}

/* Platform grid */
.m4-body { display: grid; grid-template-columns: 1fr 310px; gap: var(--space-5); }
.platform-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.platform-check {
  padding: 16px 10px;
  border: 2px solid var(--border-default);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  background: var(--surface-card);
  user-select: none;
}
.platform-check:hover { border-color: var(--brand-primary); background: var(--surface-card-hover); }
.platform-check.checked {
  border-color: var(--brand-accent);
  background: #f0fdfa;
  box-shadow: 0 0 0 3px rgba(15,118,110,0.1);
}
.platform-check .pf-icon { font-size: 1.6rem; display: block; margin-bottom: var(--space-1); }
.platform-check .pf-name { font-size: 0.72rem; font-weight: 700; color: var(--text-primary); }
.platform-check .pf-region { font-size: 0.62rem; color: var(--text-muted); }
.platform-section-label {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  letter-spacing: 0.3px;
}

/* Schedule */
.schedule-card {
  background: var(--surface-card);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
}
.schedule-time {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--brand-accent);
  text-align: center;
  margin: var(--space-3) 0;
  letter-spacing: -0.5px;
}

/* History table */
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.history-table th {
  text-align: left;
  padding: 9px var(--space-3);
  color: var(--text-tertiary);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  border-bottom: 2px solid var(--border-default);
}
.history-table td {
  padding: 10px var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.history-table tr:hover td { background: var(--surface-card-hover); }
.history-status { font-weight: 700; font-size: 0.75rem; }
.hs-sent    { color: var(--status-success); }
.hs-failed  { color: var(--status-danger); }
.hs-pending { color: var(--status-warning); }

/* ============================================================
   Footer
   ============================================================ */
.footer {
  text-align: center;
  padding: var(--space-4);
  color: var(--text-muted);
  font-size: 0.7rem;
  border-top: 1px solid var(--border-subtle);
  letter-spacing: 0.2px;
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  top: 72px;
  right: var(--space-6);
  background: var(--status-success);
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.82rem;
  box-shadow: var(--shadow-elevated);
  z-index: 200;
  opacity: 0;
  transform: translateX(16px);
  transition: all 0.3s var(--ease-out);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(0); }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--surface-overlay);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
  backdrop-filter: blur(2px);
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-box {
  background: var(--surface-elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-modal);
  transform: translateY(8px);
  transition: transform var(--duration-normal) var(--ease-out);
}
.modal-overlay.show .modal-box { transform: translateY(0); }
.modal-title { font-size: 1.05rem; font-weight: 700; margin-bottom: var(--space-3); color: var(--text-primary); }
.modal-body { font-size: 0.84rem; color: var(--text-secondary); margin-bottom: var(--space-6); line-height: 1.6; }
.modal-actions { display: flex; gap: var(--space-3); justify-content: flex-end; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1200px) {
  .m1-layout { grid-template-columns: 1fr; }
  .m3-layout { grid-template-columns: 1fr; }
  .m4-body   { grid-template-columns: 1fr; }
  .kanban-board { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .main { padding: var(--space-4); }
  .kanban-board { grid-template-columns: 1fr 1fr; }
  .topic-grid { grid-template-columns: 1fr; }
  .platform-grid { grid-template-columns: repeat(2, 1fr); }
  .pipeline { flex-wrap: wrap; gap: var(--space-3); }
  .pipeline-arrow { display: none; }
}