/*
 * ai_editor.css — shared styles for AAE (AI Article Editor) module
 * Phase 9 additions: .ae-* — entry page + three-column editor + UTP blocks
 * Phase 10 additions: .aae-run-* / .aae-log-* / .aae-batch-*
 * DO NOT override existing Bootstrap utilities — only additive classes here.
 *
 * Design tokens
 */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================================
   PHASE 9 — AI Editor Design System
   Aesthetic: Industrial utilitarian command center
   Memorable element: left-rail progress timeline — solid green
   trail for confirmed tabs, amber pulse for running, ghost for
   locked — users feel pipeline momentum as they scroll down.
   ============================================================ */

:root {
  --ae-surface:        #ffffff;
  --ae-surface-2:      #f4f5f7;
  --ae-surface-3:      #e8eaed;
  --ae-border:         #d0d5dd;
  --ae-border-strong:  #98a2b3;
  --ae-text-primary:   #101828;
  --ae-text-secondary: #475467;
  --ae-text-muted:     #98a2b3;

  --ae-confirmed:      #027a48;
  --ae-confirmed-bg:   #ecfdf3;
  --ae-confirmed-chip: #d1fadf;
  --ae-running:        #b54708;
  --ae-running-bg:     #fffaeb;
  --ae-running-chip:   #fef0c7;
  --ae-failed:         #b42318;
  --ae-failed-bg:      #fff4f2;
  --ae-failed-chip:    #fee4e2;
  --ae-ready:          #175cd3;
  --ae-ready-bg:       #eff8ff;
  --ae-ready-chip:     #d1e9ff;
  --ae-locked:         #667085;
  --ae-locked-bg:      #f8f9fa;
  --ae-locked-chip:    #e4e7ec;

  --ae-accent:         #2563eb;
  --ae-accent-hover:   #1d4ed8;
  --ae-accent-light:   #eff6ff;

  --ae-left-w:         240px;
  --ae-right-w:        280px;
  --ae-top-h:          56px;
  --ae-section-gap:    16px;

  --ae-ease:           cubic-bezier(0.16, 1, 0.3, 1);
  --ae-dur-fast:       120ms;
  --ae-dur-normal:     240ms;
  --ae-dur-slow:       400ms;

  --ae-font-ui:        "DM Sans", "Segoe UI", system-ui, sans-serif;
  --ae-font-mono:      "JetBrains Mono", "Cascadia Code", monospace;
}

/* ── Full-height editor shell ───────────────────────────────── */
.ae-shell {
  display: flex; flex-direction: column;
  height: calc(100vh - 32px);
  font-family: var(--ae-font-ui);
  background: var(--ae-surface-2);
  overflow: hidden;
  margin: -1.5rem -2rem;
}

/* ── Top bar ─────────────────────────────────────────────────── */
.ae-topbar {
  height: var(--ae-top-h);
  background: var(--ae-surface);
  border-bottom: 1.5px solid var(--ae-border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  flex-shrink: 0;
  position: relative; z-index: 10;
}
.ae-topbar__kw {
  font-size: .95rem; font-weight: 600; color: var(--ae-text-primary);
  max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ae-topbar__branch-badge {
  font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 20px;
  background: var(--ae-accent-light); color: var(--ae-accent); border: 1px solid #bfdbfe;
  white-space: nowrap;
}
.ae-topbar__progress {
  flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0;
}
.ae-topbar__progress-bar-wrap {
  flex: 1; height: 6px; background: var(--ae-surface-3);
  border-radius: 3px; overflow: hidden; min-width: 60px;
}
.ae-topbar__progress-bar {
  height: 100%; background: var(--ae-confirmed); border-radius: 3px;
  transition: width var(--ae-dur-slow) var(--ae-ease);
}
.ae-topbar__progress-label { font-size: .78rem; color: var(--ae-text-secondary); white-space: nowrap; }
.ae-topbar__run-id {
  font-family: var(--ae-font-mono); font-size: .72rem; color: var(--ae-text-muted);
  background: var(--ae-surface-2); padding: 3px 8px; border-radius: 4px;
  border: 1px solid var(--ae-border); white-space: nowrap;
}
.ae-topbar__mode-switch {
  display: flex; background: var(--ae-surface-2); border: 1px solid var(--ae-border);
  border-radius: 6px; overflow: hidden; flex-shrink: 0;
}
.ae-topbar__mode-btn {
  font-size: .78rem; padding: 4px 12px; border: none; background: transparent;
  color: var(--ae-text-secondary); cursor: pointer;
  transition: background var(--ae-dur-fast), color var(--ae-dur-fast);
}
.ae-topbar__mode-btn.active {
  background: var(--ae-surface); color: var(--ae-text-primary);
  font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* ── Three-column body ──────────────────────────────────────── */
.ae-body { flex: 1; display: flex; overflow: hidden; }

/* ── LEFT rail ──────────────────────────────────────────────── */
.ae-left {
  width: var(--ae-left-w); flex-shrink: 0;
  background: var(--ae-surface); border-right: 1.5px solid var(--ae-border);
  display: flex; flex-direction: column; overflow: hidden;
}
.ae-left__header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--ae-border); flex-shrink: 0;
}
.ae-left__run-label {
  font-size: .7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ae-text-muted);
}
.ae-left__run-num {
  font-size: 1.05rem; font-weight: 700; color: var(--ae-text-primary);
  line-height: 1.2; margin-top: 2px;
}
.ae-left__meta { font-size: .75rem; color: var(--ae-text-secondary); margin-top: 4px; line-height: 1.4; }

.ae-tab-rail {
  flex: 1; overflow-y: auto; padding: 8px 0;
  scrollbar-width: thin; scrollbar-color: var(--ae-border) transparent;
}

.ae-tab-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; cursor: pointer;
  border: none; border-left: 3px solid transparent;
  background: none; width: 100%; text-align: left;
  position: relative;
  transition: background var(--ae-dur-fast), border-color var(--ae-dur-fast);
}
.ae-tab-item:hover:not(.ae-tab-item--locked) { background: var(--ae-surface-2); }
.ae-tab-item.active { background: var(--ae-accent-light); border-left-color: var(--ae-accent); }
.ae-tab-item--locked { opacity: .45; cursor: not-allowed; }
.ae-tab-item--confirmed { border-left-color: var(--ae-confirmed); }
.ae-tab-item--running   { border-left-color: var(--ae-running); background: var(--ae-running-bg); }

