/* ==========================================================================
   1. Reset
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

img,
picture {
  display: block;
  max-width: 100%;
}

/* ==========================================================================
   2. Variables
   ========================================================================== */

:root {
  --color-bg: #fbfaf7;
  --color-surface: #ffffff;
  --color-fg: #1a1a1a;
  --color-fg-muted: #6b6b6b;
  --color-border: #e4e0d8;
  --color-border-strong: #bfb9ad;
  --color-accent: #8b2a2a;
  --color-accent-hover: #6f2020;
  --color-success: #2f6f3e;
  --color-warning: #a96a14;
  --color-error: #b3261e;
  --color-dead: #4a0e0e;
  --color-focus-ring: #2563eb;

  --font-serif: "Iowan Old Style", "Charter", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.375rem;
  --fs-xl: 1.75rem;
  --fs-2xl: 2.5rem;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;

  --radius-sm: 3px;
  --radius-md: 6px;

  --container-max: 1100px;
  --measure: 68ch;
}

/* ==========================================================================
   3. Base typography
   ========================================================================== */

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1 {
  font-size: var(--fs-xl);
  line-height: 1.2;
  font-weight: 700;
}

h2 {
  font-size: var(--fs-lg);
  line-height: 1.25;
  font-weight: 600;
}

h3 {
  font-size: var(--fs-md);
  line-height: 1.3;
  font-weight: 600;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

p {
  line-height: 1.55;
}

.prose {
  font-family: var(--font-serif);
  max-width: var(--measure);
  line-height: 1.55;
}

.mono {
  font-family: var(--font-mono);
}

.small {
  font-size: var(--fs-xs);
}

.muted {
  color: var(--color-fg-muted);
}

.small-caps {
  font-size: var(--fs-xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-border);
  color: var(--color-fg);
  padding: 0.1em 0.3em;
  border-radius: var(--radius-sm);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  background: var(--color-border);
  color: var(--color-fg);
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  line-height: 1.45;
}

/* ==========================================================================
   4. Layout
   ========================================================================== */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--sp-4);
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-3);
  z-index: 100;
  padding: var(--sp-2) var(--sp-3);
  background: var(--color-accent);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: top 0.15s;
}

.skip-link:focus {
  top: var(--sp-3);
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

main.site-main {
  padding: var(--sp-5) 0 var(--sp-8);
  min-height: 60vh;
}

footer.site-footer {
  border-top: 1px solid var(--color-border);
  padding: var(--sp-4) 0;
}

.site-footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-2);
}

/* ==========================================================================
   5. Header + Nav
   ========================================================================== */

.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.site-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-3) var(--sp-4);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.site-brand:hover {
  text-decoration: none;
}

.brand-name {
  color: var(--color-accent);
  font-weight: 700;
  font-size: var(--fs-md);
}

.env-pill {
  font-size: var(--fs-xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-fg-muted);
  background: var(--color-bg);
}

.env-pill-dev {
  color: var(--color-warning);
  border-color: var(--color-warning);
}

.env-pill-prod {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.site-nav {
  border-top: 1px solid var(--color-border);
}

.site-nav-inner {
  display: flex;
  gap: var(--sp-1);
  padding: 0 var(--sp-4);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-3);
  color: var(--color-fg-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.nav-link:hover {
  color: var(--color-fg);
  text-decoration: none;
}

.nav-link.is-active {
  color: var(--color-accent);
  font-weight: 600;
  border-bottom-color: var(--color-accent);
}

/* --- Profile avatar + dropdown (Plan 25) --- */

.profile-menu {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
}

.profile-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--color-accent);
  color: #ffffff;
  font-family: var(--font-serif);
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 120ms ease;
}

.profile-avatar:hover {
  background: var(--color-accent-hover);
}

.profile-avatar:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

.profile-avatar--admin {
  background: var(--color-dead);
}

.profile-avatar--admin:hover {
  background: #380a0a;
}

.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + var(--sp-2));
  min-width: 220px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  overflow: hidden;
}

.profile-dropdown[hidden] {
  display: none;
}

.profile-dropdown.is-open {
  animation: profile-dropdown-in 120ms ease;
}

@keyframes profile-dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.profile-dropdown-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-bottom: 1px solid var(--color-border);
}

.profile-dropdown-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #ffffff;
  font-family: var(--font-serif);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1;
}

.profile-dropdown-email {
  word-break: break-all;
  color: var(--color-fg);
}

