/* PopWave Editorial SaaS Design System — Restraint, Clarity, High-Craft Typography */

:root {
  --bg: #F6F6F3;
  --surface: #FFFFFF;
  --surface-soft: #FBFBF9;
  --surface-hover: #F2F2EE;
  --border: #E4E3DC;
  --border-strong: #D2D0C6;
  --ink: #141417;
  --ink-secondary: #4E4E57;
  --ink-muted: #76756E;

  --accent: #3250C8;
  --accent-hover: #2842AC;
  --accent-soft: #EEF2FF;
  --accent-border: #C7D2FE;

  --green: #146C45;
  --green-soft: #ECFDF4;
  --green-border: #B3ECCD;

  --amber: #9E4A08;
  --amber-soft: #FEF8EE;
  --amber-border: #F8DCA0;

  --red: #A62117;
  --red-soft: #FEF3F2;
  --red-border: #FBC8C4;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.07);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, 0.16);
  --font: "Onest", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
[hidden], .hidden { display: none !important; }
body.simple-mode .pro-only { display: none !important; }

/* Mobile Header */
.mobile-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 45;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  align-items: center;
  justify-content: space-between;
}

.mobile-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark-sm {
  width: 30px !important;
  height: 30px !important;
  font-size: 11px !important;
  border-radius: 9px !important;
}

/* Auth Gate Overlay */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 18, 28, 0.56);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
}

.auth-card {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px 24px;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: #ECECE6;
  padding: 3px;
  border-radius: 10px;
  margin-bottom: 18px;
}

.auth-tab {
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-token-details {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--ink-muted);
}

.admin-token-details summary { cursor: pointer; font-weight: 500; }

.backup-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.backup-code-row code {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  background: #FFF;
  border: 1px solid var(--green-border);
  padding: 5px 10px;
  border-radius: 8px;
  color: var(--ink);
}

.auth-footer-links {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.auth-footer-links a { text-decoration: none; color: var(--ink-muted); }
.auth-footer-links a:hover { color: var(--ink); }

/* Shell Layout */
.app-shell {
  display: grid;
  grid-template-columns: 258px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 15px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 4px;
}

.brand-home-link {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--ink);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -0.03em;
  flex-shrink: 0;
}

.brand-dot {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #FF6B4A;
}

.brand-title { font-weight: 700; font-size: 16px; letter-spacing: -0.02em; line-height: 1.15; }
.brand-sub { font-size: 11.5px; color: var(--ink-muted); }

.project-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.custom-niche-box {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.voice-mini-card {
  text-align: left;
  width: 100%;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  font-family: inherit;
}

.voice-mini-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.voice-mini-title { font-size: 12.5px; font-weight: 600; color: var(--accent); }
.voice-mini-pct { font-size: 12.5px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.voice-mini-hint { font-size: 11px; color: var(--ink-secondary); margin-top: 6px; }

.progress-track {
  width: 100%;
  height: 5px;
  background: rgba(50, 80, 200, 0.14);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.35s ease;
}

/* Nav */
.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-section-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8.5px 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-item:hover { background: var(--surface-hover); color: var(--ink); }

.nav-item.active {
  background: var(--surface-hover);
  color: var(--ink);
  font-weight: 600;
  border-color: var(--border);
}

.nav-svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--ink-muted); }
.nav-item.active .nav-svg { color: var(--ink); }
.nav-text { flex: 1; text-align: left; }