.ae-tab-status {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; flex-shrink: 0;
}
.ae-tab-status--confirmed { background: var(--ae-confirmed-chip); }
.ae-tab-status--running   { background: var(--ae-running-chip); animation: ae-pulse 1.2s ease-in-out infinite; }
.ae-tab-status--failed    { background: var(--ae-failed-chip); }
.ae-tab-status--ready     { background: var(--ae-ready-chip); }
.ae-tab-status--locked    { background: var(--ae-locked-chip); }

@keyframes ae-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

.ae-tab-label {
  font-size: .78rem; font-weight: 500; color: var(--ae-text-primary);
  line-height: 1.3; flex: 1; min-width: 0;
}
.ae-tab-label small {
  display: block; font-size: .68rem; color: var(--ae-text-muted);
  font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ae-tooltip-locked {
  position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
  background: var(--ae-text-primary); color: #fff; font-size: .72rem;
  padding: 4px 8px; border-radius: 4px; white-space: nowrap;
  pointer-events: none; z-index: 200; display: none; margin-left: 6px;
}
.ae-tab-item--locked:hover .ae-tooltip-locked { display: block; }

.ae-left__footer { border-top: 1px solid var(--ae-border); padding: 8px 0; flex-shrink: 0; }
.ae-left__nav-link {
  display: flex; align-items: center; gap: 8px; padding: 7px 16px;
  font-size: .78rem; color: var(--ae-text-secondary); text-decoration: none;
  transition: color var(--ae-dur-fast), background var(--ae-dur-fast);
}
.ae-left__nav-link:hover { color: var(--ae-text-primary); background: var(--ae-surface-2); }

/* ── MIDDLE ──────────────────────────────────────────────────── */
.ae-middle {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: var(--ae-section-gap);
  min-width: 0;
  scrollbar-width: thin; scrollbar-color: var(--ae-border) transparent;
}
.ae-middle__tab-title {
  font-size: 1rem; font-weight: 700; color: var(--ae-text-primary);
  margin-bottom: 4px; display: flex; align-items: center; gap: 8px;
}

/* ── UTP blocks ──────────────────────────────────────────────── */
.utp-block { background: var(--ae-surface); border: 1px solid var(--ae-border); border-radius: 8px; overflow: hidden; }
.utp-block__header {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--ae-surface-2); border-bottom: 1px solid var(--ae-border);
  cursor: pointer; user-select: none;
}
.utp-block__header:hover { background: var(--ae-surface-3); }
.utp-block__icon { font-size: 1rem; width: 24px; text-align: center; flex-shrink: 0; }
.utp-block__title {
  font-size: .82rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ae-text-primary); flex: 1;
}
.utp-block__badge { font-size: .68rem; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.utp-block__chevron { font-size: .75rem; color: var(--ae-text-muted); transition: transform var(--ae-dur-fast); }
.utp-block.collapsed .utp-block__chevron { transform: rotate(-90deg); }
.utp-block__body { padding: 16px; }
.utp-block.collapsed .utp-block__body { display: none; }

/* Block 1 intro */
.utp-intro-text { font-size: .84rem; color: var(--ae-text-secondary); line-height: 1.6; }
.utp-intro-text strong { color: var(--ae-text-primary); }
.utp-intro-meta { display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap; }
.utp-intro-meta__item { font-size: .75rem; color: var(--ae-text-muted); }
.utp-intro-meta__item strong { color: var(--ae-text-secondary); }

/* Block 2 API data */
.utp-api-list { display: flex; flex-direction: column; gap: 8px; }
.utp-api-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--ae-surface-2); border: 1px solid var(--ae-border);
  border-radius: 6px; font-size: .82rem; cursor: pointer;
  transition: border-color var(--ae-dur-fast), background var(--ae-dur-fast);
}
.utp-api-item:hover, .utp-api-item.selected {
  border-color: var(--ae-accent); background: var(--ae-accent-light);
}
.utp-api-item input[type="checkbox"] {
  flex-shrink: 0; width: 16px; height: 16px; accent-color: var(--ae-accent); cursor: pointer;
}
.utp-api-item__label { flex: 1; font-weight: 500; color: var(--ae-text-primary); }
.utp-api-item__meta { font-size: .72rem; color: var(--ae-text-muted); white-space: nowrap; }
.utp-api-token-estimate {
  margin-top: 10px; font-size: .75rem; color: var(--ae-text-secondary);
  padding: 8px 12px; background: var(--ae-surface-2);
  border-radius: 4px; border-left: 3px solid var(--ae-accent);
}

/* Block 3 prev output */
.utp-prev-output {
  background: var(--ae-surface-2); border: 1px solid var(--ae-border); border-radius: 6px;
  font-family: var(--ae-font-mono); font-size: .75rem; line-height: 1.6;
  padding: 12px; max-height: 200px; overflow-y: auto;
  color: var(--ae-text-secondary); white-space: pre-wrap; word-break: break-word;
}