.profile-dropdown-form {
  margin: 0;
}

.profile-dropdown-logout {
  display: block;
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: none;
  background: transparent;
  color: var(--color-accent);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease;
}

.profile-dropdown-logout:hover {
  background: var(--color-bg);
}

.profile-dropdown-logout:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
  .profile-avatar,
  .profile-dropdown-logout {
    transition: none;
  }

  .profile-dropdown.is-open {
    animation: none;
  }
}

/* ==========================================================================
   6. Flash banner
   ========================================================================== */

.flash-slot {
  padding: var(--sp-3) 0;
}

.flash {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  border-left: 3px solid transparent;
  animation: flash-in 0.2s ease-out;
}

@keyframes flash-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.flash-success {
  background: #e8f5e9;
  border-left-color: var(--color-success);
  color: var(--color-success);
}

.flash-error {
  background: #fdecea;
  border-left-color: var(--color-error);
  color: var(--color-error);
}

.flash-info {
  background: #e3e8ef;
  border-left-color: var(--color-fg-muted);
  color: var(--color-fg);
}

.flash-dismissed {
  opacity: 0;
  transition: opacity 0.3s ease-out;
  pointer-events: none;
}

.flash-text {
  flex: 1;
}

.flash-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: inherit;
  font-size: var(--fs-md);
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
  padding: 0 var(--sp-1);
}

.flash-close:hover {
  opacity: 1;
}

/* ==========================================================================
   7. Tables
   ========================================================================== */

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.data-table th {
  text-align: left;
  font-weight: 600;
  font-size: var(--fs-xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-fg-muted);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}

.data-table td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--color-border);
}

.data-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table .actions-col {
  text-align: right;
  width: 1%;
}

.action-group {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-1);
  flex-wrap: nowrap;
}

.action-group + .action-group {
  margin-top: var(--sp-1);
}

.data-table .row-title {
  font-weight: 500;
  color: inherit;
}

.data-table-compact td,
.data-table-compact th {
  padding: var(--sp-1) var(--sp-3);
}

/* ==========================================================================
   8. Forms
   ========================================================================== */

.form-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: var(--sp-1);
  color: var(--color-fg);
}

.form-label-inline {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: 0;
  font-weight: 500;
  cursor: pointer;
}

/* Timezone qualifier on a field label, e.g. "Cron expression (UTC)" */
.form-label-tz {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--color-fg-muted);
}

.form-label-inline input[type="checkbox"] {
  width: auto;
  accent-color: var(--color-accent);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--sp-2) var(--sp-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-fg);
  font-size: var(--fs-base);
  line-height: 1.4;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-focus-ring);
}

.form-textarea {
  resize: vertical;
}

.form-input-grow {
  flex: 1;
  min-width: 0;
}

.form-row {
  margin-bottom: var(--sp-3);
}

.form-row-flex {
  display: flex;
  gap: var(--sp-2);
  align-items: flex-end;
}

.form-row-flex .form-input {
  min-width: 0;
}

.form-row-error .form-input,
.form-row-error .form-select,
.form-row-error .form-textarea {
  border-color: var(--color-error);
}

.form-help {
  display: block;
  font-size: var(--fs-xs);
  color: var(--color-fg-muted);
  margin-top: var(--sp-1);
}

.form-error {
  display: block;
  font-size: var(--fs-xs);
  color: var(--color-error);
  margin-top: var(--sp-1);
}

.form-stack {
  display: flex;
  flex-direction: column;
}

.form-inline {
  display: flex;
  flex-direction: column;
}

.inline-form {
  display: inline;
}

.form-actions {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--color-border);
}

.form-actions-no-border {
  margin-top: var(--sp-3);
  padding-top: 0;
  border-top: none;
}

/* Filter bar */

.filter-bar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: var(--sp-4);
  margin-bottom: var(--sp-5);
  border-radius: var(--radius-md);
}

