:root {
  --bg-obsidian: #090a0d;
  --bg-surface: #11131a;
  --bg-elevated: #171b24;
  --bg-input: #0d0f15;
  --border-subtle: #232836;
  --border-strong: #32394c;
  --text-primary: #f3f4f8;
  --text-secondary: #a2aab8;
  --text-muted: #70798c;
  --gold-400: #f5be49;
  --gold-500: #e5a324;
  --gold-600: #c48414;
  --gold-tint: rgba(245, 190, 73, 0.12);
  --gold-border: rgba(245, 190, 73, 0.35);
  --emerald: #22c55e;
  --emerald-tint: rgba(34, 197, 94, 0.12);
  --emerald-border: rgba(34, 197, 94, 0.36);
  --sky: #38bdf8;
  --sky-tint: rgba(56, 189, 248, 0.12);
  --sky-border: rgba(56, 189, 248, 0.32);
  --rose: #f43f5e;
  --rose-tint: rgba(244, 63, 94, 0.12);
  --rose-border: rgba(244, 63, 94, 0.32);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-obsidian);
  background-image:
    radial-gradient(ellipse 80% 45% at 50% -10%, rgba(229, 163, 36, 0.11), transparent 70%),
    radial-gradient(ellipse 50% 40% at 95% 20%, rgba(56, 189, 248, 0.04), transparent 60%);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

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

a:hover {
  text-decoration: underline;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(9, 10, 13, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 66px;
  flex-wrap: wrap;
  padding: 10px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(245, 190, 73, 0.22), rgba(229, 163, 36, 0.06));
  border: 1px solid var(--gold-border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.15;
}

.brand-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.epoch-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 4px 6px 4px 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.epoch-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

/* Honest Simulation Banner */
.sim-banner {
  background: linear-gradient(90deg, rgba(245, 190, 73, 0.1), rgba(245, 190, 73, 0.03));
  border-bottom: 1px solid var(--gold-border);
  padding: 9px 0;
  font-size: 0.82rem;
  color: #e9d9b4;
}

.sim-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sim-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--gold-tint);
  border: 1px solid var(--gold-border);
  color: var(--gold-400);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  border-color: var(--gold-400);
  background: #1d222e;
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, var(--gold-400), var(--gold-500));
  border-color: var(--gold-400);
  color: #0b0c10;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #f8ca64, var(--gold-400));
  border-color: #f8ca64;
}

.btn-success {
  background: linear-gradient(180deg, #2dd468, #1fa950);
  border-color: #2dd468;
  color: #06130b;
}

.btn-success:hover:not(:disabled) {
  background: linear-gradient(180deg, #43e07b, #22c55e);
  border-color: #43e07b;
}

.btn-danger {
  background: var(--rose-tint);
  border-color: var(--rose-border);
  color: #fda4af;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(244, 63, 94, 0.22);
  border-color: var(--rose);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 0.73rem;
  border-radius: 999px;
}

.btn-demo {
  background: var(--gold-tint);
  border-color: var(--gold-border);
  color: var(--gold-400);
}

.btn-demo:hover:not(:disabled) {
  background: rgba(245, 190, 73, 0.22);
  border-color: var(--gold-400);
}

/* 60s Demo Showcase */
.demo-showcase {
  margin-top: 28px;
  border-color: var(--gold-border);
  background: linear-gradient(180deg, rgba(245, 190, 73, 0.045), rgba(17, 19, 26, 0.98) 28%);
}

.demo-showcase-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.demo-showcase-title {
  margin: 8px 0 4px;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

.demo-showcase-sub {
  margin: 0;
  max-width: 760px;
  font-size: 0.83rem;
  color: var(--text-secondary);
}

.demo-showcase-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.demo-video-frame {
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #050608;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.demo-video-frame video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: #050608;
}

/* Main Content */
main.container {
  padding-top: 24px;
  padding-bottom: 64px;
}

/* Treasury Bar */
.treasury-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.treasury-selector-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.treasury-select {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  max-width: 100%;
  text-overflow: ellipsis;
}

.treasury-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.treasury-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
}

.kpi-card {
  position: relative;
  overflow: hidden;
}

.kpi-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-value {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.kpi-value .unit {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold-400);
  margin-left: 4px;
}

.kpi-sub {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #1e2330;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-400));
  transition: width 0.25s ease;
}

.progress-fill.ready {
  background: linear-gradient(90deg, #16a34a, #22c55e);
}

/* Signer Switcher */
.signer-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 22px;
}

.signer-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.signer-bar-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.signer-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.signer-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  cursor: pointer;
  transition: all 0.16s ease;
  text-align: left;
  color: var(--text-primary);
  width: 100%;
}

.signer-chip:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.signer-chip.active {
  border-color: var(--gold-400);
  background: rgba(245, 190, 73, 0.09);
  box-shadow: 0 0 0 1px rgba(245, 190, 73, 0.25);
}

.signer-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #1f2433;
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--gold-400);
  flex-shrink: 0;
}