/* Block 4 prompt editor */
.utp-prompt-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--ae-border); margin-bottom: 12px; }
.utp-prompt-tab {
  font-size: .78rem; font-weight: 600; padding: 7px 14px; border: none; background: none;
  color: var(--ae-text-secondary); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--ae-dur-fast), border-color var(--ae-dur-fast);
}
.utp-prompt-tab.active { color: var(--ae-accent); border-bottom-color: var(--ae-accent); }
.utp-prompt-pane { display: none; }
.utp-prompt-pane.active { display: block; }
.utp-prompt-textarea {
  width: 100%; min-height: 120px;
  font-family: var(--ae-font-mono); font-size: .75rem; line-height: 1.6;
  padding: 10px 12px; border: 1px solid var(--ae-border); border-radius: 6px;
  resize: vertical; color: var(--ae-text-primary); background: var(--ae-surface);
  transition: border-color var(--ae-dur-fast);
}
.utp-prompt-textarea:focus {
  outline: none; border-color: var(--ae-accent); box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.utp-prompt-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.utp-prompt-version {
  font-size: .72rem; color: var(--ae-text-muted); font-family: var(--ae-font-mono);
  background: var(--ae-surface-2); padding: 2px 8px; border-radius: 4px; border: 1px solid var(--ae-border);
}

/* Block 5 execute */
.utp-exec-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.utp-candidates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.utp-candidate-card {
  border: 1.5px solid var(--ae-border); border-radius: 8px; overflow: hidden;
  background: var(--ae-surface);
  transition: border-color var(--ae-dur-fast), box-shadow var(--ae-dur-fast);
}
.utp-candidate-card:hover { border-color: var(--ae-accent); }
.utp-candidate-card.selected {
  border-color: var(--ae-confirmed); box-shadow: 0 0 0 3px var(--ae-confirmed-chip);
}
.utp-candidate-card__header {
  padding: 8px 12px; background: var(--ae-surface-2); border-bottom: 1px solid var(--ae-border);
  display: flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 600;
}
.utp-candidate-card__body {
  padding: 10px 12px; font-size: .75rem; line-height: 1.5;
  color: var(--ae-text-secondary); max-height: 140px; overflow-y: auto;
  white-space: pre-wrap;
}
.utp-candidate-card__footer {
  padding: 8px 12px; border-top: 1px solid var(--ae-border);
  display: flex; align-items: center; gap: 6px;
}
.utp-running-indicator {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  background: var(--ae-running-bg); border: 1px solid #fde68a;
  border-radius: 6px; font-size: .82rem; color: var(--ae-running);
}
.utp-running-indicator .spinner-border { width: 16px; height: 16px; border-width: 2px; }

/* Block 6 confirm */
.utp-confirm-bar {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--ae-confirmed-bg); border-radius: 6px; flex-wrap: wrap;
}
.utp-confirm-selected-text { font-size: .82rem; color: var(--ae-confirmed); flex: 1; }

/* ── RIGHT column ────────────────────────────────────────────── */
.ae-right {
  width: var(--ae-right-w); flex-shrink: 0;
  border-left: 1.5px solid var(--ae-border);
  background: var(--ae-surface); display: flex; flex-direction: column; overflow: hidden;
}
.ae-right__panel {
  flex: 1; overflow-y: auto; padding: 14px;
  scrollbar-width: thin; scrollbar-color: var(--ae-border) transparent;
}
.ae-right__section-title {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ae-text-muted);
  margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--ae-border);
}
.ae-right__divider { height: 1px; background: var(--ae-border); margin: 0 14px; flex-shrink: 0; }