.filter-row {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-field {
  flex: 1;
  min-width: 110px;
}

.filter-field-grow {
  flex: 2;
}

.filter-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  margin-bottom: var(--sp-1);
  color: var(--color-fg-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.filter-actions {
  display: flex;
  gap: var(--sp-2);
  align-items: flex-end;
}

/* ==========================================================================
   9. Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-sm);
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
  text-decoration: none;
  font-family: inherit;
  background: transparent;
  transition: filter 0.15s, background 0.15s, color 0.15s;
}

.btn:hover {
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: #fff;
}

.btn-danger {
  background: transparent;
  color: var(--color-dead);
  border-color: var(--color-dead);
}

.btn-danger:hover {
  background: var(--color-dead);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--color-fg-muted);
  border-color: var(--color-border);
}

.btn-ghost:hover {
  background: var(--color-surface);
  color: var(--color-fg);
  border-color: var(--color-border-strong);
}

.btn-sm {
  padding: var(--sp-1) var(--sp-2);
  font-size: var(--fs-xs);
}

.btn.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ==========================================================================
   10. Cards
   ========================================================================== */

.count-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.count-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: var(--sp-4);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
  min-width: 0;
}

a.count-card:hover {
  border-color: var(--color-accent);
  text-decoration: none;
  color: inherit;
}

.count-card-label {
  font-size: var(--fs-xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-fg-muted);
  margin-bottom: var(--sp-1);
}

.count-card-value {
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: 1;
  color: var(--color-fg);
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
}

.count-card-sub {
  font-size: var(--fs-xs);
  color: var(--color-fg-muted);
  margin-top: var(--sp-2);
}

.count-card-dead {
  border-color: var(--color-dead);
}

.count-card-dead .count-card-value {
  color: var(--color-dead);
}

.count-card-dead:hover {
  border-color: var(--color-dead);
}

/* Panel */

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.panel-form {
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--color-border);
}

.panel-title {
  font-size: var(--fs-md);
  font-weight: 600;
}

.panel-link {
  font-size: var(--fs-xs);
  color: var(--color-fg-muted);
}

/* ==========================================================================
   11. Status badges
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: var(--sp-1) var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.3;
}

.badge-success {
  background: rgba(47, 111, 62, 0.08);
  color: var(--color-success);
  border-color: var(--color-success);
}

.badge-running {
  background: rgba(139, 42, 42, 0.06);
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.badge-running .badge-glyph {
  color: var(--color-accent);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

.badge-warning {
  background: rgba(169, 106, 20, 0.08);
  color: var(--color-warning);
  border-color: var(--color-warning);
}

.badge-error {
  background: rgba(179, 38, 30, 0.06);
  color: var(--color-error);
  border-color: var(--color-error);
}

.badge-dead {
  background: rgba(74, 14, 14, 0.08);
  color: var(--color-dead);
  border-color: var(--color-dead);
  font-weight: 700;
}

.badge-skipped {
  background: transparent;
  color: var(--color-fg-muted);
  border-color: var(--color-fg-muted);
}

.badge-muted {
  background: transparent;
  color: var(--color-fg-muted);
  border-color: var(--color-fg-muted);
}

.badge-glyph {
  font-size: 10px;
  line-height: 1;
  flex-shrink: 0;
}

/* ==========================================================================
   12. States
   ========================================================================== */

:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.empty-state {
  text-align: center;
  padding: var(--sp-7) var(--sp-4);
  color: var(--color-fg-muted);
}

.empty-state-block {
  text-align: center;
  padding: var(--sp-7) var(--sp-4);
  color: var(--color-fg-muted);
}

.dead-letter {
  border: 2px solid var(--color-dead);
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-5);
  background: linear-gradient(135deg, transparent 0%, rgba(74, 14, 14, 0.02) 100%);
}

.dead-letter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--color-dead);
}

.dead-letter-title {
  color: var(--color-dead);
  font-size: var(--fs-sm);
}

.dead-letter-list {
  list-style: none;
}

.dead-letter-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--color-border);
}

.dead-letter-row:last-child {
  border-bottom: none;
}

.dead-letter-error {
  flex: 1;
  font-size: var(--fs-xs);
  color: var(--color-fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dead-letter-row-actions {
  display: flex;
  gap: var(--sp-1);
  flex-shrink: 0;
}

/* ==========================================================================
   13. Utilities
   ========================================================================== */

.breadcrumb {
  margin-bottom: var(--sp-5);
}

.breadcrumb .back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-4) var(--sp-1) var(--sp-3);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: var(--fs-sm);
  color: var(--color-fg-muted);
  background: var(--color-surface);
  text-decoration: none;
  transition: border-color 0.12s ease, color 0.12s ease;
}

.breadcrumb .back-link:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.breadcrumb .back-link .back-arrow {
  font-size: 1em;
  line-height: 1;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.page-title {
  margin: 0;
}

/* ==========================================================================
   14. Home page
   ========================================================================== */

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
  align-items: start;
}

.activity-list {
  list-style: none;
}

