/* Aria Web UI — Light Modern SaaS Theme */

/* ── 1. Reset + Variables ───────────────────────────────────────────────── */

:root {
  --bg:             #F8F9FB;
  --surface:        #FFFFFF;
  --surface2:       #F1F3F7;
  --border:         #E2E6ED;
  --text:           #0F1923;
  --text-primary:   #0F1923;
  --text-secondary: #5A6478;
  --text-muted:     #9BA5B4;
  --accent:         #0057FF;
  --accent-hover:   #0046CC;
  --accent-light:   #EEF3FF;
  --accent2:        #16A34A;
  --success:        #16A34A;
  --success-light:  #DCFCE7;
  --warn:           #D97706;
  --warn-light:     #FEF3C7;
  --danger:         #DC2626;
  --danger-light:   #FEE2E2;
  --neutral:        #6B7280;
  --neutral-light:  #F3F4F6;
  --murphy:         #1D4ED8;
  --nov:            #059669;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:      0 12px 32px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.06);
  --radius:         6px;
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      16px;
  --font:           'DM Sans', sans-serif;
  --mono:           'JetBrains Mono', monospace;
}

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

/* ── 2. Base Typography ─────────────────────────────────────────────────── */

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Sora', sans-serif;
}

/* ── 3. Layout ──────────────────────────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-rows: 56px 1fr;
  grid-template-columns: 300px 1fr;
  grid-template-areas:
    "header header"
    "sidebar main";
  height: 100vh;
  overflow: hidden;
}

/* ── 4. Header + User Menu ──────────────────────────────────────────────── */

header {
  grid-area: header;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

header h1 {
  font-family: 'Sora', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.3px;
}

header .subtitle {
  color: var(--text-muted);
  font-size: 12px;
}

.status-pill {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.status-pill.running  { background: var(--success-light); color: var(--success); border-color: var(--success); }
.status-pill.complete { background: var(--accent-light);  color: var(--accent);  border-color: var(--accent); }
.status-pill.error    { background: var(--danger-light);  color: var(--danger);  border-color: var(--danger); }

/* User Menu */

.user-menu {
  margin-left: auto;
  position: relative;
}

.user-menu-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px 5px 12px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
  line-height: 1.2;
}

.user-menu-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.user-menu-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.user-menu-company {
  font-size: 10px;
  color: var(--text-muted);
}

.user-menu-caret {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--text-muted);
}

.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 140px;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.user-dropdown.open {
  display: block;
}

.user-dropdown-item {
  display: block;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s;
}

.user-dropdown-item:hover {
  background: var(--surface2);
}

.user-dropdown-signout {
  color: var(--danger);
}

/* ── 5. Sidebar ─────────────────────────────────────────────────────────── */

.sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
  width: 300px;
}

.sidebar h2 {
  font-family: 'Sora', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 10px;
  margin-top: 16px;
}
.sidebar h2:first-child { margin-top: 0; }

/* Form controls */
label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  margin-top: 10px;
  font-weight: 500;
}
label:first-of-type { margin-top: 0; }

select, input[type=number], input[type=text] {
  width: 100%;
  height: 40px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select:focus, input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.contract-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.contract-actions select { flex: 1; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #FFFFFF;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  height: 44px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: var(--shadow-md); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  font-size: 12px;
}
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

.btn-upload {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 10px;
  font-size: 12px;
  flex-shrink: 0;
}
.btn-upload:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* Stance hint */
.stance-hint {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}

/* Upload input hidden */
#fileInput { display: none; }

/* Playbook Builder button */
.btn-builder {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  font-size: 12px;
  font-family: 'Sora', sans-serif;
  font-weight: 500;
  border-radius: var(--radius);
}
.btn-builder:hover { background: var(--accent-light); }

/* Mode tab switcher (Quick Run / Send / Review) */

.mode-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  margin-bottom: 0;
  flex-shrink: 0;
}