/* Outline kanban */
.outline-kanban { display: flex; flex-direction: column; gap: 4px; }
.outline-node {
  display: flex; align-items: flex-start; gap: 8px; padding: 7px 10px;
  border-radius: 5px; cursor: pointer; border: 1px solid transparent;
  transition: background var(--ae-dur-fast), border-color var(--ae-dur-fast);
}
.outline-node:hover { background: var(--ae-surface-2); border-color: var(--ae-border); }
.outline-node.editing { border-color: var(--ae-accent); background: var(--ae-accent-light); }
.outline-node--h2 { padding-left: 22px; }
.outline-node--h3 { padding-left: 38px; }
.outline-node__level {
  font-size: .65rem; font-weight: 700; padding: 1px 5px; border-radius: 3px;
  flex-shrink: 0; margin-top: 2px;
}
.outline-node--h1 .outline-node__level { background: #1e3a5f; color: #fff; }
.outline-node--h2 .outline-node__level { background: #2563eb; color: #fff; }
.outline-node--h3 .outline-node__level { background: #93c5fd; color: #1e3a5f; }
.outline-node__text { font-size: .78rem; color: var(--ae-text-primary); line-height: 1.4; flex: 1; }
.outline-node__edit-input {
  font-size: .78rem; width: 100%; border: none; outline: none;
  background: transparent; color: var(--ae-text-primary); line-height: 1.4;
}

/* Topics */
.topics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.topic-chip { padding: 5px 8px; border-radius: 5px; font-size: .7rem; font-weight: 600; text-align: center; }
.topic-chip--red    { background: #fee2e2; color: #991b1b; }
.topic-chip--yellow { background: #fef9c3; color: #854d0e; }
.topic-chip--green  { background: #dcfce7; color: #166534; }
.topic-chip--blue   { background: #dbeafe; color: #1e40af; }

/* ── Entry page ─────────────────────────────────────────────── */
.ae-entry { max-width: 900px; margin: 0 auto; }
.ae-entry__step-label {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--ae-text-muted); margin-bottom: 8px;
}
.ae-entry__step-title { font-size: 1.1rem; font-weight: 700; color: var(--ae-text-primary); margin-bottom: 16px; }
.ae-entry-card { background: var(--ae-surface); border: 1px solid var(--ae-border); border-radius: 10px; padding: 20px; margin-bottom: 16px; }

/* Branch cards */
.ae-branch-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 10px; }
.ae-branch-card { position: relative; }
.ae-branch-card input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.ae-branch-card__label {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 20px 14px 16px; border: 2px solid var(--ae-border); border-radius: 10px;
  cursor: pointer; background: var(--ae-surface); height: 100%;
  transition: border-color var(--ae-dur-normal), box-shadow var(--ae-dur-normal), background var(--ae-dur-normal);
}
.ae-branch-card__label:hover { border-color: var(--ae-accent); background: var(--ae-accent-light); }
.ae-branch-card input[type="radio"]:checked + .ae-branch-card__label {
  border-color: var(--ae-accent); background: var(--ae-accent-light);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.ae-branch-card__icon { font-size: 1.8rem; margin-bottom: 10px; line-height: 1; }
.ae-branch-card__name { font-size: .85rem; font-weight: 700; color: var(--ae-text-primary); margin-bottom: 4px; }
.ae-branch-card__desc { font-size: .72rem; color: var(--ae-text-secondary); line-height: 1.4; margin-bottom: 8px; }
.ae-branch-card__tags { font-size: .68rem; color: var(--ae-text-muted); font-family: var(--ae-font-mono); }

/* Tab preview */
.ae-branch-preview {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px;
  padding: 10px 12px; background: var(--ae-surface-2);
  border: 1px solid var(--ae-border); border-radius: 6px;
  min-height: 42px; align-items: center;
}
.ae-branch-preview__chip {
  font-size: .68rem; font-weight: 500; padding: 2px 8px; border-radius: 20px;
  background: var(--ae-surface-3); color: var(--ae-text-secondary);
  border: 1px solid var(--ae-border); white-space: nowrap;
}
.ae-branch-preview__chip--core { background: var(--ae-accent-light); color: var(--ae-accent); border-color: #bfdbfe; }
.ae-branch-preview__chip--optional { opacity: .7; }
.ae-branch-preview__placeholder { font-size: .75rem; color: var(--ae-text-muted); font-style: italic; }

/* Entry selectors */
.ae-select-group { display: flex; gap: 12px; flex-wrap: wrap; }
.ae-select-group .form-label { font-size: .78rem; font-weight: 600; color: var(--ae-text-secondary); margin-bottom: 4px; }
.ae-select-group .form-select,
.ae-select-group .form-control { font-size: .84rem; border-color: var(--ae-border); border-radius: 6px; }
.ae-select-group .form-select:focus,
.ae-select-group .form-control:focus {
  border-color: var(--ae-accent); box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.ae-kw-search-wrap { position: relative; }
.ae-kw-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  background: var(--ae-surface); border: 1px solid var(--ae-border); border-top: none;
  border-radius: 0 0 6px 6px; max-height: 240px; overflow-y: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,.1); display: none;
}
.ae-kw-results.open { display: block; }
.ae-kw-result-item {
  padding: 8px 12px; font-size: .82rem; cursor: pointer;
  display: flex; align-items: center; gap: 8px; color: var(--ae-text-primary);
  transition: background var(--ae-dur-fast);
}
.ae-kw-result-item:hover { background: var(--ae-surface-2); }
.ae-kw-result-item .badge { flex-shrink: 0; font-size: .65rem; }
.ae-kw-result-item__analyzed { font-size: .7rem; color: var(--ae-confirmed); margin-left: auto; white-space: nowrap; }

/* Diff modal */
.ae-diff-modal .modal-dialog { max-width: 900px; }
.ae-diff-mode-switch { display: flex; border: 1px solid var(--ae-border); border-radius: 6px; overflow: hidden; }
.ae-diff-mode-btn {
  flex: 1; font-size: .78rem; font-weight: 600; padding: 5px 12px;
  border: none; background: transparent; color: var(--ae-text-secondary);
  cursor: pointer; transition: background var(--ae-dur-fast), color var(--ae-dur-fast);
}
.ae-diff-mode-btn.active { background: var(--ae-accent); color: #fff; }
.ae-diff-pane {
  background: var(--ae-surface-2); border: 1px solid var(--ae-border); border-radius: 6px;
  padding: 12px; font-family: var(--ae-font-mono); font-size: .75rem;
  line-height: 1.7; max-height: 420px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word;
}
.ae-diff-add { background: #dcfce7; color: #14532d; display: block; }
.ae-diff-del { background: #fee2e2; color: #7f1d1d; text-decoration: line-through; display: block; }
.ae-diff-sidebyside { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ae-diff-pane__label {
  font-size: .72rem; font-weight: 700; color: var(--ae-text-muted);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px;
}
.ae-diff-stats {
  font-size: .78rem; color: var(--ae-text-secondary); padding: 8px 12px;
  background: var(--ae-surface-2); border-radius: 6px; border-left: 3px solid var(--ae-accent);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.ae-btn-primary {
  background: var(--ae-accent); color: #fff; border: none;
  padding: 8px 18px; border-radius: 6px; font-size: .84rem; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: background var(--ae-dur-fast), transform var(--ae-dur-fast);
}
.ae-btn-primary:hover { background: var(--ae-accent-hover); }
.ae-btn-primary:active { transform: scale(.98); }
.ae-btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.ae-btn-secondary {
  background: var(--ae-surface); color: var(--ae-text-primary); border: 1px solid var(--ae-border);
  padding: 8px 14px; border-radius: 6px; font-size: .82rem; font-weight: 500;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: background var(--ae-dur-fast), border-color var(--ae-dur-fast);
}
.ae-btn-secondary:hover { background: var(--ae-surface-2); border-color: var(--ae-border-strong); }
.ae-btn-success {
  background: var(--ae-confirmed); color: #fff; border: none;
  padding: 8px 18px; border-radius: 6px; font-size: .84rem; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: opacity var(--ae-dur-fast);
}
.ae-btn-success:hover { opacity: .9; }
.ae-btn-success:disabled { opacity: .4; cursor: not-allowed; }

/* Utility */
.ae-empty-state { text-align: center; padding: 32px 16px; color: var(--ae-text-muted); }
.ae-empty-state .ae-empty-icon { font-size: 2rem; margin-bottom: 8px; }
.ae-empty-state p { font-size: .82rem; margin: 0; }
.ae-error-state {
  padding: 12px 14px; background: var(--ae-failed-bg);
  border: 1px solid var(--ae-failed-chip); border-radius: 6px;
  font-size: .82rem; color: var(--ae-failed);
}
.ae-skeleton {
  background: linear-gradient(90deg, var(--ae-surface-2) 25%, var(--ae-surface-3) 50%, var(--ae-surface-2) 75%);
  background-size: 200% 100%;
  animation: ae-skeleton-shimmer 1.5s infinite;
  border-radius: 4px; height: 14px; margin-bottom: 6px;
}
@keyframes ae-skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1279px) {
  :root { --ae-left-w: 60px; --ae-right-w: 0px; }
  .ae-left__header { display: none; }
  .ae-left__footer .ae-left__nav-link span { display: none; }
  .ae-tab-item { padding: 10px; justify-content: center; }
  .ae-tab-label { display: none; }
  .ae-tab-status { width: 28px; height: 28px; font-size: 1rem; }
  .ae-right {
    position: fixed; right: 0; top: 0; bottom: 0;
    width: 300px; z-index: 300;
    transform: translateX(100%);
    transition: transform var(--ae-dur-normal) var(--ae-ease);
    box-shadow: -4px 0 24px rgba(0,0,0,.15);
  }
  .ae-right.open { transform: translateX(0); }
  .ae-branch-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 767px) {
  .ae-shell { margin: -1.5rem -1rem; }
  .ae-body { flex-direction: column; }
  .ae-left { width: 100%; height: auto; border-right: none; border-bottom: 1.5px solid var(--ae-border); }
  .ae-tab-rail { display: flex; flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 6px 8px; }
  .ae-tab-item { flex-direction: column; padding: 6px 10px; min-width: 52px; border-left: none; border-bottom: 3px solid transparent; }
  .ae-tab-item--confirmed { border-bottom: 3px solid var(--ae-confirmed); border-left: none; }
  .ae-tab-item--running   { border-bottom: 3px solid var(--ae-running); border-left: none; }
  .ae-tab-item.active     { border-bottom: 3px solid var(--ae-accent); border-left: none; }
  .ae-middle { padding: 12px; }
  .ae-right {
    position: fixed; bottom: 0; left: 0; right: 0; height: 50vh; width: 100%;
    border-left: none; border-top: 1.5px solid var(--ae-border);
    transform: translateY(100%);
    transition: transform var(--ae-dur-normal) var(--ae-ease);
  }
  .ae-right.open { transform: translateY(0); }
  .ae-topbar__kw { max-width: 120px; }
  .ae-diff-sidebyside { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .ae-branch-cards { grid-template-columns: 1fr 1fr; }
  .ae-select-group { flex-direction: column; }
}

/* =============================================================
   PHASE 10 styles — .aae-run-* / .aae-log-* / .aae-batch-*
   (existing below, do not remove)
   ============================================================= */

:root {
  --aae-accent:       #3d6ef7;
  --aae-accent-light: #ebf0ff;
  --aae-success:      #1ca87f;
  --aae-success-bg:   #edfaf5;
  --aae-running:      #f59e0b;
  --aae-running-bg:   #fffbeb;
  --aae-error:        #ef4444;
  --aae-error-bg:     #fef2f2;
  --aae-locked:       #94a3b8;
  --aae-locked-bg:    #f1f5f9;
  --aae-border:       #dee2e6;
  --aae-surface:      #ffffff;
  --aae-surface-alt:  #f8f9fa;
  --aae-mono:         'JetBrains Mono', 'Courier New', monospace;
  --aae-row-h:        28px;
  --aae-expand-dur:   200ms;
}

/* ──────────────────────────────────────────────
   SHARED — page header strip
   ────────────────────────────────────────────── */
.aae-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  background: var(--aae-surface);
  border: 1px solid var(--aae-border);
  border-radius: 8px;
  margin-bottom: 1rem;
}
.aae-page-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.aae-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  color: #6c757d;
  background: var(--aae-surface-alt);
  border: 1px solid var(--aae-border);
  border-radius: 99px;
  padding: .15rem .65rem;
}

/* ──────────────────────────────────────────────
   10.1 RUN DETAIL — tab progress chips
   ────────────────────────────────────────────── */
.aae-chips-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  padding: .75rem 1rem;
  background: var(--aae-surface);
  border: 1px solid var(--aae-border);
  border-radius: 8px;
  margin-bottom: 1rem;
}
.aae-chip {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .75rem;
  font-weight: 500;
  padding: .2rem .55rem;
  border-radius: 99px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: filter .12s, transform .08s;
  white-space: nowrap;
}
.aae-chip:hover { filter: brightness(.92); transform: translateY(-1px); }
.aae-chip:active { transform: translateY(0); }

.aae-chip--confirmed {
  background: var(--aae-success-bg);
  color: var(--aae-success);
  border-color: #a7f3d0;
}
.aae-chip--running {
  background: var(--aae-running-bg);
  color: var(--aae-running);
  border-color: #fde68a;
  animation: aae-pulse 1.4s ease-in-out infinite;
}
.aae-chip--locked {
  background: var(--aae-locked-bg);
  color: var(--aae-locked);
  border-color: #e2e8f0;
  cursor: default;
}
.aae-chip--failed {
  background: var(--aae-error-bg);
  color: var(--aae-error);
  border-color: #fecaca;
}
.aae-chip--ready {
  background: var(--aae-accent-light);
  color: var(--aae-accent);
  border-color: #c7d7fd;
}

@keyframes aae-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .65; }
}

/* Run detail stats bar */
.aae-stats-bar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: .6rem 1rem;
  background: var(--aae-surface);
  border: 1px solid var(--aae-border);
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: .85rem;
}
.aae-stats-bar .stat-label { color: #6c757d; }
.aae-stats-bar .stat-value { font-weight: 600; color: #1a1a2e; }

/* Timeline rows */
.aae-timeline {
  position: relative;
  padding-left: 1.5rem;
}
.aae-timeline::before {
  content: '';
  position: absolute;
  left: .45rem;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--aae-border);
}
.aae-timeline-item {
  position: relative;
  padding: .5rem 0 .5rem .75rem;
  font-size: .82rem;
}
.aae-timeline-item::before {
  content: '';
  position: absolute;
  left: -.85rem;
  top: .85rem;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--aae-border);
  border: 2px solid var(--aae-surface);
}
.aae-timeline-item.confirmed::before { background: var(--aae-success); }
.aae-timeline-item.running::before   { background: var(--aae-running); box-shadow: 0 0 0 3px var(--aae-running-bg); }
.aae-timeline-item.failed::before    { background: var(--aae-error); }

/* Loading skeleton */
.aae-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: aae-shimmer 1.4s infinite;
  border-radius: 4px;
  display: inline-block;
}
@keyframes aae-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ──────────────────────────────────────────────
   10.2 AI LOG — brandmaster-style row cards
   ────────────────────────────────────────────── */
.aae-log-table {
  border: 1px solid var(--aae-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--aae-surface);
}
.aae-log-table-header {
  display: grid;
  grid-template-columns: 2fr 80px 120px 70px 36px;
  align-items: center;
  padding: .4rem .75rem;
  background: var(--aae-surface-alt);
  border-bottom: 1px solid var(--aae-border);
  font-size: .73rem;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.aae-log-row {
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--aae-border);
  transition: background .1s;
}
.aae-log-row:last-child { border-bottom: none; }
.aae-log-row:hover .aae-log-row-compact { background: #f8f9fa; }

.aae-log-row--success { border-left-color: var(--aae-success); }
.aae-log-row--running { border-left-color: var(--aae-running); }
.aae-log-row--failed  { border-left-color: var(--aae-error); }
.aae-log-row--pending { border-left-color: var(--aae-locked); }

.aae-log-row-compact {
  display: grid;
  grid-template-columns: 2fr 80px 120px 70px 36px;
  align-items: center;
  padding: .3rem .75rem;
  min-height: var(--aae-row-h);
  cursor: pointer;
  user-select: none;
  transition: background .1s;
}
.aae-log-row-compact:hover { background: var(--aae-surface-alt); }

.aae-log-tab-id {
  font-size: .8rem;
  font-weight: 600;
  color: #1a1a2e;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.aae-log-rerun-badge {
  font-size: .68rem;
  font-weight: 500;
  background: #fde68a;
  color: #92400e;
  padding: .05rem .35rem;
  border-radius: 4px;
}
.aae-log-version {
  font-size: .76rem;
  color: #6c757d;
  font-family: var(--aae-mono);
}
.aae-log-time {
  font-size: .76rem;
  color: #6c757d;
  font-family: var(--aae-mono);
}
.aae-log-cost {
  font-size: .76rem;
  font-weight: 500;
  color: #374151;
}
.aae-log-cost--running {
  color: var(--aae-running);
  font-style: italic;
}
.aae-log-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  color: #94a3b8;
  transition: transform var(--aae-expand-dur) ease, color .1s;
}
.aae-log-row.is-open .aae-log-toggle {
  transform: rotate(180deg);
  color: var(--aae-accent);
}

/* Expanded detail panel */
.aae-log-detail {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--aae-expand-dur) ease-out;
}
.aae-log-row.is-open .aae-log-detail {
  max-height: 2000px;
  transition: max-height 400ms ease-in;
}
.aae-log-detail-inner {
  padding: .75rem 1rem .75rem 1.25rem;
  background: #fdfdfe;
  border-top: 1px solid var(--aae-border);
}

/* Detail meta strip */
.aae-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.25rem;
  font-size: .78rem;
  color: #6c757d;
  margin-bottom: .75rem;
}
.aae-detail-meta strong { color: #374151; }

/* Prompt/output code blocks */
.aae-prompt-block {
  margin-bottom: .6rem;
}
.aae-prompt-block-label {
  font-size: .72rem;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .2rem;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.aae-prompt-content {
  font-family: var(--aae-mono);
  font-size: .75rem;
  line-height: 1.55;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 6px;
  padding: .65rem .8rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #1e293b;
}
.aae-prompt-content--output {
  background: #022c22;
  color: #a7f3d0;
  border-color: #065f46;
}

/* Action buttons strip at bottom of detail */
.aae-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .75rem;
  padding-top: .6rem;
  border-top: 1px solid var(--aae-border);
}
.aae-detail-actions .btn {
  font-size: .78rem;
  padding: .25rem .6rem;
}

/* Filter bar */
.aae-filter-bar {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}
.aae-filter-bar .form-select,
.aae-filter-bar .form-control {
  font-size: .82rem;
  padding: .3rem .6rem;
  height: auto;
  max-width: 180px;
}

/* Load more */
.aae-load-more-wrap {
  text-align: center;
  padding: .75rem;
  border-top: 1px solid var(--aae-border);
}

/* Empty / error state */
.aae-empty-state {
  padding: 3rem;
  text-align: center;
  color: #94a3b8;
}
.aae-empty-state i { font-size: 2.5rem; margin-bottom: .75rem; display: block; }

/* ──────────────────────────────────────────────
   10.3 BATCH DASHBOARD — status grid
   ────────────────────────────────────────────── */
.aae-batch-wrap {
  overflow-x: auto;
}
.aae-batch-table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 900px;
  font-size: .78rem;
  border: 1px solid var(--aae-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--aae-surface);
  width: 100%;
}
.aae-batch-table thead th {
  background: var(--aae-surface-alt);
  border-bottom: 1px solid var(--aae-border);
  padding: .45rem .6rem;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .7rem;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}
.aae-batch-table thead th:first-child {
  min-width: 160px;
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--aae-surface-alt);
}
.aae-batch-table tbody td {
  padding: .3rem .5rem;
  border-bottom: 1px solid var(--aae-border);
  vertical-align: middle;
}
.aae-batch-table tbody tr:last-child td { border-bottom: none; }
.aae-batch-table tbody td:first-child {
  font-weight: 500;
  color: #1a1a2e;
  background: var(--aae-surface);
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: 1px solid var(--aae-border);
}
.aae-batch-kw-link {
  color: var(--aae-accent);
  text-decoration: none;
  font-weight: 500;
}
.aae-batch-kw-link:hover { text-decoration: underline; }

/* Cell status dot */
.aae-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}
.aae-status-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .68rem;
  font-weight: 700;
}
.aae-status-dot--confirmed { background: var(--aae-success-bg); color: var(--aae-success); }
.aae-status-dot--running   { background: var(--aae-running-bg); color: var(--aae-running); animation: aae-pulse 1.2s infinite; }
.aae-status-dot--failed    { background: var(--aae-error-bg);   color: var(--aae-error); }
.aae-status-dot--locked    { background: var(--aae-locked-bg);  color: var(--aae-locked); }
.aae-status-dot--ready     { background: var(--aae-accent-light); color: var(--aae-accent); }
.aae-status-dot--empty     { background: #f1f5f9; color: #cbd5e1; }

/* Batch header toolbar */
.aae-batch-toolbar {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}

/* Polling indicator */
.aae-polling-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--aae-success);
  animation: aae-pulse 1.8s infinite;
  margin-right: .3rem;
}
.aae-polling-dot.paused { background: var(--aae-locked); animation: none; }