.activity-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.activity-row:last-child {
  border-bottom: none;
}

.activity-time {
  font-size: var(--fs-xs);
  min-width: 50px;
}

.activity-stage {
  font-size: var(--fs-xs);
  text-transform: capitalize;
}

.activity-detail {
  font-size: var(--fs-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.summary-list {
  list-style: none;
}

.summary-row {
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.summary-row:last-child {
  border-bottom: none;
}

.summary-title {
  font-weight: 600;
  display: block;
  margin-bottom: var(--sp-1);
}

.summary-meta {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-1);
}

.summary-tldr {
  font-size: var(--fs-sm);
  color: var(--color-fg-muted);
  line-height: 1.5;
}

/* ==========================================================================
   15. Channel detail
   ========================================================================== */

.detail-header {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.detail-header-main {
  flex: 1;
  min-width: 0;
}

.detail-header-main .page-title {
  margin-bottom: var(--sp-2);
}

.detail-meta {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-2);
  word-break: break-all;
}

.detail-header-actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  align-items: flex-end;
  justify-content: flex-start;
  flex-shrink: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
  align-items: start;
}

.video-mini-list {
  list-style: none;
}

.video-mini-row {
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--color-border);
}

.video-mini-row:last-child {
  border-bottom: none;
}

.video-mini-title {
  font-weight: 500;
  display: block;
}

.video-mini-meta {
  display: flex;
  gap: var(--sp-1);
  align-items: center;
  margin-top: var(--sp-1);
}

/* ==========================================================================
   16. Video detail
   ========================================================================== */

.video-detail {
  max-width: var(--measure);
  margin: 0 auto;
}

.video-detail-header {
  display: flex;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.video-thumb {
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  object-fit: cover;
  background: var(--color-border);
}

.video-detail-meta {
  flex: 1;
  min-width: 0;
}

.video-title {
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.video-byline {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-2);
  min-width: 0;
  overflow-wrap: anywhere;
}

.external-link {
  font-size: var(--fs-xs);
  overflow-wrap: anywhere;
}

.video-detail-actions {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  margin-top: var(--sp-3);
}

.page-brand-credit {
  max-width: var(--measure);
  margin: var(--sp-6) auto 0;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  color: var(--color-fg-muted);
  text-align: center;
}

.summary-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  margin-bottom: var(--sp-5);
}

.summary-heading {
  margin-bottom: var(--sp-3);
}

.summary-tldr-body {
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  line-height: 1.55;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-4);
}

.summary-col {
  margin-bottom: var(--sp-3);
  min-width: 0;
}

.summary-subheading {
  margin-bottom: var(--sp-2);
  font-weight: 600;
}

.summary-list-items {
  list-style: disc;
  padding-left: var(--sp-5);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.summary-list-items a {
  word-break: break-word;
  overflow-wrap: anywhere;
}

.summary-footer {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--color-border);
}

.tag-row {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}

.tag-chip {
  display: inline-block;
  padding: var(--sp-1) var(--sp-2);
  font-size: var(--fs-xs);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-fg-muted);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

.tag-chip:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  text-decoration: none;
}

.confidence {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
}

.confidence-dots {
  display: flex;
  gap: 3px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-border);
  display: inline-block;
}

.dot-on {
  background: var(--color-accent);
}

.transcript-block {
  margin-top: var(--sp-4);
}

.transcript-toggle {
  font-weight: 600;
  cursor: pointer;
  padding: var(--sp-3) 0;
  color: var(--color-accent);
  font-size: var(--fs-sm);
}

.transcript-toggle:hover {
  color: var(--color-accent-hover);
}

.transcript-body {
  padding: var(--sp-5);
  text-align: left;
  white-space: pre-wrap;
  max-width: 68ch;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-base);
  line-height: 1.7;
}

.transcript-line {
  white-space: normal;
  margin: 0 0 var(--sp-4) 0;
  line-height: inherit;
  font-size: inherit;
}

.transcript-line:last-child {
  margin-bottom: 0;
}

.transcript-timestamp {
  display: inline-block;
  min-width: 3.5em;
  margin-right: var(--sp-3);
  vertical-align: baseline;
}

/* ==========================================================================
   17. Videos page
   ========================================================================== */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--color-border);
}

.pagination-state {
  font-size: var(--fs-xs);
}

/* ==========================================================================
   18. Jobs page
   ========================================================================== */

/* Dead-letter styles are in §12 States above */

/* ==========================================================================
   19. Settings page
   ========================================================================== */