.mode-tab {
  flex: 1;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 4px 4px 0 0;
  color: var(--text-secondary);
  font-family: 'Sora', sans-serif;
  font-size: 12px;
  white-space: nowrap;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.mode-tab:hover  { color: var(--text); background: var(--surface); }
.mode-tab.active {
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.mode-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: var(--text-muted);
}
.mode-divider::before,
.mode-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.mode-review-btn {
  display: block;
  width: 100%;
  height: 36px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  color: var(--accent);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 14px;
}
.mode-review-btn:hover { background: var(--accent-light); }
.mode-review-btn.active { background: var(--accent); color: #FFFFFF; border-color: var(--accent); }

/* Negotiation groups in sidebar */

.neg-group { display: flex; flex-direction: column; gap: 0; }

.neg-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  margin-bottom: 6px;
  margin-top: 2px;
}

.neg-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 500;
  flex-shrink: 0;
}

.pending-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  background: var(--warn-light);
  color: var(--warn);
  border: 1px solid var(--warn);
}

/* Session cards */

.session-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}
.session-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.session-tag { font-weight: 600; font-size: 13px; color: var(--text); }
.session-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.session-card-pending {
  border-color: var(--warn) !important;
}
.session-card-pending:hover { border-color: #b56b00 !important; }

.session-card-declined { opacity: 0.6; }

/* Send to Counterparty success banner */

.stc-success {
  background: var(--success-light);
  border: 1px solid var(--success);
  color: var(--success);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 12px;
  line-height: 1.5;
  margin-top: 10px;
}

.stc-prefill-note {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  margin-top: 4px;
  line-height: 1.5;
}

/* ── 6. Main Panel (Tabs, Panels) ───────────────────────────────────────── */

main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.tabs {
  display: flex;
  gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  flex-shrink: 0;
}

.tab {
  padding: 12px 16px;
  font-size: 13px;
  font-family: 'Sora', sans-serif;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  user-select: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--surface2);
  font-size: 11px;
  margin-left: 5px;
  color: var(--text-muted);
}
.tab.active .tab-badge { background: var(--accent-light); color: var(--accent); }

