:root {
  --brand-blue: #4A8FE3;
  --brand-teal: #2EC6A5;
  --app-bg: #f6f9fc;
  --app-card: #ffffff;
  --app-line: #dce6f1;
  --app-text: #14233a;
  --app-text2: #506078;
  --app-text3: #7b8798;
  --danger: #d45454;
  --warning: #d58b27;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(29, 62, 105, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Onest, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--app-text);
  background: var(--app-bg);
}

.login-page {
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-shell {
  width: min(420px, 100%);
}

.login-card {
  display: grid;
  gap: 1rem;
  padding: clamp(1rem, 4vw, 1.5rem);
  border: 1px solid var(--app-line);
  border-radius: var(--radius);
  background: var(--app-card);
  box-shadow: var(--shadow);
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.6; }

button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand-blue) 38%, transparent);
  outline-offset: 2px;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.75rem, 3vw, 2.4rem); font-weight: 800; line-height: 1; }
h2 { font-size: 1.25rem; font-weight: 800; }
h3 { font-size: 1rem; font-weight: 800; }

strong { font-weight: inherit; }

.eyebrow {
  color: var(--brand-teal);
  font-size: 0.78rem;
  font-weight: 400;
  text-transform: uppercase;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--app-line);
  background: rgba(246, 249, 252, 0.94);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.app-shell {
  width: min(1180px, 100%);
  margin-inline: auto;
  padding: clamp(1rem, 2vw, 1.5rem);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.tab, .primary-button, .quiet-button {
  min-height: 42px;
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--app-line);
  font-weight: 400;
}

.tab {
  background: var(--app-card);
  color: var(--app-text2);
}

.tab.active, .primary-button {
  border-color: transparent;
  background: var(--brand-blue);
  color: white;
}

.quiet-button {
  background: var(--app-card);
  color: var(--app-text2);
}

.status-pill, .badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 32px;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--app-line);
  background: var(--app-card);
  color: var(--app-text2);
  font-weight: 400;
  font-size: 0.85rem;
}

