* {
  box-sizing: border-box;
}

:root {
  --wiz-blue: #3b82f6;
  --wiz-blue-light: #60a5fa;
  --wiz-blue-dim: #1d4ed8;
  --wiz-emerald: #10b981;
  --wiz-emerald-dim: #059669;
  --wiz-amber: #f59e0b;
  --wiz-red: #ef4444;

  --wiz-bg: #080c12;
  --wiz-bg-alt: #0c1018;
  --wiz-surface: #111827;
  --wiz-surface-2: #161d2b;
  --wiz-elevated: #1c2536;
  --wiz-elevated-2: #212d40;

  --wiz-border: #253550;
  --wiz-border-subtle: #162032;
  --wiz-border-muted: #0f1a27;

  --wiz-text-primary: #e8edf5;
  --wiz-text-secondary: #7a93b3;
  --wiz-text-muted: #445a73;
  --wiz-text-accent: #93c5fd;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow-blue: 0 0 0 1px rgba(59, 130, 246, 0.12), 0 8px 24px rgba(59, 130, 246, 0.1);
  --shadow-glow-green: 0 0 0 1px rgba(16, 185, 129, 0.14), 0 8px 24px rgba(16, 185, 129, 0.1);

  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --transition-fast: 120ms var(--ease-smooth);
  --transition-base: 180ms var(--ease-smooth);
  --transition-slow: 280ms var(--ease-out);

  /* ── Font scale ── */
  --wiz-font-xs: 0.72rem;
  /* labels, nav, badges, small meta */
  --wiz-font-sm: 0.8rem;
  /* body text, descriptions */
  --wiz-font-md: 0.87rem;
  /* emphasized body, record titles */
  --wiz-font-display: 1.5rem;
  /* landing titles, primary headings */
}

/* ── Scrollbars ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--wiz-border);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--wiz-elevated-2);
}

/* ── Base ── */
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Arial, sans-serif;
  background: var(--wiz-bg);
  color: var(--wiz-text-primary);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.wiz-page {
  background: var(--wiz-bg);
  color: var(--wiz-text-primary);
}