.panels {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.panel {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 16px;
}
.panel.active { display: block; }

/* ── 13. Review Drop Zone ───────────────────────────────────────────────── */

.rv-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--surface2);
  margin-bottom: 6px;
}
.rv-drop-zone:hover,
.rv-drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}
.rv-drop-icon   { font-size: 28px; margin-bottom: 4px; }
.rv-drop-label  { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.rv-drop-sublabel { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.rv-drop-file {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 0;
}
.rv-drop-remove {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  margin-left: 6px;
}

/* ── 7. Progress Log ────────────────────────────────────────────────────── */

.log-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  height: calc(100% - 32px);
  overflow-y: auto;
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  scroll-behavior: smooth;
  box-shadow: var(--shadow-sm);
}

.log-entry {
  padding: 4px 8px;
  line-height: 1.6;
  border-bottom: 1px solid transparent;
  border-radius: 3px;
}

.log-entry.round-header {
  color: var(--neutral);
  font-weight: 600;
  margin-top: 12px;
  border-bottom-color: var(--border);
  padding-bottom: 4px;
  margin-bottom: 4px;
  border-left: 3px solid var(--neutral);
  padding-left: 10px;
}
.log-entry.agent-murphy { color: var(--murphy); }
.log-entry.agent-nov    { color: var(--nov); }
.log-entry.status       { color: var(--text-muted); font-style: italic; }
.log-entry.info         { color: var(--warn); }
.log-entry.error        { color: var(--danger); border-left: 3px solid var(--danger); padding-left: 10px; }
.log-entry.complete     { color: var(--success); font-weight: 600; margin-top: 12px; border-left: 3px solid var(--success); padding-left: 10px; }
.log-entry.thinking     { color: var(--text-muted); font-style: italic; }
.log-entry.mapping      { color: var(--accent); font-weight: 600; border-left: 3px solid var(--accent); padding-left: 10px; }
.log-entry.cluster-suggestion {
  background: var(--warn-light);
  border-left: 3px solid var(--warn);
  padding: 6px 10px;
  border-radius: 3px;
  margin: 4px 0;
  color: var(--text);
}
.log-entry.consistency-report {
  background: var(--success-light);
  border-left: 3px solid var(--success);
  padding: 6px 10px;
  border-radius: 3px;
  margin: 4px 0;
  color: var(--text);
}

.log-time {
  color: var(--text-muted);
  margin-right: 8px;
  font-size: 11px;
}

.change-block {
  margin: 4px 0 4px 16px;
  padding: 6px 10px;
  background: var(--surface2);
  border-left: 2px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.change-block.impasse   { border-left-color: var(--danger); }
.change-block.accepted  { border-left-color: var(--success); }
.change-block.countered { border-left-color: var(--warn); }

.change-article { font-weight: 600; color: var(--text); }
.change-status  { font-size: 11px; padding: 1px 5px; border-radius: 3px; margin-left: 6px; }
.change-status.proposed  { background: var(--accent-light); color: var(--accent); }
.change-status.accepted  { background: var(--success-light); color: var(--success); }
.change-status.countered { background: var(--warn-light); color: var(--warn); }
.change-status.impasse   { background: var(--danger-light); color: var(--danger); }
.change-rationale { color: var(--text-muted); font-size: 11px; margin-top: 2px; }

/* Progress bar */

.progress-bar-wrap {
  background: var(--surface2);
  border-radius: 4px;
  height: 6px;
  margin-bottom: 12px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
  width: 0%;
}

/* ── 8. Results (Stat Cards, Article Table, Badges, Consistency) ────────── */

.results-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-num {
  font-family: 'Sora', sans-serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-card.agreed       .stat-num { color: var(--success); }
.stat-card.uncontested  .stat-num { color: var(--accent); }
.stat-card.impasse      .stat-num { color: var(--danger); }
.stat-card.open         .stat-num { color: var(--warn); }
.stat-card.addition     .stat-num { color: #7C3AED; }

/* Article Table */

.article-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.article-table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--surface2);
  border-bottom: 2px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-family: 'Sora', sans-serif;
}
.article-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.article-table tr:hover td { background: var(--surface2); }

/* Badges */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.badge.agreed               { background: var(--success-light); color: var(--success); }
.badge.agreed_necessary     { background: var(--success-light); color: var(--success); border: 1px solid var(--warn); }
.badge.uncontested          { background: var(--accent-light); color: var(--accent); }
.badge.uncontested_editorial{ background: #E0F2FE; color: #0369A1; border: 1px solid #38BDF8; }
.badge.impasse              { background: var(--danger-light); color: var(--danger); }
.badge.open                 { background: var(--warn-light); color: var(--warn); }
.badge.addition             { background: #EDE9FE; color: #7C3AED; }

/* ── 9. Downloads ───────────────────────────────────────────────────────── */

.download-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 520px;
}

.download-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}
.download-item:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }

.download-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.download-info { flex: 1; }
.download-name { font-weight: 500; font-size: 13px; color: var(--text); }
.download-desc { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.download-item a {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  font-family: 'Sora', sans-serif;
  font-weight: 500;
  padding: 5px 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.download-item a:hover { background: var(--accent); color: #FFFFFF; }

.download-item.unavailable {
  opacity: 0.45;
  pointer-events: none;
}
.download-na {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-shrink: 0;
}

/* ── 10. Session List ───────────────────────────────────────────────────── */

.session-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Misc ─────────────────────────────────────────────────────────────── */

.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── 11. Playbook Builder Modal ─────────────────────────────────────────── */

.pb-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 25, 35, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}
.pb-modal.hidden { display: none; }

.pb-modal-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: min(1240px, 96vw);
  height: min(90vh, 880px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.pb-modal-header {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface2);
}

.pb-modal-title {
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.pb-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}
.pb-close:hover { color: var(--danger); background: var(--danger-light); }

.pb-modal-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left: builder form */
.pb-form-panel {
  flex: 0 0 58%;
  overflow-y: auto;
  padding: 20px 24px;
  border-right: 1px solid var(--border);
}

/* Right: live preview */
.pb-preview-panel {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg);
}

.pb-preview-header {
  font-family: 'Sora', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.pb-section {
  margin-bottom: 28px;
}

.pb-section-title {
  font-family: 'Sora', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.pb-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 12px;
  margin-bottom: 4px;
  font-weight: 500;
}
.pb-label:first-child { margin-top: 0; }

.pb-form-panel select,
.pb-form-panel input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pb-form-panel select:focus,
.pb-form-panel input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

/* Sliders */
.pb-slider-row {
  margin-bottom: 22px;
}

.pb-slider-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.pb-slider-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.pb-slider-article {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-muted);
}

.pb-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

input[type="range"].pb-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  border: 1px solid var(--border);
}
input[type="range"].pb-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--accent), var(--shadow-sm);
  transition: box-shadow 0.15s;
}
input[type="range"].pb-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--accent);
}