.badge.published { color: #168a73; background: #e7f5eb; border-color: #c9ecdc; }
.badge.failed { color: var(--danger); background: #fff0ed; border-color: #f0c2bd; }
.badge.partial { color: #a05a00; background: #fff3e0; border-color: #f0d0a0; }
.badge.manual_required, .badge.pending_approval { color: var(--warning); background: #fff7e8; border-color: #f3d39a; }

.panel { display: none; }
.panel.active { display: block; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head.inline { margin-bottom: 1rem; }

.compact-card, .compose-card, .preview-card, .mini-card, .list-card {
  border: 1px solid var(--app-line);
  border-radius: var(--radius);
  background: var(--app-card);
  box-shadow: var(--shadow);
}

.compact-card, .compose-card, .preview-card {
  padding: clamp(0.9rem, 2vw, 1.2rem);
}

.compact-card {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.compose-card {
  display: grid;
  gap: 0.85rem;
}

.compose-step {
  display: grid;
  gap: 0.85rem;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  padding: 0.8rem;
  background: #fbfdff;
}

.compose-step > summary {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.compose-step > summary::-webkit-details-marker {
  display: none;
}

.compose-step > summary span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--brand-blue);
  color: white;
  font-size: 0.9rem;
}

.compose-step[open] > summary {
  margin-bottom: 0.15rem;
}

#create {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 1rem;
}

#create.active {
  display: grid;
}

.preview-card {
  align-self: start;
  position: sticky;
  top: 6.5rem;
  display: grid;
  gap: 0.75rem;
  max-height: calc(100dvh - 8rem);
  overflow: auto;
}

label {
  display: grid;
  gap: 0.45rem;
  font-weight: 400;
}

input, textarea, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  padding: 0.68rem 0.78rem;
  color: var(--app-text);
  background: white;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input[type="checkbox"] {
  width: 1rem;
  min-height: auto;
  accent-color: var(--brand-blue);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-row, .actions, .hint-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.actions {
  align-items: center;
}

.choice-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  background: #fbfdff;
}

.switch-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.65rem;
  padding: 0.75rem;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  background: #fbfdff;
}

.switch-row small, .hint, .message, .mini-card small {
  color: var(--app-text3);
  font-weight: 400;
}

.message.danger {
  color: var(--danger);
}

.plain-fieldset {
  border: 1px solid var(--app-line);
  border-radius: 10px;
  padding: 0.75rem;
  margin: 0;
}

.plain-fieldset legend {
  padding-inline: 0.35rem;
  font-weight: 400;
}

.advanced {
  border: 1px solid var(--app-line);
  border-radius: 10px;
  padding: 0.75rem;
  background: #fbfdff;
}

.advanced summary {
  cursor: pointer;
  font-weight: 400;
}

.advanced[open] {
  display: grid;
  gap: 0.75rem;
}

.upload-box {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem;
  border: 1px dashed color-mix(in srgb, var(--brand-blue) 45%, var(--app-line));
  border-radius: 10px;
  background: #f5faff;
}

.upload-box.dragging { background: #effcf8; border-color: var(--brand-teal); }

.upload-preview {
  display: grid;
  gap: 0.65rem;
}

.upload-preview[hidden] { display: none; }

.upload-preview img {
  width: min(100%, 360px);
  max-height: 260px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--app-line);
}

.idea-panel, .schedule-advisor {
  display: grid;
  gap: 0.65rem;
  padding: 0.75rem;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  background: #fbfdff;
}

.schedule-advisor {
  background: #f7fbf8;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.slot-card {
  display: grid;
  gap: 0.3rem;
  min-height: 120px;
  padding: 0.7rem;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  background: white;
  color: inherit;
  text-align: left;
}

.slot-card:hover {
  border-color: var(--brand-teal);
  background: #f0fbf7;
}

.slot-card span {
  color: var(--brand-blue);
  font-weight: 700;
}

.slot-card small {
  color: var(--app-text3);
  line-height: 1.35;
}

.media-library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 0.5rem;
}

.media-thumb {
  min-height: 64px;
  padding: 0;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  overflow: hidden;
  background: white;
}

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

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.mini-card, .list-card {
  padding: 0.85rem;
}

.mini-card {
  display: grid;
  gap: 0.55rem;
}

.mini-card p {
  color: var(--app-text);
  font-size: 0.95rem;
  font-weight: 400;
}

.saved-config {
  display: grid;
  gap: 0.4rem;
  margin: 0.15rem 0 0.25rem;
}

.saved-config div {
  display: grid;
  grid-template-columns: minmax(82px, 0.7fr) minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  padding: 0.48rem 0.55rem;
  border: 1px solid #e6edf5;
  border-radius: 8px;
  background: #f8fbfd;
}

.saved-config dt {
  color: var(--app-text3);
  font-size: 0.76rem;
}

.saved-config dd {
  min-width: 0;
  color: var(--app-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.saved-config .missing {
  background: #fffaf1;
  border-color: #f3d39a;
}

.saved-config .missing dd {
  color: var(--warning);
  font-family: inherit;
}

.audit-box {
  margin: 0.45rem 0 0.7rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #e6edf5;
  border-radius: 8px;
  background: #fbfdff;
}

.audit-box summary {
  cursor: pointer;
  color: var(--app-text);
  font-weight: 700;
}

.audit-box p {
  margin-top: 0.35rem;
  color: var(--app-text2);
  font-size: 0.88rem;
}

.ok-text { color: #168a73 !important; }
.danger-text { color: var(--danger) !important; }

.wizard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
}

.wizard-card {
  display: grid;
  gap: 0.55rem;
  padding: 0.8rem;
  border: 1px solid #e6edf5;
  border-radius: 8px;
  background: #fbfdff;
}

.wizard-card header,
.backup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.wizard-card ol {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding-left: 1.1rem;
  color: var(--app-text2);
  font-size: 0.9rem;
}

.backup-list {
  display: grid;
  gap: 0.55rem;
}

.backup-row {
  padding: 0.65rem 0.75rem;
  border: 1px solid #e6edf5;
  border-radius: 8px;
  background: #fbfdff;
}

.backup-row span,
.backup-row small {
  color: var(--app-text3);
}

.ideas-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.9rem;
}

.ideas-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.9rem 0;
}

.ideas-tabs .active {
  color: white;
  background: var(--brand-blue);
}

.ideas-tabs span {
  display: inline-grid;
  min-width: 1.5rem;
  margin-left: 0.25rem;
  padding: 0.05rem 0.35rem;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 12%, transparent);
}