.settings-group {
  margin-bottom: var(--sp-6);
}

.settings-heading {
  font-size: var(--fs-sm);
  color: var(--color-fg-muted);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-3);
}

/* ==========================================================================
   20. Responsive
   ========================================================================== */

/* ==========================================================================
   21. Plan 22 additions
   ========================================================================== */

/* Nav two-tier layout */
.site-nav-inner {
  justify-content: space-between;
}

.nav-primary,
.nav-secondary {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.nav-link--admin {
  opacity: 0.75;
  font-size: var(--fs-xs);
}

.nav-link--admin:hover {
  opacity: 1;
}

.nav-divider {
  color: var(--color-border-strong);
  padding: 0 var(--sp-1);
  user-select: none;
  font-weight: 300;
}

/* Pipeline health pill in header */
.pipeline-pill {
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  text-transform: lowercase;
  font-weight: 500;
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-fg-muted);
  background: var(--color-bg);
  white-space: nowrap;
}

.pipeline-pill--ok {
  color: var(--color-fg-muted);
  border-color: var(--color-border);
}

.pipeline-pill--alert {
  color: var(--color-dead);
  border-color: var(--color-dead);
  background: rgba(74, 14, 14, 0.05);
  font-weight: 700;
}

/* Pipeline funnel section on Home */
.pipeline-funnel {
  margin-bottom: var(--sp-5);
}

.pipeline-funnel > .panel-title {
  margin-bottom: var(--sp-4);
}

.funnel-flow {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}

.funnel-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  min-width: 90px;
}

.funnel-node-label {
  font-size: var(--fs-xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-fg-muted);
}

.funnel-node-value {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--color-fg);
  line-height: 1;
}

.funnel-arrow {
  color: var(--color-fg-muted);
  font-size: var(--fs-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  user-select: none;
}

.funnel-health {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* Videos table enrichment */
.thumb-col {
  width: 7%;
  padding: var(--sp-2) var(--sp-3);
}

.video-thumb-mini {
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--color-border);
  display: block;
}

.data-table td {
  vertical-align: top;
}

.video-tldr-preview {
  font-size: var(--fs-xs);
  color: var(--color-fg-muted);
  margin-top: var(--sp-1);
  line-height: 1.45;
  max-width: 55ch;
  font-family: inherit;
}

.video-tag-row {
  display: flex;
  gap: var(--sp-1);
  flex-wrap: wrap;
  margin-top: var(--sp-1);
}

/* Video detail TLDR hero */
.summary-tldr-body {
  font-size: var(--fs-lg);
  line-height: 1.6;
  padding: var(--sp-3) 0;
}

.summary-heading-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}

.summary-heading-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-left: auto;
}

.lang-selector {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  flex-wrap: wrap;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: var(--sp-1) var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-fg-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  line-height: 1;
}

.lang-btn:hover {
  color: var(--color-fg);
  border-color: var(--color-border-strong);
  background: var(--color-surface);
  text-decoration: none;
}

.lang-btn-active {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: rgba(139, 42, 42, 0.06);
}

/* Lang dropdown in subscribers table */
.lang-form {
  margin: 0;
  display: inline;
}
.lang-select {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 4px;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
  min-width: 44px;
}
.lang-select:hover {
  border-color: var(--color-accent);
}