.pb-slider-value {
  font-size: 11px;
  color: var(--accent);
  margin-top: 4px;
  min-height: 16px;
  font-style: italic;
}

/* Checkboxes */
.pb-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 5px 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
}
.pb-checkbox-row input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
}
.pb-checkbox-row label {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  line-height: 1.4;
  font-weight: 400;
}

/* Manage list */
.pb-manage-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
}
.pb-manage-item-name {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pb-item-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
  flex-shrink: 0;
  font-weight: 500;
}
.pb-item-badge.operator   { background: var(--accent-light); color: var(--accent); }
.pb-item-badge.contractor { background: var(--success-light); color: var(--success); }
.pb-item-badge.builtin    { background: var(--neutral-light); color: var(--neutral); border: 1px solid var(--border); }

/* Preview blocks */
.pb-preview-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.pb-preview-block-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
  font-family: 'Sora', sans-serif;
}
.pb-preview-item {
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  line-height: 1.4;
}
.pb-preview-item:last-child { border-bottom: none; }
.pb-preview-redline {
  font-size: 12px;
  padding: 5px 0 5px 8px;
  border-left: 2px solid var(--danger);
  margin-bottom: 6px;
  color: var(--text);
  line-height: 1.4;
}
.pb-preview-redline:last-child { margin-bottom: 0; }
.pb-preview-priority {
  font-size: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}
.pb-preview-priority:last-child { border-bottom: none; }

/* ── 12. Party Details Modal ────────────────────────────────────────────── */

.pd-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(15, 25, 35, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}
.pd-modal.hidden { display: none; }

.pd-modal-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: min(520px, 94vw);
  max-height: min(90vh, 700px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.pd-modal-header {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface2);
}

.pd-modal-title {
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.pd-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 8px;
}

.pd-modal-footer {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}
.pd-modal-footer .btn { flex: 1; margin-top: 0; }

.pd-section-title {
  font-family: 'Sora', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 16px 0 8px;
}
.pd-section-title:first-child { margin-top: 0; }

.pd-role-options {
  display: flex;
  gap: 10px;
  margin-bottom: 6px;
}

.pd-role-option {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
  user-select: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.pd-role-option:has(input:checked) { border-color: var(--accent); color: var(--text); background: var(--accent-light); }
.pd-role-option input[type=radio]  { accent-color: var(--accent); cursor: pointer; }

.pd-detected-note {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  margin-top: 6px;
}

.pd-form-grid {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 7px 10px;
}
.pd-form-grid label {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
  padding: 0;
}
.pd-form-grid input[type=text] {
  font-size: 12px;
  padding: 5px 8px;
  margin: 0;
}

.pd-optional {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
}

/* Placeholder mapping section (Party Details modal) */
.pd-mapping-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 10px;
  line-height: 1.5;
}
.pd-mapping-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pd-mapping-row {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
}
.pd-mapping-token-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}
.pd-mapping-token-code {
  font-family: var(--mono);
  font-size: 12px;
  background: #FEF3C7;
  color: #92400E;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.pd-mapping-context {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}
.pd-mapping-options {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.pd-mapping-options label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}
.pd-mapping-options input[type="radio"] {
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}

/* Receiver config panel */

.rcfg-wrap {
  max-width: 560px;
}

.rcfg-header {
  font-family: 'Sora', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.rcfg-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}

.rcfg-label {
  color: var(--text-muted);
  font-size: 11px;
  margin-right: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.rcfg-divider {
  font-family: 'Sora', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.rcfg-field-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.rcfg-error {
  background: var(--danger-light);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 12px;
  margin-top: 10px;
}

.rcfg-role-note {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  margin: 6px 0 10px;
}

/* Post-negotiation review panel */

.review-wrap {
  max-width: 560px;
}

.review-header {
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--success);
  margin-bottom: 14px;
}

.review-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}

.review-closed {
  background: var(--success-light);
  border: 1px solid var(--success);
  color: var(--success);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 500;
  margin-top: 12px;
}

.review-radios {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.review-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, background 0.15s;
}

.review-radio:hover { border-color: var(--accent); background: var(--accent-light); }
.review-radio input[type=radio] { accent-color: var(--accent); width: 14px; height: 14px; }

/* Party Details collapsible section (legacy) */

.party-details-toggle {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  margin-top: 10px;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, color 0.15s;
}
.party-details-toggle:hover { border-color: var(--accent); color: var(--text); }

.party-details-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px 10px;
  padding: 10px 0 4px;
}