.idea-card {
  display: grid;
  gap: 0.75rem;
  padding: 0.95rem;
  border: 1px solid var(--app-line);
  border-radius: var(--radius);
  background: var(--app-card);
  box-shadow: var(--shadow);
}

.idea-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.idea-card p {
  color: var(--app-text2);
  line-height: 1.45;
}

.quality-meter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border: 1px solid #d9edf5;
  border-radius: 7px;
  background: #f4fbff;
}

.quality-meter strong {
  color: var(--brand-blue);
  font-size: 0.95rem;
}

.quality-meter span {
  color: var(--app-text2);
  line-height: 1.35;
  font-size: 0.88rem;
}

.quality-meter.wide {
  grid-template-columns: 90px minmax(0, 1fr);
}

.content-quality {
  display: grid;
  gap: 0.55rem;
}

.content-quality.compact .quality-checklist {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quality-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.quality-checklist li {
  min-height: 28px;
  padding: 0.3rem 0.45rem;
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.25;
  border: 1px solid #dfe8ef;
  background: #f8fafc;
  color: var(--app-text2);
}

.quality-checklist li.ok {
  border-color: #ccebd8;
  background: #f3fbf6;
  color: #176a3a;
}

.quality-checklist li.warn {
  border-color: #f3d1d1;
  background: #fff6f6;
  color: #9b2d2d;
}

.quality-review {
  display: grid;
  gap: 0.4rem;
  margin: 0.55rem 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid #d9edf5;
  border-radius: 7px;
  background: #f7fcff;
}

.quality-review strong {
  color: var(--brand-blue);
}

.quality-review p,
.quality-review small {
  margin: 0;
}

.quality-review small {
  color: var(--app-text3);
}

.performance-form {
  margin-block-start: 0.75rem;
  padding-block-start: 0.7rem;
  border-block-start: 1px solid #dce6ef;
}

.performance-form fieldset {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.performance-form legend {
  margin-block-end: 0.45rem;
  color: var(--app-text);
  font-weight: 700;
}

.performance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.55rem;
}

.performance-form label {
  display: grid;
  gap: 0.3rem;
  color: var(--app-text2);
  font-size: 0.82rem;
}

.performance-form input,
.performance-form textarea {
  min-height: 44px;
  font-size: 1rem;
}

.performance-form input:user-invalid,
.performance-form textarea:user-invalid {
  border-color: var(--danger);
  outline: 2px solid color-mix(in srgb, var(--danger) 18%, transparent);
}

.performance-message {
  align-self: center;
  color: var(--app-text3);
  font-size: 0.85rem;
}

.idea-meta {
  display: grid;
  gap: 0.45rem;
  margin: 0;
}

.idea-meta div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 0.55rem;
}

.idea-meta dt {
  color: var(--app-text3);
  font-size: 0.78rem;
}

.idea-meta dd {
  margin: 0;
  color: var(--app-text);
  font-size: 0.88rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.8rem;
}

.analytics-summary {
  margin-bottom: 1rem;
}

.analytics-kpis {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  margin: 1rem 0;
}

.kpi-card {
  border: 1px solid var(--app-line);
  border-radius: var(--radius);
  padding: 0.85rem;
  background: var(--app-card);
}

.kpi-card span {
  display: block;
  color: var(--app-text2);
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.kpi-card strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1.1;
}