/* Responsive overrides */
@media (max-width: 767px) {
  .aae-log-table-header { display: none; }
  .aae-log-row-compact {
    grid-template-columns: 1fr 60px 36px;
  }
  .aae-log-version,
  .aae-log-time { display: none; }

  .aae-chips-bar { gap: .25rem; }
  .aae-chip { font-size: .7rem; }

  .aae-stats-bar { flex-direction: column; align-items: flex-start; gap: .4rem; }
}

/* =============================================================================
   PHASE 11 — Admin row-card design system
   Aesthetic: Industrial Command Center — dense accordion rows, monospace IDs,
   sharp borders. Matches brandmaster.rcdmkt.com/admin/prompts.
   ============================================================================= */

/* ── Design tokens (Phase 11) ──────────────────────────────────────────────── */
:root {
  --ae-row-bg:          #ffffff;
  --ae-row-bg-hover:    #f7f8fc;
  --ae-row-border:      #e2e5ec;
  --ae-row-expanded-bg: #f0f3fb;
  --ae-accent:          #3b5bdb;
  --ae-accent-hover:    #2f4ac5;
  --ae-danger:          #e03131;
  --ae-warn:            #e67700;
  --ae-success:         #2f9e44;
  --ae-muted:           #868e96;
  --ae-mono:            "JetBrains Mono", "Courier New", monospace;
  --ae-row-h:           48px;
  --ae-transition:      0.18s ease;
  --ae-radius:          6px;
  --ae-drag-shadow:     0 4px 16px rgba(59, 91, 219, 0.25);
  --ae-section-border:  2px solid #dee2ef;
  --ae-chip-h:          22px;
}