@media (max-width: 700px) {
  .home-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .form-row-flex {
    flex-direction: column;
    align-items: stretch;
  }

  .form-row-flex .btn {
    width: 100%;
  }

  .filter-field,
  .filter-field-grow {
    flex: none;
    min-width: 0;
  }

  .filter-actions {
    flex-direction: row;
  }

  .container {
    padding: var(--sp-3) var(--sp-4);
  }

  .subcontainer {
    margin: 0 var(--sp-3);
  }

  .site-header-inner {
    padding: var(--sp-2) var(--sp-3);
  }

  .site-nav-inner {
    padding: var(--sp-1) var(--sp-3);
    flex-wrap: wrap;
    row-gap: 0;
  }

  .nav-primary,
  .nav-secondary {
    flex-wrap: wrap;
    width: 100%;
  }

  .nav-divider {
    display: none;
  }

  .detail-header {
    flex-direction: column;
  }

  .detail-header-actions {
    align-items: flex-start;
  }

  /* Add side padding on the video-detail page only, so content doesn't cling
     to the screen edge ("nempel"). .container drops to 12px (sp-3) at ≤700px,
     which reads mepet next to /digest/{id}'s comfy 28px. .container is shared
     by every admin page, so we must NOT widen it globally — instead inset the
     .video-detail block itself: 12px container + 12px (sp-3) here = 24px
     effective, matching the digest's breathing room. Scoped to .video-detail. */
  .video-detail {
    padding-left: var(--sp-3);
    padding-right: var(--sp-3);
  }

  .video-detail-header {
    flex-direction: column;
  }

  .video-thumb {
    width: 100%;
    height: auto;
    max-width: 320px;
  }

  .count-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .count-card-value {
    font-size: var(--fs-xl);
  }

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

  /* All admin data tables → stacked cards on mobile (generalized from the
     original .jobs-table pattern). Each row becomes a card, each cell a
     "Label: value" row driven by the td's data-label attribute — templates
     must set data-label on every td that should show a label. Columns with
     no meaningful label (checkbox select, thumbnail, actions) opt out via
     their existing utility classes instead of data-label.
     Selectors are qualified with .data-table / .data-table-compact so they
     beat the base `.data-table-compact td` padding rule (specificity 0,0,2,1)
     — .data-table-compact td = 0,0,2,1, .data-table.data-table-compact td
     wins cleanly via the doubled .data-table, no !important. */
  .data-table {
    min-width: 0;
  }

  .data-table,
  .data-table tbody {
    display: block;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    display: block;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--sp-2) var(--sp-3);
    margin-bottom: var(--sp-3);
    background: var(--color-surface);
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--sp-3);
    text-align: right;
    border: 0;
    padding: var(--sp-1) 0;
  }

  .data-table td[data-label]::before {
    content: attr(data-label);
    font-weight: 600;
    text-align: left;
    color: var(--color-fg-muted);
    flex: 0 0 auto;
  }

  /* .num right-aligns on desktop; in card mode the flex layout already places
     the value on the right, so keep it right-aligned (no double shift). */
  .data-table td.num {
    text-align: right;
  }

  /* Long text (e.g. "Last error") must wrap inside the card, not overflow. */
  .data-table td[data-label] {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Cells with multi-element content (title + preview + tags, subject + badge)
     stack label above content instead of side-by-side space-between. */
  .data-table td[data-label]:has(> :nth-child(2)),
  .data-table td.subject-cell[data-label] {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }

  /* Thumbnail column: no label, shown as a small preview above the card body. */
  .data-table td.thumb-col {
    justify-content: flex-start;
    padding-bottom: 0;
  }

  /* Row-select checkbox column: no label, sits at the top-right of the card. */
  .data-table tr > td:first-child:not([data-label]):not(.thumb-col) {
    justify-content: flex-end;
    padding-bottom: 0;
  }

  /* Actions column: no label, buttons stack full-width at the bottom of the card. */
  .data-table td.actions-col {
    justify-content: flex-start;
    padding-top: var(--sp-2);
  }

  .data-table td.actions-col .action-group {
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
  }

  .site-footer-inner {
    flex-direction: column;
    gap: var(--sp-1);
    align-items: flex-start;
  }

  .channel-status {
    flex-direction: column;
    align-items: stretch;
  }

  /* Dead-letter list rows → stacked cards, same "label above value" pattern
     as .data-table (driven by data-label on each span). */
  .dead-letter-row {
    flex-direction: column;
    align-items: stretch;
    gap: var(--sp-1);
  }

  .dead-letter-row [data-label] {
    display: flex;
    justify-content: space-between;
    gap: var(--sp-3);
    text-align: right;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .dead-letter-row [data-label]::before {
    content: attr(data-label);
    font-weight: 600;
    text-align: left;
    color: var(--color-fg-muted);
    flex: 0 0 auto;
  }

  .dead-letter-error {
    white-space: normal;
  }

  .dead-letter-row-actions {
    justify-content: flex-end;
    padding-top: var(--sp-1);
  }

  .dead-letter-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--sp-2);
  }

  .dead-letter-actions {
    display: flex;
    gap: var(--sp-2);
  }

  .dead-letter-actions .btn {
    flex: 1;
  }
}

/* ── Confirm dialog ──────────────────────────────────────────────────────── */
dialog.confirm-dialog {
  border: none;
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  width: min(400px, 90vw);
  margin: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  background: var(--color-surface);
  color: var(--color-fg);
}
dialog.confirm-dialog::backdrop {
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(2px);
}
dialog.confirm-dialog p {
  margin: 0 0 var(--sp-4);
  font-size: var(--fs-sm);
  line-height: 1.55;
}
dialog.confirm-dialog .dialog-actions {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
}