.signer-chip.active .signer-avatar {
  background: var(--gold-400);
  color: #090a0d;
  border-color: var(--gold-400);
}

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

.signer-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.signer-role {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.signer-fp {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.active-badge {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--gold-400);
  color: #090a0d;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Tabs */
.tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 1px;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--gold-400);
  border-bottom-color: var(--gold-400);
}

.tab-count {
  font-size: 0.72rem;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.tab-btn.active .tab-count {
  background: var(--gold-tint);
  border-color: var(--gold-border);
  color: var(--gold-400);
}

.tab-panel {
  display: none;
}

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

/* Proposals List */
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.filter-pill.active {
  background: var(--gold-tint);
  border-color: var(--gold-border);
  color: var(--gold-400);
}

.proposal-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.proposal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  transition: border-color 0.15s ease;
}

.proposal-card.status-Ready {
  border-color: var(--emerald-border);
}

.proposal-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.proposal-id-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-Pending {
  background: var(--gold-tint);
  border: 1px solid var(--gold-border);
  color: var(--gold-400);
}

.badge-Ready {
  background: var(--emerald-tint);
  border: 1px solid var(--emerald-border);
  color: #4ade80;
}

.badge-Executed {
  background: var(--sky-tint);
  border: 1px solid var(--sky-border);
  color: var(--sky);
}

.badge-Expired, .badge-Cancelled {
  background: var(--rose-tint);
  border: 1px solid var(--rose-border);
  color: #fda4af;
}

.badge-kind {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}

.proposal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.proposal-amount {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--gold-400);
  text-align: right;
}

.proposal-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid #1b1f2b;
  margin-bottom: 14px;
  font-size: 0.82rem;
}

.meta-key {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.meta-val {
  color: var(--text-primary);
  word-break: break-all;
}

.quorum-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.sig-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.sig-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  font-size: 0.76rem;
  color: #bbf7d0;
}

.sig-chip.stale {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.28);
  color: #fda4af;
}

.proposal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.proposal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Code / Manifest blocks */
.code-block {
  background: #07080b;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.55;
  color: #dbe3f4;
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}

.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Audit table / cards */
.audit-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.audit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

/* Receipt Verifier */
.verifier-textarea {
  width: 100%;
  min-height: 220px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 14px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  resize: vertical;
  margin-bottom: 12px;
}

.verdict-box {
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  margin-top: 14px;
}

.verdict-box.valid {
  background: var(--emerald-tint);
  border-color: var(--emerald-border);
}

.verdict-box.invalid {
  background: var(--rose-tint);
  border-color: var(--rose-border);
}

/* Forms & Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 4, 7, 0.78);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
}

.modal-wide {
  max-width: 820px;
}

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

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.88rem;
}

.form-input:focus, .form-select:focus, .verifier-textarea:focus {
  outline: none;
  border-color: var(--gold-400);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.signer-row-edit {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
}

/* Toast notifications */
.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--gold-border);
  border-left: 4px solid var(--gold-400);
  color: var(--text-primary);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.toast.success {
  border-color: var(--emerald-border);
  border-left-color: var(--emerald);
}

.toast.error {
  border-color: var(--rose-border);
  border-left-color: var(--rose);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 22px 0 34px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 960px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .split-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 0 14px;
  }
  .treasury-selector-row {
    width: 100%;
  }
  .treasury-select {
    width: 100%;
    font-size: 0.94rem;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .signer-row-edit {
    grid-template-columns: 1fr;
  }
  .proposal-amount {
    text-align: left;
  }
}