/* ── Admin page shell ──────────────────────────────────────────────────────── */
.ae-admin-page { font-family: system-ui, sans-serif; }

.ae-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.875rem;
  border-bottom: var(--ae-section-border);
}

.ae-page-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0;
  letter-spacing: -0.01em;
}

.ae-page-header .ae-header-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Filter bar (Phase 11) ─────────────────────────────────────────────────── */
.ae-filter-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.625rem 0.875rem;
  background: #f0f2f8;
  border: 1px solid var(--ae-row-border);
  border-radius: var(--ae-radius);
  margin-bottom: 0.875rem;
  font-size: 0.83rem;
}

.ae-filter-bar label {
  color: var(--ae-muted);
  font-weight: 600;
  margin-bottom: 0;
  white-space: nowrap;
}

.ae-filter-bar select,
.ae-filter-bar input[type="text"] {
  font-size: 0.82rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #ced4da;
  height: 30px;
  min-width: 120px;
}

/* ── Row-card list container ───────────────────────────────────────────────── */
.ae-row-list {
  border: 1px solid var(--ae-row-border);
  border-radius: var(--ae-radius);
  overflow: hidden;
  background: var(--ae-row-bg);
}

/* ── Single row card ───────────────────────────────────────────────────────── */
.ae-row-card {
  border-bottom: 1px solid var(--ae-row-border);
  transition: background var(--ae-transition);
}
.ae-row-card:last-child { border-bottom: none; }

