:root {
  --ink: #0D1117;
  --ink-2: #161B22;
  --ink-3: #21262D;
  --border: #30363D;
  --border-2: #444C56;
  --text-primary: #E6EDF3;
  --text-secondary: #8B949E;
  --text-muted: #484F58;
  --accent: #1F6FEB;
  --accent-hover: #388BFD;
  --accent-dim: rgba(31,111,235,0.15);
  --success: #3FB950;
  --success-dim: rgba(63,185,80,0.12);
  --warning: #D29922;
  --warning-dim: rgba(210,153,34,0.12);
  --danger: #F85149;
  --danger-dim: rgba(248,81,73,0.12);
  --gold: #F0C040;
  --gold-dim: rgba(240,192,64,0.1);
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --font: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--ink);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── LAYOUT ───────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--ink-2);
  border-right: 1px solid var(--border);
  padding: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  width: 220px;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.main-content {
  margin-left: 220px;
  padding: 32px;
  max-width: 1100px;
}

/* ── SIDEBAR ──────────────────────────────────── */
.brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.brand-logo .icon {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.brand-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.brand-sub { font-size: 10px; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; }

.nav-section { padding: 12px 0; }
.nav-label {
  padding: 4px 16px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-left: 2px solid transparent;
  font-size: 13px;
}
.nav-item:hover { background: var(--ink-3); color: var(--text-primary); }
.nav-item.active { background: var(--accent-dim); color: var(--accent-hover); border-left-color: var(--accent); }
.nav-item .nav-icon { font-size: 15px; width: 18px; text-align: center; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px;
  background: var(--ink-3);
  border-radius: var(--radius);
  cursor: pointer;
}
.avatar {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: white; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--text-muted); }

/* ── TOPBAR ───────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.page-title { font-size: 20px; font-weight: 600; }
.page-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ── CARDS ────────────────────────────────────── */
.card {
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── STAT CARDS ───────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-size: 28px; font-weight: 700; margin: 4px 0 2px; font-family: var(--font-mono); }
.stat-sub { font-size: 11px; color: var(--text-secondary); }
.stat-card.accent { border-color: var(--accent); background: var(--accent-dim); }
.stat-card.success { border-color: var(--success); background: var(--success-dim); }
.stat-card.warning { border-color: var(--warning); background: var(--warning-dim); }
.stat-card.danger  { border-color: var(--danger);  background: var(--danger-dim);  }

/* ── BADGES ───────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-blue    { background: var(--accent-dim);   color: #388BFD; }
.badge-green   { background: var(--success-dim);  color: #3FB950; }
.badge-yellow  { background: var(--warning-dim);  color: #D29922; }
.badge-red     { background: var(--danger-dim);   color: #F85149; }
.badge-gold    { background: var(--gold-dim);     color: var(--gold); }
.badge-gray    { background: var(--ink-3);        color: var(--text-secondary); }

/* ── BUTTONS ──────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  font-family: var(--font);
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--ink-3); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--border-2); background: var(--border); }
.btn-danger  { background: var(--danger-dim); color: var(--danger); border: 1px solid var(--danger); }
.btn-success { background: var(--success-dim); color: var(--success); border: 1px solid var(--success); }
.btn-gold    { background: var(--gold-dim); color: var(--gold); border: 1px solid var(--gold); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── FORMS ────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-label span { color: var(--danger); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  transition: border-color 0.15s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-textarea { resize: vertical; min-height: 100px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── TABLE ────────────────────────────────────── */
.table-wrap {
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead { background: var(--ink-3); }
th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--ink-3); }
.font-mono { font-family: var(--font-mono); font-size: 12px; }

/* ── TIMELINE / STEPS ─────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex;
  gap: 12px;
  padding-bottom: 20px;
  position: relative;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0;
  position: relative; z-index: 1;
}
.timeline-dot.done  { background: var(--success-dim); color: var(--success); border: 1px solid var(--success); }
.timeline-dot.active{ background: var(--accent-dim);  color: var(--accent);  border: 1px solid var(--accent); }
.timeline-dot.pending{ background: var(--ink-3); color: var(--text-muted); border: 1px solid var(--border); }
.timeline-line {
  position: absolute;
  left: 13px; top: 28px;
  width: 1px;
  height: calc(100% - 28px);
  background: var(--border);
}
.timeline-content { flex: 1; padding-top: 4px; }
.timeline-title { font-size: 13px; font-weight: 500; }
.timeline-sub   { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* ── COUNTDOWN ────────────────────────────────── */
.countdown-box {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 20px 0;
}
.countdown-unit {
  text-align: center;
  background: var(--ink-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  min-width: 72px;
}
.countdown-num {
  font-size: 36px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--gold);
  line-height: 1;
}
.countdown-label { font-size: 10px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; }

/* ── LOCK / ENCRYPT VISUAL ────────────────────── */
.lock-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--gold-dim);
  border: 1px solid rgba(240,192,64,0.25);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--gold);
}

/* ── ALERT ────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 16px;
}
.alert-info    { background: var(--accent-dim);  border: 1px solid rgba(31,111,235,0.3); color: #79b8ff; }
.alert-success { background: var(--success-dim); border: 1px solid rgba(63,185,80,0.3);  color: #56d364; }
.alert-warning { background: var(--warning-dim); border: 1px solid rgba(210,153,34,0.3); color: #e3b341; }
.alert-danger  { background: var(--danger-dim);  border: 1px solid rgba(248,81,73,0.3);  color: #ff7b72; }

/* ── MODAL ────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 90%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  transition: transform 0.2s;
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.modal-sub   { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ── LOG / AUDIT ──────────────────────────────── */
.log-entry {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.log-entry:last-child { border-bottom: none; }
.log-time { color: var(--text-muted); font-family: var(--font-mono); white-space: nowrap; }
.log-event { color: var(--text-secondary); flex: 1; }
.log-actor { color: var(--text-muted); font-family: var(--font-mono); }

/* ── TABS ─────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab {
  padding: 10px 20px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent-hover); border-bottom-color: var(--accent); }

/* ── PANELS ───────────────────────────────────── */
.panel { display: none; }
.panel.active { display: block; }

/* ── GRID HELPERS ─────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.flex   { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap { display: flex; gap: 8px; align-items: center; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent  { color: var(--accent); }
.text-gold    { color: var(--gold); }
.font-mono    { font-family: var(--font-mono); }
.font-bold    { font-weight: 600; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── LOGIN PAGE ───────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
}
.login-card {
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-icon {
  width: 52px; height: 52px;
  background: var(--accent);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  margin: 0 auto 12px;
}
.login-title { font-size: 18px; font-weight: 700; text-align: center; }
.login-sub   { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 4px; }

/* ── PROPOSAL UPLOAD ──────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.upload-icon { font-size: 36px; margin-bottom: 8px; }
.upload-text { font-size: 13px; color: var(--text-secondary); }
.upload-sub  { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── ENCRYPT ANIMATION ────────────────────────── */
@keyframes pulse-ring {
  0%   { transform: scale(1);   opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}
.encrypt-pulse {
  display: inline-block;
  width: 10px; height: 10px;
  background: var(--gold);
  border-radius: 50%;
  position: relative;
}
.encrypt-pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--gold);
  animation: pulse-ring 1.2s ease-out infinite;
}

/* ── PROGRESS ─────────────────────────────────── */
.progress-bar {
  height: 4px;
  background: var(--ink-3);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.progress-fill.gold   { background: var(--gold); }
.progress-fill.green  { background: var(--success); }

/* ── RESPONSIVE ───────────────────────────────── */
@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
