.section-list-panel {
  position: fixed;
  top: 56px;
  left: 0;
  bottom: 0;
  width: 280px;
  background: var(--bg2, #f4f4f5);
  border-right: 1px solid var(--border, #d4d4d8);
  overflow-y: auto;
  padding: 16px 12px;
  z-index: 50;
}

.section-list-panel h3 {
  font-size: 11px;
  font-weight: 700;
  color: var(--dim, #a1a1aa);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 4px 8px 10px;
}

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: default;
  transition: background .15s ease;
}

.section-row:hover {
  background: var(--surface, #e4e4e7);
}

.section-row-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text2, #27272a);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-row-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.stale-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.edit-section-btn {
  border: 1px solid var(--border, #d4d4d8);
  background: #fff;
  color: var(--text2, #27272a);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s ease;
}

.edit-section-btn:hover {
  background: var(--surface, #e4e4e7);
  border-color: var(--border2, #a1a1aa);
}

.revert-section-btn {
  border: 1px solid var(--border, #d4d4d8);
  background: transparent;
  color: var(--dim, #71717a);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s ease;
}

.revert-section-btn:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.revert-section-btn[hidden] { display: none; }

/* Push main content right to make room for the sidebar */
body.with-section-sidebar .chrome-inner,
body.with-section-sidebar .stats-bar,
body.with-section-sidebar .content {
  margin-left: 280px;
}

.edit-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.edit-modal-backdrop[hidden] { display: none; }

.edit-modal {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25);
  width: min(560px, 94vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.edit-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #d4d4d8);
}

.edit-modal-header h2 {
  font-size: 16px;
  font-weight: 700;
}

.edit-modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--dim, #a1a1aa);
  padding: 4px 8px;
}

.edit-modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.edit-modal-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2, #27272a);
  margin-bottom: 6px;
}

.edit-modal-field input[type="text"],
.edit-modal-field textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 13px;
  border: 1px solid var(--border, #d4d4d8);
  border-radius: 8px;
  background: #fff;
  color: var(--text, #09090b);
}

.edit-modal-field textarea {
  resize: vertical;
  min-height: 120px;
}

.edit-modal-field.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}

.edit-modal-error {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 12px;
}

.edit-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border, #d4d4d8);
  background: var(--bg2, #f4f4f5);
}

.edit-modal-footer .btn[disabled] {
  opacity: .55;
  cursor: not-allowed;
}

/* ── Toast ──────────────────────────────────────────────── */
.section-edit-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  min-width: 260px;
  max-width: 420px;
  padding: 12px 18px 12px 16px;
  border-radius: 10px;
  background: #065f46;
  color: #ecfdf5;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
  border-left: 4px solid #10b981;
  opacity: 0;
  transform: translateX(24px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}

.section-edit-toast.visible {
  opacity: 1;
  transform: translateX(0);
}

.section-edit-toast.error {
  background: #7f1d1d;
  color: #fef2f2;
  border-left-color: #dc2626;
}

.edit-modal-wide { width: min(720px, 96vw); }

.edit-blocks-container { display: flex; flex-direction: column; gap: 12px; }

.edit-block {
  border: 1px solid var(--border, #d4d4d8);
  border-radius: 8px;
  background: #fafafa;
  padding: 10px 12px;
}

.edit-block-header {
  font-size: 10px;
  font-weight: 700;
  color: #6b7a9a;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.edit-block textarea,
.edit-block input[type="text"] {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border, #d4d4d8);
  border-radius: 6px;
  padding: 8px;
  font: inherit;
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
}

.edit-block textarea { min-height: 44px; }

.edit-bullet-row,
.edit-menu-item-row {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin-top: 4px;
}

.edit-bullet-row textarea,
.edit-menu-item-row textarea,
.edit-menu-item-row input {
  flex: 1;
}

.edit-bullet-row .btn-remove,
.edit-menu-item-row .btn-remove,
.edit-block-add {
  border: 1px solid var(--border, #d4d4d8);
  background: #fff;
  color: var(--text2, #27272a);
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.edit-block-add { margin-top: 6px; font-weight: 600; }
.edit-bullet-row .btn-remove:hover,
.edit-menu-item-row .btn-remove:hover { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.edit-block-readonly {
  font-size: 12px;
  color: #525f7a;
  background: #fff;
  border: 1px dashed #d4d4d8;
  border-radius: 6px;
  padding: 8px;
}

.pending-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  color: #1e3a8a;
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.regen-plan-btn {
  display: block;
  width: 100%;
  margin: 4px 0 14px;
  font-size: 13px;
  padding: 9px 14px;
  text-align: center;
}
.regen-plan-btn[hidden] { display: none; }

/* ── Full-screen regenerating overlay ─────────────────── */
.regen-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: regen-overlay-in .25s ease;
}

.regen-overlay[hidden] { display: none; }

@keyframes regen-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.regen-card {
  background: #ffffff;
  color: #1a2030;
  max-width: 480px;
  width: calc(100% - 48px);
  border-radius: 16px;
  padding: 40px 36px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.regen-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid #e5e7eb;
  border-top-color: #6366f1;
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: regen-spin 0.9s linear infinite;
}

@keyframes regen-spin {
  to { transform: rotate(360deg); }
}

.regen-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.2px;
}

.regen-subtitle {
  font-size: 14px;
  color: #525f7a;
  line-height: 1.5;
  margin-bottom: 20px;
}

.regen-sections-list {
  font-size: 13px;
  color: #374151;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 16px;
  text-align: left;
  margin-bottom: 20px;
  max-height: 160px;
  overflow-y: auto;
}

.regen-sections-list .label {
  font-size: 11px;
  font-weight: 700;
  color: #6b7a9a;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.regen-sections-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.regen-sections-list li {
  padding: 3px 0;
  color: #334155;
}

.regen-sections-list li::before {
  content: '✓ ';
  color: #6366f1;
  font-weight: 700;
}

.regen-elapsed {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #6366f1;
  background: #eef2ff;
  padding: 6px 14px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.regen-note {
  margin-top: 16px;
  font-size: 12px;
  color: #94a3b8;
  font-style: italic;
}

.btn-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s ease;
}

.btn-danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #7f1d1d;
}

.btn-danger[disabled] {
  opacity: .55;
  cursor: not-allowed;
}

/* ── Deleted sections in sidebar ────────────────────── */
.section-list-deleted {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px dashed var(--border, #d4d4d8);
}

.section-list-deleted h3 {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 0 8px 8px;
}

.section-row-deleted {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  opacity: .65;
}

.section-row-deleted:hover { opacity: 1; background: var(--surface, #e4e4e7); }

.section-row-deleted .section-row-title {
  font-size: 12px;
  text-decoration: line-through;
  color: #6b7a9a;
}

.restore-section-btn {
  border: 1px solid var(--border, #d4d4d8);
  background: #fff;
  color: #059669;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.restore-section-btn:hover {
  background: #ecfdf5;
  border-color: #10b981;
}