/* Compressed header row */
.ae-row-head {
  display: flex;
  align-items: center;
  min-height: var(--ae-row-h);
  padding: 0 0.875rem;
  gap: 0.625rem;
  cursor: pointer;
  user-select: none;
  transition: background var(--ae-transition);
}
.ae-row-head:hover { background: var(--ae-row-bg-hover); }
.ae-row-card.is-expanded .ae-row-head {
  background: #e8ecf8;
  border-bottom: 1px solid #c5cde8;
}

/* Drag handle */
.ae-drag-handle {
  cursor: grab;
  color: #adb5bd;
  font-size: 1rem;
  padding: 0 0.25rem;
  flex-shrink: 0;
}
.ae-drag-handle:active { cursor: grabbing; }

.ae-row-card.sortable-drag {
  box-shadow: var(--ae-drag-shadow);
  opacity: 0.9;
  border-radius: var(--ae-radius);
}
.ae-row-card.sortable-ghost {
  opacity: 0.35;
  background: #dce4ff;
}

/* Order number */
.ae-order-num {
  font-family: var(--ae-mono);
  font-size: 0.75rem;
  color: var(--ae-muted);
  min-width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* Tab ID chip */
.ae-tab-id {
  font-family: var(--ae-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ae-accent);
  background: #eef1ff;
  border: 1px solid #c5cde8;
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Branch badge */
.ae-branch-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ae-branch-badge.b2b-category { background: #fff3bf; color: #7c5900; }
.ae-branch-badge.b2b-product  { background: #d3f9d8; color: #1a5c2d; }
.ae-branch-badge.b2b-article  { background: #dbe4ff; color: #1c3079; }
.ae-branch-badge.b2b-solution { background: #fce4ec; color: #7b1534; }

/* Version chip */
.ae-version-chip {
  font-family: var(--ae-mono);
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 10px;
  border: 1px solid;
  white-space: nowrap;
  flex-shrink: 0;
  height: var(--ae-chip-h);
  display: inline-flex;
  align-items: center;
}
.ae-version-chip.active     { color: #1c5c2e; background: #d3f9d8; border-color: #8ce9a4; }
.ae-version-chip.superseded { color: #5c4a00; background: #fff3bf; border-color: #ffd43b; }
.ae-version-chip.deprecated { color: #7b2424; background: #ffe0e0; border-color: #ff8787; }
.ae-version-chip.clickable  { cursor: pointer; transition: box-shadow 0.15s; }
.ae-version-chip.clickable:hover { box-shadow: 0 0 0 2px var(--ae-accent); }

/* Row summary text */
.ae-row-summary {
  flex: 1;
  font-size: 0.82rem;
  color: #495057;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Expand arrow */
.ae-expand-arrow {
  flex-shrink: 0;
  color: var(--ae-muted);
  font-size: 0.85rem;
  transition: transform var(--ae-transition);
  margin-left: auto;
  padding: 0.25rem;
}
.ae-row-card.is-expanded .ae-expand-arrow {
  transform: rotate(180deg);
  color: var(--ae-accent);
}

/* Row action buttons */
.ae-row-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}
.ae-row-actions .btn {
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  line-height: 1.4;
}

/* ── Expanded body ─────────────────────────────────────────────────────────── */
.ae-row-body {
  display: none;
  padding: 1rem 1.125rem 1.125rem;
  background: var(--ae-row-expanded-bg);
  border-top: 1px solid #c5cde8;
}
.ae-row-card.is-expanded .ae-row-body { display: block; }

/* Meta row inside expanded */
.ae-meta-row {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.875rem;
  font-size: 0.8rem;
  color: var(--ae-muted);
}
.ae-meta-row strong { color: #343a40; }

/* Version history strip */
.ae-version-history {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  align-items: center;
}
.ae-version-history-label {
  font-size: 0.75rem;
  color: var(--ae-muted);
  font-weight: 600;
}

/* ── Three-block prompt editors ────────────────────────────────────────────── */
.ae-editor-block {
  background: #fff;
  border: 1px solid #d4d9ef;
  border-radius: var(--ae-radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.ae-editor-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.875rem;
  background: #eef1ff;
  border-bottom: 1px solid #d4d9ef;
  font-size: 0.8rem;
  font-weight: 600;
  color: #2c3e6e;
}
.ae-editor-block textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: vertical;
  font-family: var(--ae-mono);
  font-size: 0.78rem;
  line-height: 1.55;
  padding: 0.625rem 0.875rem;
  color: #212529;
  background: #fff;
  min-height: 90px;
}
.ae-editor-block textarea:focus {
  background: #fdfeff;
  box-shadow: inset 0 0 0 2px #c5cde8;
}

/* ── Body action strip ─────────────────────────────────────────────────────── */
.ae-body-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.875rem;
  padding-top: 0.75rem;
  border-top: 1px solid #d4d9ef;
}

/* ── Diff viewer ───────────────────────────────────────────────────────────── */
.ae-diff-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--ae-row-border);
  border-radius: var(--ae-radius);
  overflow: hidden;
  font-family: var(--ae-mono);
  font-size: 0.76rem;
  line-height: 1.6;
}
.ae-diff-pane { padding: 0.75rem; background: #fff; overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
.ae-diff-pane.left { border-right: 1px solid var(--ae-row-border); }
.ae-diff-pane-header { font-family: system-ui; font-size: 0.75rem; font-weight: 600; padding: 0.4rem 0.75rem; border-bottom: 1px solid var(--ae-row-border); }
.ae-diff-pane-header.left  { background: #ffe0e0; color: #7b2424; }
.ae-diff-pane-header.right { background: #d3f9d8; color: #1c5c2e; }
.ae-diff-del { background: #ffe0e0; color: #7b2424; display: block; }
.ae-diff-ins { background: #d3f9d8; color: #1c5c2e; display: block; }

/* ── Boards toolbar + footer ───────────────────────────────────────────────── */
.ae-boards-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.625rem 0.875rem;
  background: #f0f2f8;
  border: 1px solid var(--ae-row-border);
  border-radius: var(--ae-radius);
  margin-bottom: 0.875rem;
}
.ae-boards-footer {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
  padding-top: 0.875rem;
  border-top: var(--ae-section-border);
  margin-top: 0.875rem;
}

/* ── Usage panel ───────────────────────────────────────────────────────────── */
.ae-usage-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.ae-stat-box {
  background: #fff;
  border: 1px solid var(--ae-row-border);
  border-radius: var(--ae-radius);
  padding: 0.875rem 1rem;
  text-align: center;
}
.ae-stat-box .ae-stat-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ae-accent);
  font-family: var(--ae-mono);
  display: block;
}
.ae-stat-box .ae-stat-label {
  font-size: 0.75rem;
  color: var(--ae-muted);
  margin-top: 0.2rem;
}
.ae-cost-warn { color: var(--ae-danger) !important; font-weight: 700; }
.ae-chart-wrapper {
  background: #fff;
  border: 1px solid var(--ae-row-border);
  border-radius: var(--ae-radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

/* ── Import page ───────────────────────────────────────────────────────────── */
.ae-import-drop-zone {
  border: 2px dashed #adb5bd;
  border-radius: var(--ae-radius);
  padding: 2.5rem 2rem;
  text-align: center;
  color: var(--ae-muted);
  cursor: pointer;
  transition: border-color var(--ae-transition), background var(--ae-transition);
  background: #fafbff;
}
.ae-import-drop-zone:hover,
.ae-import-drop-zone.dragover {
  border-color: var(--ae-accent);
  background: #eef1ff;
  color: var(--ae-accent);
}
.ae-mapping-table thead th {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ae-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: #f0f2f8;
}
.ae-mapping-table td {
  font-size: 0.82rem;
  vertical-align: middle;
  font-family: var(--ae-mono);
}

/* ── Markdown preview ──────────────────────────────────────────────────────── */
.ae-md-preview {
  background: #fff;
  border: 1px solid #d4d9ef;
  border-radius: var(--ae-radius);
  padding: 0.75rem 1rem;
  font-size: 0.83rem;
  min-height: 80px;
  line-height: 1.7;
  color: #343a40;
}
.ae-md-preview h1, .ae-md-preview h2, .ae-md-preview h3 {
  font-size: 1em;
  font-weight: 700;
  margin-top: 0.5em;
  margin-bottom: 0.25em;
  color: #1a1a2e;
}
.ae-md-preview ul, .ae-md-preview ol { padding-left: 1.25em; margin-bottom: 0.5em; }

/* ── Version bump badge ────────────────────────────────────────────────────── */
.ae-version-bump-badge {
  display: inline-block;
  font-family: var(--ae-mono);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-left: 0.5rem;
}
.ae-version-bump-badge.patch { background: #d3f9d8; color: #1c5c2e; }
.ae-version-bump-badge.minor { background: #fff3bf; color: #7c5900; }
.ae-version-bump-badge.major { background: #ffe0e0; color: #7b2424; }

/* ── Add-new row ───────────────────────────────────────────────────────────── */
.ae-add-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.875rem;
  color: var(--ae-accent);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  border-top: 1px dashed #c5cde8;
  transition: background var(--ae-transition);
}
.ae-add-row:hover { background: #eef1ff; }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
#ae-toast-area {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.ae-toast {
  background: #1a1a2e;
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: var(--ae-radius);
  font-size: 0.82rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  pointer-events: auto;
  animation: ae-toast-in 0.2s ease;
  max-width: 320px;
}
.ae-toast.success { border-left: 3px solid var(--ae-success); }
.ae-toast.error   { border-left: 3px solid var(--ae-danger); }
.ae-toast.info    { border-left: 3px solid var(--ae-accent); }
@keyframes ae-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Loading skeleton (Phase 11) ───────────────────────────────────────────── */
.ae-skeleton-line {
  background: linear-gradient(90deg, #e9ecef 25%, #f8f9fa 50%, #e9ecef 75%);
  background-size: 200% 100%;
  animation: aae-shimmer 1.4s infinite;
  border-radius: 4px;
  height: 14px;
  display: block;
  margin-bottom: 6px;
}

/* ── Error / empty states ──────────────────────────────────────────────────── */
.ae-error-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--ae-muted);
}
.ae-error-state .ae-error-icon { font-size: 2rem; color: var(--ae-danger); display: block; margin-bottom: 0.5rem; }

/* ── Phase 11 responsive ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .ae-diff-container    { grid-template-columns: 1fr; }
  .ae-diff-pane.left    { border-right: none; border-bottom: 1px solid var(--ae-row-border); }
  .ae-usage-summary     { grid-template-columns: 1fr 1fr; }
  .ae-row-head          { gap: 0.375rem; padding: 0 0.5rem; }
  .ae-row-summary       { display: none; }
}
@media (max-width: 480px) {
  .ae-usage-summary  { grid-template-columns: 1fr; }
  .ae-body-actions   { gap: 0.375rem; }
  .ae-body-actions .btn { font-size: 0.72rem; }
}