.party-details-grid label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  margin: 0;
  padding: 0;
}

.party-details-grid input[type=text] {
  font-size: 12px;
  padding: 5px 8px;
  margin: 0;
}

/* ── 14. Counterparty Cards ─────────────────────────────────────────────── */

.cp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}

.cp-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cp-card-info { flex: 1; min-width: 0; }

.cp-card-name  { font-size: 14px; font-weight: 600; color: var(--text); }
.cp-card-email { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.cp-card-meta {
  display: flex;
  gap: 20px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.cp-card-meta strong { color: var(--accent); }

.cp-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.cp-expand-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font);
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.cp-expand-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

.cp-history {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.cp-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  gap: 10px;
}
.cp-history-item:last-child { border-bottom: none; }

.cp-history-contract { color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-history-date     { color: var(--text-muted); white-space: nowrap; }
.cp-history-role     { color: var(--text-muted); font-size: 10px; white-space: nowrap; }

/* ── 15. Toast Notifications ────────────────────────────────────────────── */

.pb-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  background: var(--success-light);
  border: 1px solid var(--success);
  color: var(--success);
  padding: 11px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 1;
  transition: opacity 0.4s, transform 0.4s;
}
.pb-toast.hidden {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}
.pb-toast.warn {
  background: var(--warn-light);
  border-color: var(--warn);
  color: var(--warn);
}

/* ── 16. Utilities ──────────────────────────────────────────────────────── */

.hidden { display: none !important; }

/* Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Responsive */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main";
  }
  .sidebar {
    display: none;
  }
  .results-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ═════════════════════════════════════════════════════════════════════════
   SPRINT 2 — User-facing UX layer (Aria v2.0)
   New component classes for landing, dashboard, run onboarding, results.
   Mobile-responsive min-width 320px. Built on the v1.9.4 token palette above.
   ═════════════════════════════════════════════════════════════════════════ */

/* ── User-facing layout ─────────────────────────────────────────────────── */

.aria-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.aria-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.aria-nav .aria-logo,
.aria-logo {
  font-family: 'Sora', sans-serif;
  font-size: 36px !important;
  font-weight: 800 !important;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -1px;
  line-height: 1;
  padding: 0 4px 0 0 !important;
}
.aria-brand {
  font-family: 'Sora', sans-serif;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
}
.aria-nav .aria-logo .tm,
.aria-logo .tm,
.aria-brand .tm {
  font-size: 14px;
  vertical-align: super;
  font-weight: 400;
  letter-spacing: 0;
  margin-left: 2px;
}
.aria-nav-links { display: flex; align-items: center; gap: 16px; }
.aria-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.aria-nav a:hover { color: var(--text); background: var(--surface2); }
.aria-nav a.active { color: var(--accent); }

.aria-balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--success-light);
  color: var(--success);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Sora', sans-serif;
}
.aria-account-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.aria-account-btn:hover { background: var(--surface2); }

.aria-main {
  flex: 1;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
}

.aria-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Pills ──────────────────────────────────────────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  line-height: 1.6;
}
.pill-issuer   { background: #EEF3FF; color: #1D4ED8; }
.pill-receiver { background: #F1F3F7; color: #5A6478; }
.pill-agreed   { background: var(--success-light); color: var(--success); }
.pill-impasse  { background: var(--danger-light);  color: var(--danger); }
.pill-waiting  { background: var(--warn-light);    color: var(--warn); }
.pill-live     { background: var(--accent-light);  color: var(--accent); }
.pill-free     { background: #DCFCE7; color: #15803D; }

.pill-live::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.85); }
}