body.wiz-page::before {
  content: '';
  position: fixed;
  top: -30%;
  left: -15%;
  width: 70vw;
  height: 70vw;
  background: radial-gradient(ellipse, rgba(59, 130, 246, 0.12) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

body.wiz-page::after {
  content: '';
  position: fixed;
  bottom: -30%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(ellipse, rgba(16, 185, 129, 0.09) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

/* ── Topbar ── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  height: 52px;
  background: rgba(8, 12, 18, 0.9);
  color: var(--wiz-text-primary);
  border-bottom: 1px solid var(--wiz-border-muted);
}

body.wiz-page .topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  background: rgba(8, 12, 18, 0.82);
  border-bottom: 1px solid var(--wiz-border-subtle);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.topbar-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--wiz-blue);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.topbar h1 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--wiz-text-primary);
  letter-spacing: -0.01em;
  margin: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.topbar-sessions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.topbar-sessions-label {
  font-size: var(--wiz-font-xs);
  color: var(--wiz-text-muted);
  letter-spacing: 0.04em;
}

.topbar a {
  color: var(--wiz-text-secondary);
  text-decoration: none;
  font-size: var(--wiz-font-xs);
  transition: color var(--transition-fast);
}

.topbar a:hover {
  color: var(--wiz-text-accent);
}

/* ── Layout ── */
.container {
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

body.wiz-page .container {
  position: relative;
  z-index: 1;
}

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

/* ── Panels & Cards ── */
.panel,
.card {
  background: var(--wiz-surface);
  border: 1px solid var(--wiz-border);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

body.wiz-page .panel,
body.wiz-page .card {
  background: var(--wiz-surface);
  border: 1px solid var(--wiz-border);
  color: var(--wiz-text-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

body.wiz-page .card {
  border-left: 2px solid var(--wiz-blue);
}

body.wiz-page .panel:hover,
body.wiz-page .card:hover {
  border-color: var(--wiz-elevated-2);
  box-shadow: var(--shadow-lg);
}

/* ── Hero ── */
.hero-eyebrow {
  font-size: 0.67rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wiz-text-muted);
  margin-bottom: 0.3rem;
  font-weight: 700;
}

.hero h2 {
  margin: 0.2rem 0 0.7rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #e8edf5 30%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  color: var(--wiz-text-secondary);
  max-width: 70ch;
  font-size: 0.92rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.hero-meta span {
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #bdd5ff;
  background: rgba(59, 130, 246, 0.1);
  border-radius: var(--radius-pill);
  padding: 0.22rem 0.7rem;
  font-size: var(--wiz-font-xs);
  font-weight: 500;
}

/* ── TOC ── */
.wiz-toc {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.wiz-toc a {
  color: var(--wiz-text-accent);
  text-decoration: none;
  border: 1px solid var(--wiz-border);
  border-radius: var(--radius-pill);
  padding: 0.26rem 0.7rem;
  font-size: var(--wiz-font-sm);
  background: rgba(59, 130, 246, 0.07);
  transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.wiz-toc a:hover {
  border-color: var(--wiz-blue-light);
  background: rgba(59, 130, 246, 0.16);
  color: #c7dcff;
}

/* ── Landing title (portfolio / project / feature h3) ── */
body.wiz-page .panel>h3:first-child,
body.wiz-page .panel>h3:first-of-type {
  font-size: var(--wiz-font-display);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--wiz-text-primary);
  margin: 0 0 0.5rem;
  background: linear-gradient(135deg, #e8edf5 25%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.15;
}

/* ── Section Head ── */
.section-head h3 {
  margin-bottom: 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--wiz-text-primary);
  letter-spacing: -0.02em;
}

.section-head p {
  color: var(--wiz-text-secondary);
  font-size: var(--wiz-font-md);
}

/* ── Attention Grid ── */
.attention-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.attention-card {
  background: var(--wiz-elevated);
  border: 1px solid var(--wiz-border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  transition: border-color var(--transition-base), transform var(--transition-base);
}

.attention-card:hover {
  border-color: var(--wiz-elevated-2);
  transform: translateY(-1px);
}

.attention-card h4 {
  margin: 0 0 0.3rem;
  color: var(--wiz-text-secondary);
  font-size: var(--wiz-font-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.attention-value {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--wiz-text-primary);
  letter-spacing: -0.04em;
  line-height: 1;
}

.attention-meta {
  margin: 0.3rem 0 0;
  color: var(--wiz-text-muted);
  font-size: var(--wiz-font-xs);
}

/* ── Record List ── */
.record-list {
  display: grid;
  gap: 0.65rem;
}

.ui-artifact-grid {
  display: grid;
  gap: 0.85rem;
}

.ui-artifact-panel h4 {
  margin: 0 0 0.55rem;
}

.ui-artifact-card {
  border-left: 2px solid rgba(59, 130, 246, 0.35);
}

.record-card {
  border: 1px solid var(--wiz-border);
  border-left: 2px solid var(--wiz-blue);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  background: var(--wiz-surface-2);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.record-card:hover {
  border-color: var(--wiz-elevated-2);
  border-left-color: var(--wiz-blue-light);
  box-shadow: var(--shadow-sm);
}

.work-card-done.record-card {
  border-left-color: var(--wiz-border-subtle);
  opacity: 0.7;
}

.record-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
}

/* Put key and title on one row */
.record-head>div:first-child {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
  flex: 1;
}

.record-key {
  margin: 0;
  color: var(--wiz-text-muted);
  font-size: var(--wiz-font-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.record-head h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--wiz-text-primary);
  letter-spacing: -0.01em;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.panel-collapse-body {
  min-width: 0;
}

.panel-collapse-body * {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ── Badges ── */
.record-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.badge {
  border-radius: var(--radius-pill);
  padding: 0.16rem 0.52rem;
  border: 1px solid var(--wiz-border);
  font-size: var(--wiz-font-xs);
  font-weight: 500;
  text-transform: lowercase;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.badge-required {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fcd9a0;
}

.badge-recommended {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
  color: #bdd4ff;
}

.badge-info,
.badge-severity {
  background: rgba(122, 147, 179, 0.12);
  border-color: rgba(122, 147, 179, 0.28);
  color: #c4d0e0;
}

.badge-idle {
  background: rgba(122, 147, 179, 0.1);
  border-color: rgba(122, 147, 179, 0.32);
  color: #a8b8cc;
}

.badge-stale {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f8a5a5;
}

/* ── Record Detail ── */
.record-summary {
  margin: 0.5rem 0 0.3rem;
  color: #dde6f0;
  font-size: var(--wiz-font-md);
  line-height: 1.5;
}

.record-card details {
  margin-top: 0.35rem;
}

.record-card summary {
  cursor: pointer;
  color: var(--wiz-text-accent);
  font-size: var(--wiz-font-sm);
  user-select: none;
  transition: color var(--transition-fast);
}

.record-card summary:hover {
  color: var(--wiz-blue-light);
}

.code-block {
  margin: 0.45rem 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--wiz-border-muted);
  border-radius: var(--radius-sm);
  background: rgba(4, 8, 14, 0.85);
  color: #c8d8f0;
  padding: 0.6rem 0.75rem;
  font-size: var(--wiz-font-sm);
  line-height: 1.55;
  font-family: 'JetBrains Mono', 'Fira Mono', 'Cascadia Code', monospace;
}

/* ── Design Assets ── */
.design-logo-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem 0 0.5rem;
  border-bottom: 1px solid var(--wiz-border-subtle);
  margin-bottom: 0.5rem;
}

.design-logo-img {
  max-height: 120px;
  max-width: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.design-css-form {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.5rem;
}

.design-css-textarea {
  width: 100%;
  font-family: 'JetBrains Mono', 'Fira Mono', monospace;
  font-size: var(--wiz-font-sm);
  line-height: 1.6;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--wiz-border);
  border-radius: var(--radius-sm);
  background: rgba(8, 12, 20, 0.9);
  color: var(--wiz-text-primary);
  resize: vertical;
  box-sizing: border-box;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.design-css-textarea:focus {
  outline: none;
  border-color: var(--wiz-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.design-css-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.design-css-status {
  font-size: var(--wiz-font-xs);
  color: var(--wiz-text-secondary);
  transition: color var(--transition-fast);
}

.design-css-status[data-state="ok"] {
  color: var(--wiz-emerald);
}

.design-css-status[data-state="error"] {
  color: var(--wiz-red);
}

.design-upload-form {
  margin-top: 0.65rem;
  border-top: 1px solid var(--wiz-border-subtle);
  padding-top: 0.6rem;
  display: grid;
  gap: 0.5rem;
}

/* ── Forms ── */
.work-item-form {
  margin-top: 0.65rem;
  border: 1px solid var(--wiz-border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  background: rgba(8, 12, 20, 0.8);
  display: grid;
  gap: 0.55rem;
}

.work-item-form textarea,
.work-item-form input,
.work-item-form select {
  width: 100%;
}

.work-item-form label {
  display: grid;
  gap: 0.25rem;
  color: var(--wiz-text-secondary);
  font-size: var(--wiz-font-sm);
  font-weight: 500;
}

.form-label {
  display: grid;
  gap: 0.25rem;
}

.form-input {
  width: 100%;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.45rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.form-req {
  color: var(--wiz-danger, #e05c5c);
}

.work-form-status {
  font-size: var(--wiz-font-xs);
  color: var(--wiz-text-secondary);
}

.design-upload-form label {
  display: grid;
  gap: 0.28rem;
  font-size: var(--wiz-font-sm);
  color: var(--wiz-text-secondary);
  font-weight: 500;
}

input,
select,
textarea {
  background: rgba(12, 18, 30, 0.85);
  border: 1px solid var(--wiz-border);
  border-radius: var(--radius-sm);
  color: var(--wiz-text-primary);
  padding: 0.42rem 0.55rem;
  font-size: var(--wiz-font-md);
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--wiz-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.design-upload-form input,
.design-upload-form select {
  border: 1px solid var(--wiz-border);
  border-radius: var(--radius-sm);
  background: rgba(12, 18, 30, 0.85);
  color: var(--wiz-text-primary);
  padding: 0.4rem 0.5rem;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.45rem;
}

.upload-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ── Asset Gallery ── */
.asset-gallery {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.6rem;
}

.asset-card {
  overflow: hidden;
}

.asset-preview {
  display: block;
  max-width: 100%;
  max-height: 190px;
  border: 1px solid var(--wiz-border-subtle);
  border-radius: var(--radius-sm);
  margin-top: 0.45rem;
  object-fit: contain;
  background: rgba(4, 8, 14, 0.8);
}

/* ── Kickoff ── */
.kickoff-profile-label {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.55rem;
  color: var(--wiz-text-secondary);
  font-size: var(--wiz-font-sm);
  font-weight: 500;
}

.kickoff-profile-label select {
  border: 1px solid var(--wiz-border);
  border-radius: var(--radius-sm);
  background: rgba(12, 18, 30, 0.85);
  color: var(--wiz-text-primary);
  padding: 0.38rem 0.48rem;
}

.kickoff-freshness {
  margin-top: 0.55rem;
  border: 1px solid var(--wiz-border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(10, 14, 22, 0.7);
  padding: 0.5rem 0.65rem;
}

/* ── Chips ── */
.freshness-chip {
  display: inline-block;
  border-radius: var(--radius-pill);
  border: 1px solid var(--wiz-border);
  padding: 0.13rem 0.5rem;
  font-size: var(--wiz-font-xs);
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.freshness-chip.is-fresh {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #a7f3d0;
}

.freshness-chip.is-mixed {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fde68a;
}

.freshness-chip.is-stale,
.freshness-chip.is-unknown {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

/* ── Buttons ── */
.inline-action {
  margin-top: 0.55rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.1);
  color: #bdd4ff;
  border-radius: var(--radius-sm);
  padding: 0.32rem 0.65rem;
  cursor: pointer;
  font-size: var(--wiz-font-sm);
  font-family: inherit;
  font-weight: 500;
  transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.inline-action:hover {
  border-color: var(--wiz-blue-light);
  background: rgba(59, 130, 246, 0.2);
  color: #d4e6ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.inline-action:active {
  transform: translateY(0);
  box-shadow: none;
}

.record-actions {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}

.record-actions .inline-action {
  margin-top: 0;
}

.panel-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.panel-action-row h3 {
  margin: 0;
}

.inline-action--danger {
  color: var(--wiz-danger, #e05c5c);
  border-color: var(--wiz-danger, #e05c5c);
}

.inline-action--danger:hover {
  background: rgba(224, 92, 92, 0.12);
}

.inline-action--muted {
  opacity: 0.65;
}

/* ── Work Grouping ── */
.work-group-shell {
  border: 1px solid var(--wiz-border-subtle);
  border-radius: var(--radius-md);
  background: rgba(7, 11, 18, 0.58);
  padding: 0.62rem;
  display: grid;
  gap: 0.6rem;
}

.work-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  border: none;
  border-left: 3px solid var(--wiz-border);
  border-radius: 0;
  padding: 0.2rem 0 0.2rem 0.6rem;
  background: transparent;
}

.work-group-header h5 {
  margin: 0;
  font-size: var(--wiz-font-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--wiz-text-secondary);
}

.work-group-header p {
  display: none;
}

.work-group-items {
  display: grid;
  gap: 0.55rem;
}

.work-group-show-more {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.3rem 0.6rem;
  background: transparent;
  border: 1px dashed var(--wiz-border);
  border-radius: var(--radius-sm);
  color: var(--wiz-text-secondary);
  font-size: var(--wiz-font-xs);
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}

.work-group-show-more:hover {
  border-color: var(--wiz-blue);
  color: var(--wiz-text-accent);
  background: rgba(59, 130, 246, 0.06);
}

.work-group-header.tone-integrity {
  border-left-color: rgba(59, 130, 246, 0.6);
}

.work-group-header.tone-risk {
  border-left-color: rgba(245, 158, 11, 0.6);
}

.work-group-header.tone-expansion {
  border-left-color: rgba(16, 185, 129, 0.6);
}

.work-group-header.tone-refactor {
  border-left-color: rgba(168, 85, 247, 0.6);
}

.work-group-header.tone-cleanup {
  border-left-color: rgba(148, 163, 184, 0.45);
}

.badge-execution-group {
  text-transform: none;
}

.badge-execution-group.tone-integrity {
  background: rgba(59, 130, 246, 0.13);
  border-color: rgba(59, 130, 246, 0.34);
  color: #bdd4ff;
}

.badge-execution-group.tone-risk {
  background: rgba(245, 158, 11, 0.13);
  border-color: rgba(245, 158, 11, 0.36);
  color: #fde68a;
}

.badge-execution-group.tone-expansion {
  background: rgba(16, 185, 129, 0.13);
  border-color: rgba(16, 185, 129, 0.34);
  color: #a7f3d0;
}

.badge-execution-group.tone-refactor {
  background: rgba(168, 85, 247, 0.13);
  border-color: rgba(168, 85, 247, 0.32);
  color: #e9d5ff;
}

.badge-execution-group.tone-cleanup {
  background: rgba(148, 163, 184, 0.13);
  border-color: rgba(148, 163, 184, 0.28);
  color: #dbe6f4;
}

/* ── Work History ── */
.work-history-list {
  margin-top: 0.45rem;
  display: grid;
  gap: 0.4rem;
}

.work-history-entry {
  border: 1px solid var(--wiz-border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.6rem;
  background: rgba(6, 10, 17, 0.7);
  font-size: var(--wiz-font-sm);
}

/* ── Retrieval Pack ── */
.retrieval-pack {
  margin-top: 0.8rem;
  border-top: 1px solid var(--wiz-border-subtle);
  padding-top: 0.7rem;
}

.retrieval-pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.55rem;
  margin-top: 0.55rem;
}

.retrieval-group {
  border: 1px solid var(--wiz-border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(7, 11, 18, 0.75);
  padding: 0.5rem 0.6rem;
}

.retrieval-group h5 {
  margin: 0 0 0.35rem;
  color: var(--wiz-text-accent);
  font-size: var(--wiz-font-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.retrieval-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.retrieval-group li {
  display: grid;
  gap: 0.2rem;
}

.retrieval-group code {
  display: block;
  border: 1px solid var(--wiz-border-muted);
  border-radius: 6px;
  background: rgba(4, 8, 14, 0.85);
  color: #c4d4f0;
  padding: 0.22rem 0.38rem;
  font-size: var(--wiz-font-xs);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'JetBrains Mono', 'Fira Mono', monospace;
}

.retrieval-copy-block {
  margin-top: 0.55rem;
  max-height: 180px;
  overflow: auto;
}

/* ── Portable Prompt ── */
.portable-prompt-card {
  border-color: rgba(59, 130, 246, 0.3);
  background: var(--wiz-elevated);
}

.portable-prompt-hints {
  margin-top: 0.45rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.36rem;
}

.portable-prompt-preview {
  margin-top: 0.65rem;
  max-height: 360px;
  overflow: auto;
  font-size: var(--wiz-font-xs);
  line-height: 1.5;
  border-color: rgba(59, 130, 246, 0.2);
}

/* ── Session Card ── */
.session-card {
  border-color: rgba(16, 185, 129, 0.3);
  background: linear-gradient(160deg, rgba(8, 20, 22, 0.9) 0%, rgba(7, 14, 18, 0.88) 100%);
}

.session-list {
  margin: 0.3rem 0 0.5rem;
  padding-left: 1rem;
  color: var(--wiz-text-accent);
  font-size: var(--wiz-font-sm);
}

.session-list li {
  margin: 0.2rem 0;
}

.session-checkout-panel {
  margin-top: 0.65rem;
  border-top: 1px solid var(--wiz-border-subtle);
  padding-top: 0.55rem;
}

.session-checkout-form {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.55rem;
}

.session-checkout-form textarea {
  width: 100%;
  border: 1px solid var(--wiz-border);
  border-radius: var(--radius-sm);
  background: rgba(14, 20, 32, 0.88);
  color: var(--wiz-text-primary);
  padding: 0.48rem 0.58rem;
  font-family: inherit;
  font-size: var(--wiz-font-md);
  resize: vertical;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.session-checkout-form textarea:focus {
  outline: none;
  border-color: var(--wiz-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.session-checkout-form select {
  width: 100%;
  border: 1px solid var(--wiz-border);
  border-radius: var(--radius-sm);
  background: rgba(14, 20, 32, 0.88);
  color: var(--wiz-text-primary);
  padding: 0.48rem 0.58rem;
  font-family: inherit;
  font-size: var(--wiz-font-md);
}

/* ── Next Agent Brief ── */
.next-agent-brief-panel {
  margin-top: 0.65rem;
  border-top: 1px solid var(--wiz-border-subtle);
  padding-top: 0.55rem;
}

.next-agent-brief-details p {
  white-space: pre-wrap;
  font-size: var(--wiz-font-md);
  color: var(--wiz-text-secondary);
}

.compact-diary-block {
  margin: 0.2rem 0 0.5rem;
  max-height: 200px;
  overflow: auto;
}

/* ── Timeline ── */
.timeline-shell {
  position: relative;
  margin-top: 0.6rem;
}

.timeline-focus-band {
  position: absolute;
  pointer-events: none;
  border: 1px solid rgba(96, 165, 250, 0.12);
  background: rgba(96, 165, 250, 0.05);
  box-shadow: inset 0 0 20px rgba(96, 165, 250, 0.05);
  border-radius: var(--radius-md);
  z-index: 0;
}

.timeline-shell-vertical {
  padding-left: 1rem;
}

.timeline-shell-vertical .timeline-focus-band {
  left: 1.2rem;
  right: 0.25rem;
  top: 46%;
  height: 54px;
  transform: translateY(-50%);
}

.timeline-shell-horizontal {
  overflow-x: auto;
  padding-bottom: 0.35rem;
}

.timeline-shell-horizontal .timeline-focus-band {
  top: 1.35rem;
  bottom: 0.2rem;
  left: 50%;
  width: min(220px, 42%);
  transform: translateX(-50%);
}

.timeline-track {
  position: absolute;
  background: rgba(59, 130, 246, 0.18);
}

.timeline-shell-vertical .timeline-track {
  left: 0.28rem;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: var(--radius-pill);
}

.timeline-shell-horizontal .timeline-track {
  left: 0;
  right: 0;
  top: 1.05rem;
  height: 2px;
}

.timeline-progress {
  background: linear-gradient(180deg, var(--wiz-emerald) 0%, #38bdf8 100%);
  border-radius: var(--radius-pill);
}

.timeline-shell-vertical .timeline-progress {
  width: 100%;
  height: 0%;
  transition: height 200ms var(--ease-out);
}

.timeline-shell-horizontal .timeline-progress {
  height: 100%;
  width: 0%;
  transition: width 200ms var(--ease-out);
}

.timeline-items {
  position: relative;
  display: grid;
  gap: 0.6rem;
}

.timeline-shell-horizontal .timeline-items {
  grid-auto-flow: column;
  grid-auto-columns: minmax(320px, 420px);
  align-items: start;
  padding-top: 1.5rem;
  gap: 0.75rem;
}

.timeline-item {
  position: relative;
  border: 1px solid var(--wiz-border-subtle);
  border-radius: var(--radius-md);
  background: rgba(12, 18, 30, 0.88);
  padding: 0.4rem 0.55rem 0.55rem;
  transition: transform var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
  z-index: 1;
}

.timeline-item:hover {
  border-color: var(--wiz-border);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.timeline-item summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 0.5rem;
  align-items: start;
  user-select: none;
}

.timeline-item summary::-webkit-details-marker {
  display: none;
}

.timeline-dot {
  margin-top: 0.26rem;
  width: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--wiz-border);
  box-shadow: 0 0 0 2px rgba(12, 18, 30, 0.95);
  transition: background var(--transition-base), box-shadow var(--transition-base);
}

.timeline-item.is-active .timeline-dot {
  background: var(--wiz-emerald);
  box-shadow: 0 0 0 2px rgba(12, 18, 30, 0.95), 0 0 8px rgba(16, 185, 129, 0.5);
}

.timeline-item.is-active {
  transform: scale(1.012);
  border-color: rgba(16, 185, 129, 0.4);
  background: var(--wiz-elevated);
  box-shadow: var(--shadow-glow-green);
}

.timeline-headline {
  display: grid;
  gap: 0.18rem;
}

.timeline-stamp {
  color: var(--wiz-text-accent);
  font-size: var(--wiz-font-xs);
  font-weight: 500;
}

.timeline-meta {
  color: var(--wiz-text-muted);
  font-size: var(--wiz-font-xs);
}

.timeline-summary {
  color: var(--wiz-text-primary);
  font-size: var(--wiz-font-sm);
  line-height: 1.45;
}

.timeline-content {
  margin-top: 0.4rem;
  border-top: 1px solid var(--wiz-border-muted);
  padding-top: 0.4rem;
  color: var(--wiz-text-secondary);
  font-size: var(--wiz-font-sm);
}

.timeline-content p {
  margin: 0.2rem 0;
}

.path-to-revenue-panel {
  border-color: rgba(16, 185, 129, 0.25);
}

.path-to-revenue-timeline .timeline-item summary {
  grid-template-columns: 14px 1fr auto;
}

.path-to-revenue-content {
  display: grid;
  gap: 0.45rem;
}

.path-to-revenue-work-list {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.2rem;
}

.path-to-revenue-work-card {
  background: rgba(10, 15, 26, 0.72);
  border-color: var(--wiz-border-subtle);
}

/* ── Lifecycle Prompt ── */
.lifecycle-prompt-card {
  border-color: rgba(59, 130, 246, 0.3);
  background: var(--wiz-elevated);
}

.session-lifecycle-memory {
  margin-top: 0.6rem;
}

.session-lifecycle-memory>summary {
  cursor: pointer;
  color: var(--wiz-text-secondary);
  font-size: var(--wiz-font-sm);
  user-select: none;
  transition: color var(--transition-fast);
}

.session-lifecycle-memory>summary:hover {
  color: var(--wiz-text-primary);
}

.session-lifecycle-memory[open]>summary {
  color: var(--wiz-text-primary);
}

.session-lifecycle-memory>.record-card.lifecycle-prompt-card {
  margin-top: 0.45rem;
}

.lifecycle-prompt-block {
  margin-top: 0.45rem;
  max-height: 220px;
  overflow: auto;
}

/* ── Session Flags ── */
.session-flags-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.3rem 0.6rem;
  color: var(--wiz-text-secondary);
  font-size: var(--wiz-font-sm);
}

.session-flags-grid label {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

/* ── Record Details ── */
.record-details {
  margin-top: 0.4rem;
  border-top: 1px solid var(--wiz-border-subtle);
  padding-top: 0.45rem;
  color: var(--wiz-text-secondary);
  font-size: var(--wiz-font-sm);
}

.record-details p {
  margin: 0.25rem 0;
}

.record-details a {
  color: var(--wiz-text-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.record-details a:hover {
  color: var(--wiz-blue-light);
  text-decoration: underline;
}

/* ── Empty / Utility ── */
.empty-note {
  color: var(--wiz-text-muted);
  margin: 0;
  font-size: var(--wiz-font-md);
}

/* ── Hierarchy Shell ── */
.hierarchy-shell {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1rem;
}

.hierarchy-nav {
  position: sticky;
  top: 72px;
  display: grid;
  gap: 0.85rem;
  align-self: start;
  background: var(--wiz-surface);
  border: 1px solid var(--wiz-border);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  box-shadow: var(--shadow-md);
}

.hierarchy-block h3 {
  margin: 0.2rem 0 0.4rem;
  font-size: var(--wiz-font-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--wiz-text-muted);
}

.nav-list {
  display: grid;
  gap: 0.38rem;
}

.nav-item {
  width: 100%;
  border: 1px solid var(--wiz-border);
  background: rgba(14, 20, 32, 0.85);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.7rem;
  color: var(--wiz-text-primary);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--wiz-font-md);
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.nav-item:hover {
  border-color: var(--wiz-blue-light);
  background: rgba(59, 130, 246, 0.14);
  transform: translateX(2px);
}

.nav-item.active {
  border-color: var(--wiz-blue);
  background: rgba(59, 130, 246, 0.18);
  box-shadow: var(--shadow-glow-blue);
}

.nav-item-root {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.35);
}

.nav-item-root:hover {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.55);
  transform: translateX(2px);
}

.nav-item-name {
  display: block;
  font-weight: 600;
  font-size: var(--wiz-font-md);
}

.nav-item small {
  color: var(--wiz-text-muted);
  font-size: var(--wiz-font-xs);
}

.hierarchy-content {
  min-width: 0;
}

.hierarchy-status-panel {
  margin-bottom: 0.9rem;
}

.hierarchy-path {
  margin: 0;
  font-weight: 600;
  font-size: var(--wiz-font-sm);
  color: var(--wiz-text-secondary);
}

#hierarchyStatus[data-type='ok'] {
  color: #6ee7b7;
}

#hierarchyStatus[data-type='error'] {
  color: #fca5a5;
}

#hierarchyStatus[data-type='loading'] {
  color: var(--wiz-text-accent);
}

/* ── Callout ── */
.callout {
  border-left: 2px solid var(--wiz-emerald) !important;
}

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
}

body.wiz-page table {
  border-radius: var(--radius-sm);
  overflow: hidden;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--wiz-border-subtle);
  padding: 0.55rem 0.65rem;
  font-size: var(--wiz-font-md);
}

body.wiz-page thead th {
  color: var(--wiz-text-accent);
  background: rgba(59, 130, 246, 0.08);
  font-weight: 600;
  font-size: var(--wiz-font-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

body.wiz-page tbody tr:hover {
  background: rgba(59, 130, 246, 0.05);
}

body.wiz-page small {
  color: var(--wiz-text-secondary);
  font-size: var(--wiz-font-sm);
}

/* ── Snapshot Panel ── */
.snapshot-panel {
  margin-bottom: 1.25rem;
}

.snapshot-panel--idle {
  padding: 0.5rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: transparent;
  border-color: var(--wiz-border-muted);
  box-shadow: none;
  margin-bottom: 0.75rem;
}

.snapshot-panel--idle .snapshot-header {
  margin-bottom: 0;
  flex-shrink: 0;
}

.snapshot-panel--idle .snapshot-body {
  min-height: unset;
}

.snapshot-idle-note {
  margin: 0;
  font-size: var(--wiz-font-xs);
  color: var(--wiz-text-muted);
}

.snapshot-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
}

.snapshot-title {
  margin: 0;
  font-size: var(--wiz-font-xs);
  font-weight: 700;
  color: var(--wiz-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.snapshot-body {
  min-height: 2.5rem;
}

.snapshot-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 0.75rem;
}

.snapshot-card {
  min-width: 0;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-left: 2px solid rgba(59, 130, 246, 0.5);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
}

.snapshot-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
  border-left-color: var(--wiz-blue);
  box-shadow: var(--shadow-glow-blue);
  transform: translateY(-1px);
}

/* ── Idle snapshot card (2h+ since last activity) ── */
.snapshot-card--idle {
  background: rgba(122, 147, 179, 0.05);
  border-color: rgba(122, 147, 179, 0.2);
  border-left-color: rgba(122, 147, 179, 0.45);
  opacity: 0.85;
}

.snapshot-card--idle:hover {
  border-left-color: rgba(122, 147, 179, 0.7);
  box-shadow: none;
  transform: none;
}

/* ── Stale snapshot card (12h+ since last activity, awaiting recovery) ── */
.snapshot-card--stale {
  background: rgba(239, 68, 68, 0.04);
  border-color: rgba(239, 68, 68, 0.18);
  border-left-color: rgba(239, 68, 68, 0.4);
  opacity: 0.72;
}

.snapshot-card--stale:hover {
  border-left-color: rgba(239, 68, 68, 0.6);
  box-shadow: none;
  transform: none;
}

.snapshot-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.snapshot-scope-label {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--wiz-text-primary);
}

.snapshot-elapsed {
  white-space: nowrap;
  font-size: var(--wiz-font-xs);
  font-variant-numeric: tabular-nums;
  color: var(--wiz-emerald);
  font-weight: 600;
}

.snapshot-meta {
  margin: 0;
  font-size: var(--wiz-font-xs);
  color: var(--wiz-text-muted);
}

.snapshot-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}

.snapshot-card-actions .inline-action {
  font-size: var(--wiz-font-xs);
  padding: 0.24rem 0.58rem;
  margin-top: 0;
}

.snapshot-jump-btn--primary {
  border-color: var(--wiz-blue-light);
  box-shadow: inset 0 0 0 1px rgba(91, 140, 245, 0.35);
}

.snapshot-checkout-btn--warn {
  border-color: rgba(245, 158, 11, 0.45);
  color: #fbbf24;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.18);
}

.snapshot-checkout-btn--warn:hover {
  border-color: rgba(245, 158, 11, 0.72);
  background: rgba(245, 158, 11, 0.12);
}

/* ── Snapshot focus row ── */
.snapshot-focus {
  margin: 0.4rem 0 0.3rem;
  padding: 0.4rem 0.5rem;
  background: var(--wiz-elevated);
  border-left: 3px solid var(--wiz-blue);
  border-radius: 4px;
}

.snapshot-focus-title {
  font-size: var(--wiz-font-sm);
  font-weight: 600;
  margin: 0.1rem 0 0.25rem;
  color: var(--wiz-text-primary);
}

/* ── Cold-start focus block (session panel) ── */
.cold-start-focus {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.7rem;
  background: var(--wiz-elevated);
  border-left: 3px solid var(--wiz-blue);
  border-radius: 4px;
}

.cold-start-focus-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0.15rem 0 0.3rem;
  color: var(--wiz-text-primary);
}

.cold-start-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.cold-start-switch-select {
  flex: 1;
  min-width: 0;
  font-size: var(--wiz-font-sm);
}

/* ── Document viewer ── */
.doc-viewer {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--wiz-bg-alt, #f8f8f8);
  border-left: 3px solid var(--wiz-accent, #4a8cff);
  border-radius: 4px;
  overflow-x: auto;
  font-size: var(--wiz-font-md);
  line-height: 1.6;
}

.doc-h {
  margin: 0.6rem 0 0.3rem;
  font-size: 0.95rem;
}

.doc-p {
  margin: 0.3rem 0;
}

.doc-list {
  margin: 0.3rem 0 0.3rem 1.2rem;
  padding: 0;
}

.doc-list li {
  margin: 0.15rem 0;
}

.doc-code-block {
  background: var(--wiz-bg-code, #1e1e1e);
  color: var(--wiz-text-code, #d4d4d4);
  padding: 0.6rem 0.8rem;
  border-radius: 4px;
  overflow-x: auto;
  font-size: var(--wiz-font-sm);
  margin: 0.4rem 0;
}

.doc-inline-code {
  background: var(--wiz-bg-alt, #f0f0f0);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: var(--wiz-font-sm);
  font-family: monospace;
}

.work-attachment-viewer {
  margin-top: 0.55rem;
  max-height: 320px;
  overflow: auto;
}

/* ── Architecture Profile Panel ── */
:root {
  --arch-blue: #60a5fa;
  --arch-emerald: #10b981;
  --arch-amber: #f59e0b;
  --arch-violet: #a78bfa;
  --arch-teal: #2dd4bf;
}

.arch-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Header */
.arch-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--wiz-surface-2);
  border: 1px solid var(--wiz-border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.arch-panel-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.arch-panel-name {
  font-size: var(--wiz-font-sm);
  font-weight: 700;
  color: var(--wiz-text-primary);
  letter-spacing: 0.03em;
}

.arch-panel-meta {
  font-size: var(--wiz-font-xs);
  color: var(--wiz-text-muted);
}

.arch-source-badge {
  font-size: var(--wiz-font-xs);
  padding: 0.15rem 0.5rem;
  background: rgba(96, 165, 250, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.25);
  border-radius: 20px;
  color: var(--arch-blue);
}

.arch-edit-toggle {
  flex-shrink: 0;
}

.arch-empty-note {
  margin: 0;
  padding: 1.25rem 1rem;
  font-size: var(--wiz-font-sm);
  color: var(--wiz-text-muted);
  background: var(--wiz-surface);
  border: 1px solid var(--wiz-border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* Section shared */
.arch-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
}

.arch-section-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.arch-section-label {
  font-size: var(--wiz-font-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.arch-section-count {
  margin-left: auto;
  font-size: var(--wiz-font-xs);
  color: var(--wiz-text-muted);
  font-variant-numeric: tabular-nums;
}

/* Section color variants */
.arch-section--blue .arch-section-dot {
  background: var(--arch-blue);
}

.arch-section--blue .arch-section-label {
  color: var(--arch-blue);
}

.arch-section--blue .arch-section-header {
  border-left: 3px solid var(--arch-blue);
}

.arch-section--emerald .arch-section-dot {
  background: var(--arch-emerald);
}

.arch-section--emerald .arch-section-label {
  color: var(--arch-emerald);
}

.arch-section--emerald .arch-section-header {
  border-left: 3px solid var(--arch-emerald);
}

.arch-section--amber .arch-section-dot {
  background: var(--arch-amber);
}

.arch-section--amber .arch-section-label {
  color: var(--arch-amber);
}

.arch-section--amber .arch-section-header {
  border-left: 3px solid var(--arch-amber);
}

.arch-section--violet .arch-section-dot {
  background: var(--arch-violet);
}

.arch-section--violet .arch-section-label {
  color: var(--arch-violet);
}

.arch-section--violet .arch-section-header {
  border-left: 3px solid var(--arch-violet);
}

.arch-section--teal .arch-section-dot {
  background: var(--arch-teal);
}

.arch-section--teal .arch-section-label {
  color: var(--arch-teal);
}

.arch-section--teal .arch-section-header {
  border-left: 3px solid var(--arch-teal);
}

/* Read view */
.arch-read-view {
  border: 1px solid var(--wiz-border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  overflow: hidden;
}

.arch-section {
  border-bottom: 1px solid var(--wiz-border-subtle);
}

.arch-section:last-child {
  border-bottom: none;
}

.arch-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 0 1rem 1rem;
}

.arch-field {
  padding: 0.6rem 0.75rem 0.6rem 0;
}

.arch-field--full {
  grid-column: 1 / -1;
}

.arch-field--half {
  grid-column: span 1;
}

.arch-field--empty {
  opacity: 0.45;
}

.arch-field-label {
  display: block;
  font-size: var(--wiz-font-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wiz-text-muted);
  margin-bottom: 0.2rem;
}

.arch-field-value {
  margin: 0;
  font-size: var(--wiz-font-sm);
  color: var(--wiz-text-secondary);
  line-height: 1.55;
  white-space: pre-wrap;
}

.arch-empty-chip {
  font-size: var(--wiz-font-xs);
  color: var(--wiz-text-muted);
  font-style: italic;
}

/* Edit form */
.arch-form {
  border: 1px solid var(--wiz-border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  overflow: hidden;
}

.arch-form-meta {
  padding: 0.75rem 1rem;
  background: var(--wiz-bg-alt);
  border-bottom: 1px solid var(--wiz-border-subtle);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.arch-source-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.arch-form-section {
  border-bottom: 1px solid var(--wiz-border-subtle);
}

.arch-form-section:last-of-type {
  border-bottom: none;
}

.arch-form-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  padding: 0.75rem 1rem 1rem;
}

.arch-form-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  grid-column: span 1;
}

.arch-form-label--full {
  grid-column: 1 / -1;
}

.arch-label-text {
  font-size: var(--wiz-font-xs);
  font-weight: 600;
  color: var(--wiz-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.arch-source-select,
.arch-textarea {
  background: var(--wiz-surface);
  border: 1px solid var(--wiz-border);
  border-radius: 6px;
  color: var(--wiz-text-primary);
  font-size: var(--wiz-font-sm);
  padding: 0.5rem 0.65rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.15s;
}

.arch-source-select {
  padding: 0.35rem 0.5rem;
}

.arch-textarea:focus,
.arch-source-select:focus {
  outline: none;
  border-color: var(--wiz-blue);
}

.arch-form-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--wiz-bg-alt);
  border-top: 1px solid var(--wiz-border-subtle);
}

/* Prefill indicators */
.arch-prefill-dot {
  color: var(--arch-violet);
  font-size: 0.6rem;
  vertical-align: middle;
  margin-left: 0.2rem;
}

.arch-textarea--prefilled {
  border-color: rgba(167, 139, 250, 0.4);
  background: rgba(167, 139, 250, 0.04);
}

/* Panel header actions */
.arch-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.arch-copy-prompt-btn {
  background: rgba(96, 165, 250, 0.08);
  border-color: rgba(96, 165, 250, 0.25);
  color: var(--arch-blue);
}

.arch-copy-prompt-btn:hover {
  background: rgba(96, 165, 250, 0.15);
}

.arch-btn--active {
  background: rgba(167, 139, 250, 0.12);
  border-color: rgba(167, 139, 250, 0.3);
  color: var(--arch-violet);
}

/* Paste zone */
.arch-paste-zone {
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-top: none;
  background: rgba(167, 139, 250, 0.04);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
}

.arch-paste-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.arch-paste-label {
  font-size: var(--wiz-font-xs);
  font-weight: 700;
  color: var(--arch-violet);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.arch-paste-hint {
  font-size: var(--wiz-font-xs);
  color: var(--wiz-text-muted);
}

.arch-paste-hint code {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  font-size: var(--wiz-font-xs);
}

.arch-paste-textarea {
  width: 100%;
  background: var(--wiz-surface);
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: 6px;
  color: var(--wiz-text-primary);
  font-size: var(--wiz-font-sm);
  font-family: inherit;
  padding: 0.6rem 0.75rem;
  line-height: 1.55;
  resize: vertical;
  transition: border-color 0.15s;
}

.arch-paste-textarea:focus {
  outline: none;
  border-color: var(--arch-violet);
}

.arch-paste-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.arch-apply-btn {
  background: rgba(167, 139, 250, 0.1);
  border-color: rgba(167, 139, 250, 0.3);
  color: var(--arch-violet);
}

.arch-apply-btn:hover {
  background: rgba(167, 139, 250, 0.18);
}

@media (max-width: 700px) {

  .arch-fields-grid,
  .arch-form-fields {
    grid-template-columns: 1fr;
  }

  .arch-field--half,
  .arch-form-label {
    grid-column: 1 / -1;
  }
}

/* ── Governance Panel ── */
.gov-panel {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--wiz-surface-2);
  border: 1px solid var(--wiz-border);
  border-left: 3px solid var(--wiz-blue);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.gov-panel-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.gov-label {
  font-size: var(--wiz-font-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--wiz-blue-light);
}

.gov-run-meta {
  font-size: var(--wiz-font-xs);
  color: var(--wiz-text-muted);
  margin-left: auto;
}

.gov-evals {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.gov-eval-row {
  display: grid;
  grid-template-columns: 10rem 7rem 1fr;
  gap: 0.5rem;
  font-size: var(--wiz-font-xs);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  align-items: start;
}

.gov-eval-pass {
  background: rgba(16, 185, 129, 0.07);
  border-left: 2px solid var(--wiz-emerald);
}

.gov-eval-warn {
  background: rgba(245, 158, 11, 0.08);
  border-left: 2px solid var(--wiz-amber);
}

.gov-eval-fail {
  background: rgba(239, 68, 68, 0.08);
  border-left: 2px solid var(--wiz-red);
}

.gov-eval-key {
  font-weight: 600;
  color: var(--wiz-text-accent);
}

.gov-eval-result {
  color: var(--wiz-text-secondary);
  text-transform: uppercase;
  font-size: var(--wiz-font-xs);
}

.gov-eval-rationale {
  color: var(--wiz-text-secondary);
}

.gov-diary-flag {
  font-size: var(--wiz-font-xs);
  color: var(--wiz-amber);
  margin: 0;
  padding: 0.2rem 0;
}

.gov-actions-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.gov-run-btn,
.gov-post-btn {
  font-size: var(--wiz-font-xs);
}

/* ── Brand Elements Panel ── */
.brand-elements-section {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--wiz-border-subtle);
}

.brand-elements-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.brand-elements-title {
  font-size: var(--wiz-font-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--wiz-text-muted);
}

.brand-elements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.brand-element-card {
  border: 1px solid var(--wiz-border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.7rem;
  background: var(--wiz-surface-1);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.brand-element-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem;
}

.brand-element-label {
  font-size: var(--wiz-font-xs);
  font-weight: 600;
  color: var(--wiz-text-primary);
}

.brand-element-size {
  font-size: 0.65rem;
  color: var(--wiz-text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.brand-element-desc {
  font-size: 0.7rem;
  color: var(--wiz-text-muted);
  line-height: 1.4;
  margin: 0;
  flex: 1;
}

.brand-copy-btn {
  align-self: flex-start;
  font-size: 0.68rem;
  padding: 2px 6px;
  cursor: pointer;
}

.brand-copy-status {
  font-size: 0.65rem;
  color: #4caf50;
  min-height: 1em;
}

.brand-palette-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.5rem 0 0.25rem;
}

.brand-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.brand-swatch-color {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0,0,0,0.12);
}

.brand-swatch-label {
  font-size: 0.62rem;
  color: var(--wiz-text-muted);
  text-align: center;
  font-family: var(--font-mono);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 1.4;
}

.brand-preview-details {
  margin-bottom: 0.75rem;
}

.brand-preview-iframe {
  width: 100%;
  height: 560px;
  border: 1px solid var(--wiz-border);
  border-radius: var(--radius-sm);
  display: block;
  margin-top: 0.4rem;
  background: #ededeb;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .hierarchy-shell {
    grid-template-columns: minmax(200px, 220px) minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .hierarchy-shell {
    grid-template-columns: 1fr;
  }

  .hierarchy-nav {
    position: static;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 1rem;
  }

  .hero h2 {
    font-size: 1.4rem;
  }
}