/* ── Channel detail actions ──────────────────────────────────────────────── */
.channel-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-2);
  word-break: break-all;
}

/* ==========================================================================
   22. Settings tabs
   ========================================================================== */

.settings-tabs {
  display: flex;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.settings-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: -1px;
  cursor: pointer;
  font-size: var(--fs-sm);
  font-family: var(--font-sans);
  color: var(--color-fg-muted);
  line-height: 1.4;
  transition: color 0.1s, border-bottom-color 0.1s;
}

.settings-tab-btn:hover {
  color: var(--color-fg);
}

.settings-tab-btn.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  font-weight: 600;
}

.settings-tab-panel {
  display: none;
}

.settings-tab-panel.active {
  display: block;
}

/* ==========================================================================
   23. Plan 33 additions — auth, profile, admin users
   ========================================================================== */

/* Profile dropdown: allow <a> tags to style like the logout button */
a.profile-dropdown-logout {
  display: block;
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  color: var(--color-fg);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
  transition: background 120ms ease;
}

a.profile-dropdown-logout:hover {
  background: var(--color-bg);
  color: var(--color-fg);
  text-decoration: none;
}

/* Profile page: channel subscription button strip */
.channel-sub-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* ==========================================================================
   24. Plan 73 — inline subscribe CTA (public pages)
   Revised 2026-07-16 (Plan 73 §4b feedback): flat, hairline-separated —
   no card background, no border-radius, no box-shadow. Matches the
   editorial CTA used on /digest (subscribe_cta.html.j2 style="editorial"),
   just built from app.css's own --color-* tokens instead of the digest
   page's inline --paper/--ink/--accent vars.
   ========================================================================== */

.subscribe-cta {
  margin-top: var(--sp-8);
  padding: var(--sp-6) 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.subscribe-cta-inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-6);
  align-items: center;
  max-width: 760px;
}

/* Left column: heading + subtext. */
.subscribe-cta-copy {
  flex: 1 1 260px;
  min-width: 0;
}

.subscribe-cta-heading {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--color-fg);
  margin: 0 0 var(--sp-2);
}

.subscribe-cta-subtext {
  font-size: var(--fs-sm);
  color: var(--color-fg-muted);
  line-height: 1.55;
  margin: 0 0 var(--sp-5);
}

.subscribe-cta-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  flex: 1 1 260px;
}

/* Status message shown by app.js after JSON POST to /api/subscribe.
   .subscribe-cta-editorial-message also carries .subscribe-cta-message so
   these rules apply to both dashboard-style and editorial-style CTAs. */
.subscribe-cta-message {
  flex-basis: 100%;
  margin-top: var(--sp-2);
  font-size: var(--fs-sm);
}

.subscribe-cta-message.is-success {
  color: var(--color-success);
}

.subscribe-cta-message.is-error {
  color: var(--color-error);
}

/* Plan 108 — visible language <select> inside the CTA form. */
.subscribe-cta-language {
  flex: 0 0 auto;
  width: auto;
  min-width: 100px;
  padding: var(--sp-2) var(--sp-1);
  border: none;
  border-bottom: 1px solid var(--color-border-strong);
  border-radius: 0;
  background: transparent;
  color: var(--color-fg);
  font-size: var(--fs-base);
  font-family: inherit;
}

.subscribe-cta-language:focus {
  outline: none;
  border-bottom-color: var(--color-accent);
  box-shadow: none;
}

.subscribe-cta-form .subscribe-cta-language {
  /* override the full-width .form-select default */
  width: auto;
}

/* Turnstile widget: break to its own line beneath the input + button row. */
.subscribe-cta-form .cf-turnstile {
  flex-basis: 100%;
  margin-top: var(--sp-1);
}

.subscribe-cta-input {
  flex: 1;
  min-width: 0;
  border: none;
  border-bottom: 1px solid var(--color-border-strong);
  border-radius: 0;
  background: transparent;
  padding: var(--sp-2) var(--sp-1);
}

.subscribe-cta-input:focus {
  outline: none;
  border-bottom-color: var(--color-accent);
  box-shadow: none;
}

.subscribe-cta-submit {
  flex: 0 0 auto;
  border-radius: 0;
}

.subscribe-cta-compact {
  margin-top: var(--sp-6);
  padding: var(--sp-5) 0;
}