.role-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-left: 6px;
  vertical-align: middle;
}
.role-tag.issuer   { background: #EEF3FF; color: #1D4ED8; }
.role-tag.receiver { background: #F1F3F7; color: #5A6478; }

/* ── Metric cards ───────────────────────────────────────────────────────── */

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.metric-card {
  background: var(--surface2);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: center;
}
.metric-card .metric-value {
  font-family: 'Sora', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}
.metric-card .metric-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}
.metric-card.success .metric-value { color: var(--success); }
.metric-card.danger .metric-value { color: var(--danger); }
.metric-card.accent .metric-value { color: var(--accent); }

@media (max-width: 640px) {
  .metric-row { grid-template-columns: 1fr; }
  .metric-card { padding: 14px; }
  .metric-card .metric-value { font-size: 24px; }
}

/* ── Section cards (shared container) ───────────────────────────────────── */

.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-card-title {
  font-family: 'Sora', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.section-card-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}
.section-card-link:hover { text-decoration: underline; }

/* ── Run list rows ──────────────────────────────────────────────────────── */

.run-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.run-row:first-child { border-top: none; }
.run-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  background: var(--surface2);
}
.run-icon.complete { background: var(--success-light); color: var(--success); }
.run-icon.warn     { background: var(--warn-light);    color: var(--warn); }
.run-icon.live     { background: var(--accent-light);  color: var(--accent); }
.run-icon.pending  { background: var(--surface2);      color: var(--text-muted); }

.run-info { flex: 1; min-width: 0; }
.run-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.run-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.run-actions { flex-shrink: 0; display: flex; gap: 8px; align-items: center; }

.run-btn {
  padding: 5px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.run-btn:hover { background: var(--surface2); border-color: var(--accent); color: var(--accent); }
.run-btn.primary {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}
.run-btn.primary:hover { background: var(--accent-hover); color: #FFFFFF; }

/* ── Step indicator ─────────────────────────────────────────────────────── */

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.step {
  display: flex;
  align-items: center;
  gap: 8px;
}
.step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Sora', sans-serif;
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.step.active .step-circle {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}
.step.done .step-circle {
  background: var(--success);
  color: #FFFFFF;
  border-color: var(--success);
}
.step-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.step.active .step-label { color: var(--text); font-weight: 600; }
.step.done .step-label { color: var(--success); }
.step-line {
  width: 32px;
  height: 1px;
  background: var(--border);
}
.step.done ~ .step-line,
.step.done + .step-line { background: var(--success); }

@media (max-width: 640px) {
  .step-label { display: none; }
  .step-line { width: 16px; }
}

/* ── Progress bar ───────────────────────────────────────────────────────── */

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #3B82F6 100%);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.progress-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Upload zone ────────────────────────────────────────────────────────── */

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--surface2);
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}
.upload-zone-icon { font-size: 36px; margin-bottom: 8px; }
.upload-zone-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.upload-zone-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Balance bar ────────────────────────────────────────────────────────── */

.balance-bar-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface2);
  border-radius: var(--radius-md);
}
.balance-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.balance-bar-fill {
  height: 100%;
  background: var(--success);
  border-radius: 999px;
}
.balance-bar-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-family: 'Sora', sans-serif;
}

/* ── Feature cards (landing) ────────────────────────────────────────────── */

.feature-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 32px 0;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}
.feature-card-title {
  font-family: 'Sora', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.feature-card-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
}
@media (max-width: 640px) {
  .feature-row { grid-template-columns: 1fr; }
}

/* ── Landing hero ───────────────────────────────────────────────────────── */