.nav-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.muted-count { background: #EFEFE9; color: var(--ink-secondary); }

.user-cell-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-cell-name {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-line { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; color: var(--ink-secondary); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.footer-sub { font-size: 11px; color: var(--ink-muted); }

/* Main Area */
.main-area {
  padding: 24px 32px 48px;
  max-width: 1260px;
  width: 100%;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.page-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.page-sub { margin: 4px 0 0; color: var(--ink-secondary); font-size: 13.5px; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Segmented Mode Toggle */
.segmented {
  display: inline-flex;
  background: #EAE9E3;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  padding: 6px 13px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.seg-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* Views & Cards */
.view-section { display: none; }
.view-section.active { display: block; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-title { margin: 0; font-size: 15.5px; font-weight: 650; letter-spacing: -0.015em; }
.card-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-secondary); }

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.two-col-tight { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-stack { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.full-width { width: 100%; }

.micro-label { font-size: 11.5px; font-weight: 600; color: var(--ink-secondary); }
.micro-note { font-size: 12px; color: var(--ink-muted); }

/* Inputs & Buttons */
.select-clean, .input-clean, .textarea-clean {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 8px 11px;
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.select-clean:focus, .input-clean:focus, .textarea-clean:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(50, 80, 200, 0.12);
}

.textarea-clean { resize: vertical; line-height: 1.55; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 9px;
  padding: 9px 15px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-xs { padding: 5px 9px; font-size: 11.5px; border-radius: 7px; }
.btn-primary { background: var(--accent); color: #FFF; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-soft { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn-soft:hover:not(:disabled) { background: var(--surface-hover); }
.btn-ghost { background: transparent; color: var(--ink-secondary); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--ink); }
.btn-green { background: var(--green); color: #FFF; }
.btn-green:hover:not(:disabled) { filter: brightness(0.95); }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: var(--red-border); }
.btn-danger:hover:not(:disabled) { background: #FEE4E2; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.check-row { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--ink-secondary); cursor: pointer; }
.drawer { display: flex; flex-direction: column; gap: 7px; padding-top: 8px; border-top: 1px dashed var(--border); }

/* Editorial Status Badges & Pills (Zero Emoji Clutter — Restrained 6px Indicator Dot + Crisp Typography) */
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid transparent;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.dot-green { background: #16A34A; }
.dot-amber { background: #D97706; }
.dot-red { background: #DC2626; }
.dot-indigo { background: var(--accent); }
.dot-neutral { background: #94938B; }

.pill-indigo { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.pill-green { background: var(--green-soft); color: var(--green); border-color: var(--green-border); }
.pill-amber { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-border); }
.pill-red { background: var(--red-soft); color: var(--red); border-color: var(--red-border); }
.pill-neutral { background: #F3F3EE; color: var(--ink-secondary); border-color: var(--border); }

.chip-bar { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--ink-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
}

.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #FFF; font-weight: 600; }

/* Summary KPI Strip */
.summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.kpi-label { font-size: 11.5px; color: var(--ink-muted); font-weight: 500; }
.kpi-val { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.kpi-hint { font-size: 11.5px; color: var(--ink-secondary); margin-top: 2px; }

/* Toolbar & Banners */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.banner {
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.banner-ok { background: var(--green-soft); border-color: var(--green-border); color: var(--green); }
.banner-info { background: var(--accent-soft); border-color: var(--accent-border); color: #243A96; }
.banner-warn { background: var(--amber-soft); border-color: var(--amber-border); color: var(--amber); }
.banner-err { background: var(--red-soft); border-color: var(--red-border); color: var(--red); }

/* Wave Cards */
.wave-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

.wave-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 0.14s ease, border-color 0.14s ease;
}

.wave-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.wave-card.is-filtered { opacity: 0.78; background: var(--surface-soft); }

.wave-title {
  font-size: 15.5px;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.wave-proof { font-size: 12.5px; color: var(--ink-secondary); }

.wave-pro-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px;
  background: var(--surface-soft);
  border-radius: 9px;
  border: 1px solid var(--border);
}

.wm-label { font-size: 10.5px; color: var(--ink-muted); }
.wm-val { font-size: 13px; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }

.wave-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Studio Split Editor + 4:5 PNG Slide Gallery */
.compact-gen { margin-bottom: 16px; }
.gen-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.gen-row .field { flex: 1; min-width: 145px; }
.gen-row .flex-2 { flex: 2; min-width: 240px; }

.status-pills-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

.studio-split {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  align-items: start;
}

.draft-list { display: flex; flex-direction: column; gap: 8px; max-height: 760px; overflow-y: auto; padding-right: 2px; }

.draft-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.draft-item:hover { border-color: var(--border-strong); background: var(--surface-soft); }
.draft-item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(50, 80, 200, 0.12);
}

.draft-item-title { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.draft-item-meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-muted); }

.editor-card { padding: 22px; }
.empty-editor { padding: 52px 20px; text-align: center; color: var(--ink-muted); font-size: 14px; }

.editor-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.editor-learned-box {
  margin-top: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--green-soft);
  border: 1px solid var(--green-border);
  color: var(--green);
  font-size: 12.5px;
}

.render-panel {
  margin-top: 16px;
  padding: 14px;
  border-radius: 11px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.slides-gallery {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.slide-thumb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.slide-thumb-card img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
  background: #EEECE6;
}

.slide-thumb-foot {
  padding: 6px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--ink-muted);
}

/* Author Voice Page */
.voice-hero { margin-bottom: 16px; }
.voice-ring-box { text-align: right; min-width: 90px; }
.voice-score-big { font-size: 30px; font-weight: 800; color: var(--accent); letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.chip-setting { margin-top: 13px; display: flex; flex-direction: column; gap: 6px; }

.memory-view { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.memory-group-title { font-size: 11.5px; font-weight: 600; color: var(--ink-muted); margin-bottom: 5px; }

.tag-removable {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 3px 8px;
  font-size: 12px;
}

.tag-x { background: none; border: none; color: var(--ink-muted); cursor: pointer; font-size: 12px; padding: 0; }
.tag-x:hover { color: var(--red); }

.golden-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mini-add-row { display: flex; align-items: center; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.arrow-sep { color: var(--ink-muted); font-weight: 700; }
.sync-box { background: var(--accent-soft); border: 1px solid var(--accent-border); padding: 10px 12px; border-radius: 9px; color: var(--ink); }

/* Tables, Bridge & Modals */
.table-scroll { overflow-x: auto; }
.clean-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 12.5px; }
.clean-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.clean-table td { padding: 9px 6px; border-bottom: 1px solid var(--border); }
.clean-table tr:last-child td { border-bottom: none; }

.slop-result {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 12.5px;
}

.bridge-box {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 10px;
}

.bridge-tile {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 12.5px;
}

.bridge-tile code { font-family: var(--font-mono); font-size: 11px; color: var(--accent); background: var(--accent-soft); padding: 2px 5px; border-radius: 5px; word-break: break-all; }

.event-list { display: flex; flex-direction: column; gap: 8px; }
.event-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 12.5px;
}

/* Editorial Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(15, 18, 28, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: var(--shadow-lg);
}

/* Toasts (top-right so they NEVER cover bottom action buttons!) */
.toast-container {
  position: fixed;
  right: 20px;
  top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
  max-width: min(390px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: #FFF;
  padding: 11px 15px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: fadeUp 0.18s ease;
  pointer-events: auto;
}

.toast.toast-ok { background: #14532D; }
.toast.toast-err { background: #991B1B; }

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

.mobile-only { display: none; }

/* Mobile & Tablet Responsive (< 920px) */
@media (max-width: 920px) {
  .mobile-bar { display: flex; }
  .mobile-only { display: inline-flex; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 88vw);
    height: 100vh;
    z-index: 90;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-area { padding: 16px 14px 44px; }
  .topbar { flex-direction: column; gap: 12px; margin-bottom: 16px; }
  .page-title { font-size: 20px; }
  .two-col, .two-col-tight, .studio-split, .golden-card { grid-template-columns: 1fr; }
  .wave-grid { grid-template-columns: 1fr; }
  .wave-actions { flex-wrap: wrap; }
  .gen-row .flex-2, .gen-row .field { min-width: 100%; }
  .draft-list { max-height: 260px; }
}


/* Package 2: Admin-Only Role Gate, Radar v4 Forecast/Proof, and Marketer Ogilvy Planner */
body:not(.is-admin) .admin-only {
  display: none !important;
}

.wave-forecast-pill {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  padding: 5px 9px;
  line-height: 1.35;
}

.sparkline-svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.wave-evidence-details {
  font-size: 12px;
  color: var(--ink-muted);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 10px;
}

.wave-evidence-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
}

.wave-evidence-list {
  margin: 7px 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.wave-evidence-list a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.wave-evidence-list a:hover {
  text-decoration: underline;
}

.marketer-plan-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.screen-state { margin-bottom: 12px; padding: 12px 0; overflow-wrap: anywhere; }
#nicheOnboarding { max-width: 620px; margin-bottom: 16px; }
#paymentNotice button { margin: 8px; }
.pending-conflict-box {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
}
.pending-conflict-box p { margin: 0 0 8px; font-size: 13px; }
@media (max-width: 390px) {
  #nicheOnboarding, .screen-content, .wave-card { min-width: 0; overflow-wrap: anywhere; }
  #nicheOnboarding input, #nicheOnboarding button { width: 100%; min-height: 44px; }
  .screen-content .two-col, .screen-content .two-col-tight, .screen-content .wave-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .wave-evidence-list { padding-inline-start: 20px; }
  .toolbar { flex-wrap: wrap; }
}