.analytics-hero,
.analytics-panel,
.signal-item {
  border: 1px solid var(--app-line);
  border-radius: var(--radius);
  background: var(--app-card);
}

.analytics-hero {
  display: grid;
  grid-template-columns: minmax(220px, 0.35fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  padding: 1rem;
}

.analytics-hero p {
  color: var(--app-text2);
  line-height: 1.45;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.analytics-panel {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  padding: 0.95rem;
}

.analytics-panel h3 {
  margin: 0;
  font-size: 1rem;
}

.signal-list {
  display: grid;
  gap: 0.55rem;
}

.signal-item {
  display: grid;
  gap: 0.25rem;
  padding: 0.7rem;
  background: #f8fbfd;
}

.signal-item.ok {
  border-color: #b9e3d6;
  background: #f3fbf7;
}

.signal-item.muted {
  background: #fbf9f6;
}

.signal-item span,
.signal-item p {
  color: var(--app-text3);
  line-height: 1.35;
}

.calendar-day {
  min-height: 180px;
  display: grid;
  align-content: start;
  gap: 0.55rem;
  padding: 0.85rem;
  border: 1px solid var(--app-line);
  border-radius: var(--radius);
  background: var(--app-card);
}

.calendar-day header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid #edf3f9;
}

.calendar-day header span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #eef7ff;
  color: #246db9;
  font-size: 0.78rem;
}

.calendar-item {
  display: grid;
  gap: 0.25rem;
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: 0;
  border-left: 3px solid var(--brand-blue);
  border-radius: 7px;
  background: #f8fbfd;
  text-align: left;
  color: inherit;
}

.calendar-item.idea {
  border-left-color: var(--brand-teal);
}

.calendar-item.idea-summary {
  border-left-color: var(--brand-teal);
  background: #f2fbf8;
}

.calendar-item.rule {
  border-left-color: #8c6bd8;
  background: #faf8ff;
}

.calendar-item.idea:hover,
.calendar-item.idea-summary:hover {
  background: #eefbf8;
}

.calendar-item.rule:hover {
  background: #f3efff;
}

.calendar-item small {
  color: var(--app-text3);
}

.calendar-item p {
  color: var(--app-text);
  line-height: 1.35;
}

.calendar-overflow {
  margin: 0;
  color: var(--app-text3);
  font-size: 0.82rem;
  font-weight: 700;
}

.calendar-preview {
  margin-top: 1rem;
}

.idea-preview-card {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--app-line);
  border-radius: var(--radius);
  background: var(--app-card);
}

.idea-preview-card header,
.preview-grid {
  display: grid;
  gap: 1rem;
}

.idea-preview-card header {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.preview-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
}

.preview-grid section {
  display: grid;
  align-content: start;
  gap: 0.55rem;
}

.preview-grid h4 {
  margin: 0;
  font-size: 0.92rem;
}

.preview-grid pre {
  min-height: 180px;
  margin: 0;
  padding: 0.85rem;
  border: 1px solid #edf3f9;
  border-radius: 7px;
  background: #f8fbfd;
  color: var(--app-text);
  font: inherit;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.idea-meta.compact {
  gap: 0.45rem;
}

.mini-card.needs-action {
  border-color: #f0c2bd;
  background: #fff8f7;
}

.rule-card {
  width: 100%;
  text-align: left;
  color: inherit;
}

.rule-card.active {
  border-color: var(--brand-blue);
  background: #eef7ff;
}

.list-card {
  grid-column: 1 / -1;
}

.list-card summary {
  cursor: pointer;
  font-weight: 400;
}

.list-card[open] {
  display: grid;
  gap: 0.55rem;
}

.dev-updates {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.dev-update {
  display: grid;
  gap: 0.65rem;
  padding: 0.9rem;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  background: white;
}

.dev-update.high {
  border-color: #b8e5d6;
  background: #f7fbf8;
}

.dev-update.medium {
  border-color: #c8dcf4;
  background: #f7fbff;
}

.dev-update header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
}

.dev-update p {
  margin-top: 0.25rem;
  color: var(--app-text2);
}

.dev-update small {
  color: var(--app-text3);
}

.quiet-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--brand-blue);
  font-weight: 400;
  text-decoration: none;
}