.hero {
  text-align: center;
  padding: 64px 16px 48px;
}
.hero h1 {
  font-family: 'Sora', sans-serif;
  font-size: 44px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto 32px;
  line-height: 1.5;
}
.hero-cta {
  display: inline-block;
  padding: 14px 28px;
  background: var(--accent);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.hero-cta:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
@media (max-width: 640px) {
  .hero { padding: 40px 16px 32px; }
  .hero h1 { font-size: 32px; }
  .hero p { font-size: 16px; }
}

/* ── FAQ ────────────────────────────────────────────────────────────────── */

.faq-list { max-width: 680px; margin: 0 auto; }
.faq-item {
  border-top: 1px solid var(--border);
  padding: 16px 0;
}
.faq-item:first-child { border-top: none; }
.faq-question {
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.faq-answer {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ── Pricing tiers ──────────────────────────────────────────────────────── */

.pricing-tier {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
}
.pricing-tier:hover {
  border-color: var(--accent);
}
.pricing-tier.selected {
  border-color: var(--accent);
  background: var(--accent-light);
  border-width: 2px;
  padding: 17px;
}
.pricing-tier.featured {
  position: relative;
}
.pricing-tier.featured::after {
  content: 'Best value';
  position: absolute;
  top: -10px;
  right: 16px;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}
.pricing-tier-name {
  font-family: 'Sora', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.pricing-tier-bonus {
  display: inline-block;
  padding: 2px 8px;
  background: var(--success-light);
  color: var(--success);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
}
.pricing-tier-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.pricing-tier-price {
  text-align: right;
}
.pricing-tier-price .price {
  font-family: 'Sora', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.pricing-tier-price .price-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Role option cards (step 2 of /run/new) ─────────────────────────────── */

.role-option-card {
  padding: 24px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  margin-bottom: 12px;
  transition: border-color 0.15s, background 0.15s;
}
.role-option-card:hover { border-color: var(--accent); }
.role-option-card.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}
.role-option-title {
  font-family: 'Sora', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.role-option-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Preference pills (dashboard "Your preferences" section) ────────────── */

.pref-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.pref-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
}
.pref-pill:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}
.pref-pill.new {
  border-style: dashed;
  color: var(--text-muted);
}

/* ── Priority slider (step 3) ───────────────────────────────────────────── */

.priority-slider-row {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.priority-slider-row:first-child { border-top: none; }
.priority-slider-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}
.priority-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  outline: none;
}
.priority-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid #FFFFFF;
  box-shadow: var(--shadow-sm);
}
.priority-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid #FFFFFF;
  box-shadow: var(--shadow-sm);
}
.priority-slider-scale {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── Result callout cards ───────────────────────────────────────────────── */

.callout-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 12px;
}
.callout-card.success { border-left-color: var(--success); background: var(--success-light); }
.callout-card.danger  { border-left-color: var(--danger);  background: var(--danger-light); }
.callout-card.warning { border-left-color: var(--warn);    background: var(--warn-light); }
.callout-card-title {
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

/* ── Download button row (results) ──────────────────────────────────────── */

.download-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.download-btn {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}
.download-btn.primary {
  background: var(--accent);
  color: #FFFFFF;
}
.download-btn.primary:hover { background: var(--accent-hover); }
.download-btn.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.download-btn.secondary:hover { background: var(--surface2); }

/* ── Empty state ────────────────────────────────────────────────────────── */

.empty-state-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 48px 24px;
  text-align: center;
}
.empty-state-title {
  font-family: 'Sora', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.empty-state-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ── Filter tabs ────────────────────────────────────────────────────────── */

.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.filter-tab {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  font-family: 'Sora', sans-serif;
  transition: color 0.15s, border-color 0.15s;
}
.filter-tab:hover { color: var(--text); }
.filter-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Dashboard greeting header ──────────────────────────────────────────── */

.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.dashboard-greeting-name {
  font-family: 'Sora', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.dashboard-greeting-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}
.dashboard-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Authentication card ────────────────────────────────────────────────── */

.auth-page-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.auth-top {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.auth-card-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.auth-card-v2 {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px;
  max-width: 400px;
  width: 100%;
}
.auth-card-v2 h1 {
  font-family: 'Sora', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  text-align: center;
}
.auth-card-v2 .auth-sub {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.auth-card-v2 label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 12px 0 6px;
}
.auth-card-v2 input[type="text"],
.auth-card-v2 input[type="email"],
.auth-card-v2 input[type="password"] {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-card-v2 input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}
.auth-submit {
  width: 100%;
  height: 44px;
  margin-top: 20px;
  background: var(--accent);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.auth-submit:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}
.auth-toggle {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 16px;
}
.auth-toggle a { color: var(--accent); text-decoration: none; }
.auth-toggle a:hover { text-decoration: underline; }
.auth-error-v2 {
  background: var(--danger-light);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
}

/* ── Hidden utility (used by JS step flow) ──────────────────────────────── */

.sprint2-hidden { display: none !important; }

/* ── Responsive polish ──────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .aria-main { padding: 20px 16px; }
  .aria-nav { padding: 10px 16px; }
  .section-card { padding: 14px; }
  .run-row { flex-wrap: wrap; }
  .run-actions { width: 100%; justify-content: flex-end; }
  .dashboard-header { flex-direction: column; }
  .hero h1 { font-size: 28px; }
}


/* v2.6.32 — review-modal styles, shared by run_new (issuer per-article
   editing) and join (receiver read-only preview). Class names match
   the issuer modal verbatim so receiver markup can drop the .editing
   helpers without restyling. Literal hex values mirror the spec we
   shipped at v2.6.28; the modal is a contained surface and intentionally
   does not pull from the design tokens. */
#review-modal,
#receiver-preview-modal {
  width: 90vw;
  max-width: 860px;
  height: 90vh;
  border: none;
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
#review-modal[open],
#receiver-preview-modal[open] {
  display: flex;
  flex-direction: column;
}
#review-modal::backdrop,
#receiver-preview-modal::backdrop {
  background: rgba(0,0,0,0.5);
}
.review-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px 32px 16px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.review-modal-header h2 {
  font-family: 'Sora', sans-serif;
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px 0;
}
.review-modal-meta {
  margin: 0;
  font-size: 12px;
  color: #64748b;
}
.review-modal-close {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  color: #64748b;
}
.review-modal-close:hover {
  color: #1a202c;
  border-color: #1a202c;
}
.review-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 14px;
  line-height: 1.8;
  color: #1a202c;
}
.review-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
  gap: 12px;
}
.review-modal-footer button {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  color: #1a202c;
}
.review-modal-footer button:hover { border-color: #1a202c; }
.review-modal-footer .btn-primary {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}
.review-modal-footer .btn-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
}
.review-article-heading {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 600;
  font-size: 14px;
  margin-top: 32px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.review-article-heading.review-edited .review-edited-badge {
  font-size: 11px;
  color: #3b82f6;
  font-weight: 400;
}
.review-edited-badge {
  font-size: 11px;
  color: #3b82f6;
  font-weight: 400;
}
.review-article-body {
  margin-bottom: 8px;
  white-space: pre-wrap;
  border-left: 3px solid transparent;
  padding-left: 12px;
  transition: border-color 0.15s;
}
.review-article-body.review-edited-body {
  border-left-color: #3b82f6;
  background: #f0f7ff;
  padding: 8px 12px;
  border-radius: 0 4px 4px 0;
}
.review-article-body.editing {
  border-left-color: #3b82f6;
  outline: none;
  background: #f8faff;
  padding: 8px 12px;
  border-radius: 0 4px 4px 0;
}
.btn-edit-article {
  font-size: 11px;
  color: #64748b;
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-edit-article:hover {
  color: #3b82f6;
  border-color: #3b82f6;
}

/* v2.7.3 — AI disclaimer banner above the download row on the
   results page. Amber palette signals caution without alarming the
   user; small enough not to push the download buttons below the fold. */
.ai-disclaimer {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #92400e;
  line-height: 1.5;
}

/* v2.8.x — Compliance notes collapsible (run_results) */
.compliance-section {
  margin: 16px 0;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  overflow: hidden;
}
.compliance-section summary {
  padding: 12px 16px;
  background: #fffbeb;
  cursor: pointer;
  font-weight: 500;
  color: #92400e;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.compliance-section summary::-webkit-details-marker { display: none; }
.compliance-section summary::marker { content: ""; }
.compliance-section[open] summary { border-bottom: 1px solid #f59e0b; }
.compliance-section .compliance-notes-body {
  padding: 16px;
  background: white;
}
.compliance-section .compliance-count {
  font-weight: 600;
}
.compliance-section .compliance-cta {
  font-weight: 400;
  color: #b45309;
  font-size: 12px;
}