.subscribe-cta-compact .subscribe-cta-heading {
  font-size: var(--fs-lg);
}

/* Turnstile widget is a fixed 300px iframe — it fits a 360px phone, so it must
   NOT be shrunk (max-width on the iframe breaks/squashes the widget). The real
   fix is giving it a full-width row inside the column-mode form (see the
   ≤520px rule below). Here we only clamp the CTA containers so nothing else
   forces page overflow; scoped to .video-detail so the shared macro used on
   other pages is untouched. Note: NO rule targets the iframe itself. */
.video-detail .subscribe-cta,
.video-detail .subscribe-cta-inner,
.video-detail .subscribe-cta-form {
  max-width: 100%;
}

/* <320px safety net only — clip an over-wide widget without touching the
   iframe's own dimensions (overflow on the wrapper, not max-width on iframe). */
.video-detail .cf-turnstile {
  max-width: 100%;
  overflow: hidden;
}

@media (max-width: 520px) {
  .subscribe-cta-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .subscribe-cta-form {
    flex-direction: column;
  }
  /* Tighten the copy→form gap in mobile column mode. Desktop keeps sp-6 (32px)
     as a horizontal gutter; in column that 32px stacks on top of subtext's
     24px margin-bottom → ~56px+ of dead space between subtext and the email
     input ("jarak jauh pisan"). Scoped to .video-detail so only this page's
     CTA changes — the shared .subscribe-cta* rules stay intact everywhere else.
     (/digest uses .subscribe-cta-editorial*, a different class set — unaffected.) */
  .video-detail .subscribe-cta-inner {
    gap: var(--sp-4);
  }
  .video-detail .subscribe-cta-subtext {
    margin-bottom: 0;
  }
  /* Primary cause of the ~197px void: .subscribe-cta-copy { flex: 1 1 260px }.
     Same flex-basis→height trap as the form — in the column .subscribe-cta-inner,
     flex-basis 260px becomes a forced MIN-HEIGHT, so the copy block is 260px tall
     while its heading+subtext only need ~79px, leaving ~181px empty below the
     subtext. flex:none lets it collapse to content height. Completes the pattern:
     every flex child of the CTA (copy, form, input) must be flex:none in column. */
  .video-detail .subscribe-cta-copy {
    flex: none;
  }
  /* The real cause of the ~200px void between subtext and input: flex-grow
     designed for ROW mode stretches VERTICALLY once these become columns.
       .subscribe-cta-form { flex: 1 1 260px } → in the column .subscribe-cta-inner,
         flex-grow:1 makes the form fill leftover HEIGHT (tall box).
       .subscribe-cta-input { flex: 1 } → in the now-column form, flex-grow:1
         makes the INPUT fill leftover height, shoving the field far down.
     Kill vertical grow in column mode; use width:100% for full-width instead of
     the flex:1 that provided horizontal width in row mode. Scoped to .video-detail;
     desktop row mode (>520px) keeps flex:1 1 260px / flex:1 untouched. */
  .video-detail .subscribe-cta-form {
    flex: none;
  }
  .video-detail .subscribe-cta-input {
    flex: none;
    width: 100%;
  }
  .subscribe-cta-language {
    width: 100%;
  }
  /* In flex COLUMN, flex-basis maps to the main axis = HEIGHT, so the desktop
     `flex-basis: 100%` no longer stretches the widget across the width and it
     floats out to the right (measured x=497 in a 485px form → page overflow).
     Reset flex-basis and stretch on the cross axis (width) instead. */
  .subscribe-cta-form .cf-turnstile {
    flex-basis: auto;
    width: 100%;
    align-self: stretch;
    margin-top: var(--sp-1);
  }
}

/* ==========================================================================
   Soft-deleted newsletter rows + banner (Plan 97)
   ========================================================================== */

tr.is-deleted {
  opacity: 0.55;
}

tr.is-deleted .subject-cell {
  text-decoration: line-through;
}

.badge-deleted {
  background: rgba(74, 14, 14, 0.06);
  color: var(--color-dead);
  border-color: var(--color-dead);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.deleted-banner {
  background: #fff4e6;
  border: 1px solid #b07a2a;
  border-left: 4px solid #8b2a2a;
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  font-family: var(--font-serif);
  font-size: var(--fs-sm);
  color: #111;
  line-height: 1.5;
}

.deleted-banner strong {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: var(--fs-xs);
  letter-spacing: 0.02em;
  margin-right: var(--sp-2);
}