.row-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  padding-block: 0.35rem;
  border-top: 1px solid #eef3f8;
}

.link-button {
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand-blue);
  text-align: left;
  font-weight: 400;
}

.post-preview {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  background: white;
}

.post-preview header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--app-text3);
  font-size: 0.85rem;
}

.post-preview p {
  color: var(--app-text2);
}

.post-preview img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--app-line);
}

.hint-row span {
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: #eef7ff;
  color: #246db9;
  font-size: 0.85rem;
  font-weight: 400;
}

.channel-warnings {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.7rem;
}

.channel-warnings span {
  padding: 0.55rem 0.7rem;
  border: 1px solid #f3d39a;
  border-radius: 8px;
  background: #fffaf1;
  color: #6d4b00;
  font-size: 0.9rem;
  line-height: 1.35;
}

.notification-drawer {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: min(360px, calc(100vw - 2rem));
  max-height: 70dvh;
  overflow: auto;
  padding: 0.75rem;
  border: 1px solid var(--app-line);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
}

.drawer-item {
  display: grid;
  gap: 0.45rem;
  padding: 0.7rem;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  margin-bottom: 0.5rem;
}

.drawer-item.error { border-color: #f0c2bd; background: #fff8f7; }
.drawer-item.warning { border-color: #f3d39a; background: #fffaf1; }

form.compact-card > details {
  display: grid;
  gap: 0.85rem;
  padding: 0.85rem;
  border: 1px solid #edf3f9;
  border-radius: 10px;
  background: #fbfdff;
}

form.compact-card > details > summary {
  cursor: pointer;
  color: var(--app-text);
  font-weight: 800;
}

form.compact-card > details[open] > summary {
  margin-bottom: 0.15rem;
}

details > label {
  margin-top: 0;
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  #create.active {
    display: block;
  }

  .preview-card {
    position: static;
    margin-top: 1rem;
    max-height: none;
  }

  .form-grid, .form-grid.two, .overview-grid {
    grid-template-columns: 1fr;
  }

  .slot-grid {
    grid-template-columns: 1fr;
  }

  .analytics-hero,
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .quality-meter,
  .quality-meter.wide {
    grid-template-columns: 1fr;
  }

  .idea-preview-card header,
  .preview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .app-shell { padding: 0.75rem; }
  .tabs { position: sticky; top: 5.75rem; z-index: 4; background: var(--app-bg); padding-block: 0.25rem; }
  .section-head { align-items: stretch; flex-direction: column; }
  .actions { flex-direction: column; }
  .actions button { width: 100%; }
}
.table-scroll { overflow-x: auto; margin-top: 1rem; }
.funnel-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.funnel-table th, .funnel-table td { padding: .65rem; border-bottom: 1px solid var(--border, #dfe3e8); text-align: left; white-space: nowrap; }
.funnel-table th { color: var(--muted, #59636e); font-weight: 700; }

.section-tabs {
  display: flex;
  gap: .4rem;
  overflow-x: auto;
  padding: .35rem 0 1rem;
  scrollbar-width: thin;
}
.section-tabs a {
  flex: 0 0 auto;
  border: 1px solid var(--app-line);
  border-radius: 999px;
  color: var(--app-text);
  padding: .55rem .8rem;
  text-decoration: none;
}
.section-tabs a:hover, .section-tabs a:focus-visible { border-color: var(--app-accent); outline: 3px solid color-mix(in srgb, var(--app-accent) 22%, transparent); outline-offset: 2px; }
.analytics-section { scroll-margin-top: 7rem; margin-block: 1rem; }
.health-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .65rem; margin-bottom: .65rem; }
.health-item { display: grid; gap: .2rem; border: 1px solid var(--app-line); border-inline-start-width: 4px; border-radius: var(--radius); background: var(--app-card); padding: .75rem; }
.health-item span { color: var(--app-text2); font-size: .82rem; }
.health-item.ok { border-inline-start-color: #23815f; }
.health-item.warning { border-inline-start-color: #b8790b; }
.health-item.critical { border-inline-start-color: #b43737; }
.health-item.neutral { border-inline-start-color: #718096; }
.quality-table th[scope="row"] { white-space: normal; min-width: 18rem; }
.quality-table th[scope="row"] small { display: block; color: var(--app-text2); font-weight: 400; margin-top: .25rem; }
.content-quality-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .75rem; margin-block: 1rem; }
.content-quality-columns, .content-outcome-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.content-quality-columns h4, .content-quality-outcomes h4, .content-outcome-columns h5 { margin-bottom: .65rem; }
.content-quality-list, .content-outcome-list { display: grid; gap: .65rem; }
.content-quality-issue, .content-quality-publication, .content-outcome-list article { border: 1px solid var(--app-line); border-radius: var(--radius); background: var(--app-card); padding: .8rem; overflow-wrap: anywhere; }
.content-quality-issue header, .content-quality-publication header { display: flex; justify-content: space-between; align-items: start; gap: .65rem; }
.content-quality-issue p { margin: .6rem 0 .35rem; }
.content-quality-issue small, .content-outcome-list span, .content-outcome-list small { color: var(--app-text2); }
.content-quality-publication ul { margin: .65rem 0 0; padding-inline-start: 1.15rem; }
.content-quality-outcomes { margin-top: 1rem; }
.content-outcome-columns { margin-top: .85rem; }
.content-outcome-list article { display: grid; gap: .25rem; }
.status-pill.ok { background: #e6f5ef; color: #176348; }
.status-pill.warning { background: #fff4d8; color: #785000; }
.status-pill.critical { background: #fde8e8; color: #8e2626; }
.suppressed-value { font-size: .95rem; white-space: nowrap; }
.experiment-list, .recommendation-list { display: grid; gap: .75rem; margin-top: 1rem; }
.experiment-card, .recommendation-card { border: 1px solid var(--app-line); border-radius: var(--radius); background: var(--app-card); padding: .9rem; }
.experiment-card > header, .recommendation-card > header { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.experiment-card header p { margin: .3rem 0 0; color: var(--app-text2); }
.experiment-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-block: .85rem; }
.experiment-meta div { min-width: 0; }
.experiment-meta dt { color: var(--app-text2); font-size: .8rem; }
.experiment-meta dd { margin: .2rem 0 0; }
.inline-alert { border-inline-start: 4px solid #b8790b; background: #fff9e8; padding: .7rem .8rem; }
.inline-alert ul { margin-bottom: 0; }
.experiment-card.needs-data .experiment-decision, .recommendation-card.insufficient { color: var(--app-text2); }
.overdue-workspace { border-color: #e7c47a; }
.bulk-bar { position: sticky; top: 6.5rem; z-index: 3; display: flex; flex-wrap: wrap; align-items: end; gap: .65rem; border: 1px solid #d7b25d; border-radius: var(--radius); background: #fffaf0; padding: .75rem; margin-top: .75rem; }
.bulk-bar[hidden] { display: none; }
.bulk-bar label { min-width: 14rem; }
.overdue-table tr.quarantined { background: #fff5f5; }
.overdue-table input[type="checkbox"] { width: 1.1rem; height: 1.1rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (max-width: 720px) {
  .health-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .experiment-meta { grid-template-columns: 1fr; }
  .experiment-card > header, .recommendation-card > header { align-items: stretch; flex-direction: column; }
  .content-quality-columns, .content-outcome-columns { grid-template-columns: 1fr; }
  .content-quality-issue header, .content-quality-publication header { align-items: stretch; flex-direction: column; }
  .bulk-bar { position: static; align-items: stretch; flex-direction: column; }
  .bulk-bar > * { width: 100%; }
  .table-scroll { max-width: calc(100vw - 2.5rem); }
  .funnel-table th:first-child, .funnel-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--app-card); }
}
