:root {
  --bg-dark: #0a0c10;
  --bg-card: #131720;
  --bg-card-hover: #1b212f;
  --border: #222a3a;
  --border-focus: #3b82f6;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent-purple: #8b5cf6;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --green: #10b981;
  --red: #ef4444;
  --amber: #f59e0b;
  --radius: 12px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Top Navigation --- */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 28px;
  background-color: rgba(19, 23, 32, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand { display: flex; align-items: center; gap: 12px; }
.logo-shield {
  font-size: 22px;
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  padding: 6px;
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.brand-title { font-weight: 700; font-size: 17px; display: block; letter-spacing: -0.5px; }
.brand-sub { font-size: 11px; color: var(--text-dim); display: block; }

.user-role-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0f131a;
  border: 1px solid #2b3345;
  padding: 6px 14px;
  border-radius: 20px;
}

.switcher-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.role-select-box {
  background: #181e2b;
  color: #60a5fa;
  border: 1px solid #3b82f6;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.nav-actions { display: flex; align-items: center; gap: 14px; }
.pill-btn {
  background: #1e2433;
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.green { background-color: var(--green); box-shadow: 0 0 8px var(--green); }

/* --- Sub Navigation Bar --- */
.sub-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 28px;
  background: #0e121a;
  border-bottom: 1px solid var(--border);
}

.sub-nav-left { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.role-tag {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
}
.role-desc { color: var(--text-muted); }

.sub-nav-tabs { display: flex; gap: 6px; }
.nav-sub-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.nav-sub-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.nav-sub-btn.active { background: #1c2333; color: #fff; font-weight: 600; border: 1px solid var(--border); }

/* --- Views & Panels --- */
.main-stage {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.view-panel { display: none; animation: fadeIn 0.25s ease; }
.view-panel.active { display: block; }
.role-panel { display: none; }
.role-panel.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Shared Channel (#stripe-pipeline) --- */
.channel-container {
  max-width: 900px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 75vh;
}

.channel-header {
  padding: 14px 20px;
  background: #0f131a;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.channel-hash { font-size: 20px; font-weight: 700; color: #60a5fa; margin-right: 6px; }
.channel-desc { font-size: 12px; color: var(--text-dim); margin-left: 12px; }

.channel-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-bubble {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #171d2b;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  max-width: 80%;
}

.chat-bubble.mine {
  align-self: flex-end;
  background: #1e2a44;
  border-color: #2b3b5f;
}

.chat-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.chat-sender { font-weight: 600; color: #60a5fa; }
.chat-text { font-size: 13px; color: #f0f6fc; line-height: 1.5; }

.channel-input-bar {
  padding: 14px 20px;
  background: #0f131a;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
}

.channel-input {
  flex: 1;
  background: #171c26;
  border: 1px solid var(--border);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}
.channel-input:focus { border-color: var(--primary); }

/* --- Reusable Components from Previous Layout --- */
.two-column-layout { display: grid; grid-template-columns: 400px 1fr; gap: 40px; align-items: start; }
.phone-column { display: flex; justify-content: center; }

.phone-frame {
  width: 360px;
  height: 720px;
  background: #000;
  border: 12px solid #232733;
  border-radius: 48px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 0 2px #3b82f633;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.phone-notch {
  height: 38px;
  background: #000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  font-size: 11px;
  color: #fff;
}

.phone-screen {
  flex: 1;
  background: #0d1117;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

.phone-view { flex: 1; display: flex; flex-direction: column; }

#phoneLockScreen {
  background: linear-gradient(180deg, #161b26 0%, #0a0e17 100%);
  padding: 20px 18px;
  justify-content: space-between;
}

.lock-clock { text-align: center; margin-top: 40px; }
.clock-time { font-size: 56px; font-weight: 300; letter-spacing: -1px; color: #fff; }
.clock-date { font-size: 14px; color: var(--text-muted); margin-top: -6px; }

.lock-notif-card {
  background: rgba(30, 36, 51, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  margin-top: auto;
  margin-bottom: 30px;
}

.notif-header { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.notif-title { font-weight: 600; font-size: 14px; color: #fff; }
.notif-desc { font-size: 13px; color: var(--text-muted); }

.btn-faceid {
  width: 100%;
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.vault-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: #161b26;
  border-bottom: 1px solid var(--border);
}
.vault-brand { font-weight: 600; font-size: 13px; }
.vault-badge { background: rgba(16, 185, 129, 0.15); color: var(--green); border: 1px solid rgba(16, 185, 129, 0.3); font-size: 10px; padding: 2px 8px; border-radius: 12px; }

.vault-scroll-content { padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.card-mobile { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.card-mobile-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.card-tag { font-size: 10px; font-weight: 600; text-transform: uppercase; padding: 2px 6px; border-radius: 6px; }
.tag-blue { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.pill-crypto { font-size: 9px; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }

.role-title { font-size: 15px; font-weight: 600; color: #fff; }
.experience-line { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }

.chips-container { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { background: #1f2737; color: #cbd5e1; font-size: 11px; padding: 3px 8px; border-radius: 6px; border: 1px solid #2e384d; }

.verified-badges { display: flex; flex-direction: column; gap: 6px; background: #0f141f; padding: 8px 10px; border-radius: 8px; }
.badge-item { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #e2e8f0; }
.check-icon { color: var(--green); font-weight: bold; }

.alert-box {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 12px;
}
.alert-header { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #fff; margin-bottom: 6px; }
.alert-text { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.alert-comp { font-size: 12px; color: var(--green); font-weight: 600; margin-bottom: 10px; }

.pulse-dot { width: 8px; height: 8px; background: #3b82f6; border-radius: 50%; box-shadow: 0 0 8px #3b82f6; }

.btn-primary-sm {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary-sm { width: 100%; background: #1f2737; color: var(--text-main); border: 1px solid var(--border); padding: 8px; border-radius: 8px; font-size: 11px; cursor: pointer; }

.card-danger { background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.25); border-radius: 14px; padding: 14px; }
.card-danger h4 { color: var(--red); font-size: 13px; margin-bottom: 4px; }
.card-danger p { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }
.btn-danger-sm { width: 100%; background: var(--red); color: #fff; border: none; padding: 8px; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); margin-top: 8px; cursor: pointer; }

/* Dashboard Grids */
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.btn-primary { background: var(--primary); color: #fff; border: none; padding: 10px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.btn-outline { background: transparent; color: var(--text-main); border: 1px solid var(--border); padding: 10px 18px; border-radius: 8px; cursor: pointer; }

.grid-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card-glass { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 22px; }
.card-glass h3 { font-size: 17px; margin-bottom: 14px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }

.meta-row { display: flex; justify-content: space-between; font-size: 13px; padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.meta-row .label { color: var(--text-muted); }
.meta-row .val { font-weight: 500; color: #fff; }
.meta-row .highlight { color: var(--green); font-weight: 700; }
.meta-row .status-green { color: var(--green); }

.client-job-item { background: #181d29; border: 1px solid var(--border); padding: 16px; border-radius: 12px; }
.client-title { font-weight: 700; font-size: 15px; color: #fff; }
.client-role { font-size: 13px; color: var(--text-muted); margin: 4px 0; }
.client-comp { font-size: 13px; color: var(--green); font-weight: 600; margin-bottom: 12px; }
.badge-stage { background: rgba(59, 130, 246, 0.2); color: #60a5fa; font-size: 11px; padding: 4px 10px; border-radius: 12px; font-weight: 600; }

.escrow-status-box { display: flex; gap: 12px; background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.25); padding: 14px; border-radius: 12px; margin-top: 14px; }
.escrow-icon { font-size: 24px; }
.escrow-status-box strong { font-size: 13px; color: var(--green); display: block; }
.escrow-status-box p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.blind-dossier-full { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 28px; }
.dossier-header-bar { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--border); padding-bottom: 20px; margin-bottom: 24px; }
.tag-dossier { background: rgba(16, 185, 129, 0.2); color: var(--green); font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; }
.dossier-header-bar h3 { font-size: 22px; margin-top: 6px; }
.loc-line { font-size: 13px; color: var(--text-muted); }

.comp-box { background: #171d2b; border: 1px solid var(--border); padding: 12px 18px; border-radius: 10px; text-align: right; }
.comp-label { font-size: 11px; color: var(--text-dim); display: block; }
.comp-val { font-size: 16px; font-weight: 700; color: var(--green); }

.dossier-body-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.dossier-body-grid h4 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); margin-bottom: 10px; }
.dossier-body-grid p { color: var(--text-muted); font-size: 14px; line-height: 1.6; margin-bottom: 20px; }

.anti-bias-notice { background: rgba(139, 92, 246, 0.1); border: 1px solid rgba(139, 92, 246, 0.25); padding: 12px; border-radius: 10px; font-size: 12px; color: #c4b5fd; }

/* Escrow Room */
.room-container { display: flex; flex-direction: column; height: 75vh; background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.room-top-bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: #0f131a; border-bottom: 1px solid var(--border); }
.live-rec { color: var(--red); font-weight: 700; font-size: 12px; letter-spacing: 0.5px; }
.room-id { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-dim); margin-left: 12px; }
.room-participants { display: flex; gap: 8px; }
.user-pill, .agency-pill { font-size: 11px; padding: 4px 10px; border-radius: 12px; font-weight: 500; }
.user-pill { background: #1e2535; color: #cbd5e1; }
.agency-pill { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); }

.room-main-grid { display: grid; grid-template-columns: 420px 1fr; flex: 1; overflow: hidden; }
.video-grid { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: #0b0e14; border-right: 1px solid var(--border); }
.video-box { flex: 1; background: #141822; border-radius: 12px; border: 1px solid var(--border); position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.video-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.avatar-icon { font-size: 40px; }
.avatar-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.video-overlay-tag { position: absolute; bottom: 8px; left: 8px; background: rgba(0, 0, 0, 0.7); padding: 3px 8px; border-radius: 6px; font-size: 10px; color: var(--text-dim); }

.code-pad-box { display: flex; flex-direction: column; background: #0a0c10; }
.pad-header { display: flex; justify-content: space-between; padding: 10px 16px; background: #11151e; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.pad-lang { background: #1e2433; padding: 2px 8px; border-radius: 4px; font-family: 'JetBrains Mono', monospace; }
.code-textarea { flex: 1; background: transparent; color: #38bdf8; border: none; padding: 18px; font-family: 'JetBrains Mono', monospace; font-size: 13px; line-height: 1.6; resize: none; outline: none; }

/* Ledger Table */
.ledger-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.ledger-table-container { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.ledger-table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
.ledger-table th { background: #161b26; color: var(--text-dim); text-transform: uppercase; font-size: 10px; letter-spacing: 0.5px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.ledger-table td { padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.04); color: var(--text-muted); }
.ledger-table tr:hover td { background: rgba(255, 255, 255, 0.02); }
.hash-cell { font-family: 'JetBrains Mono', monospace; color: #60a5fa; font-size: 11px; }
.prev-hash-cell { font-family: 'JetBrains Mono', monospace; color: var(--text-dim); font-size: 11px; }

.explainer-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 28px; }
.explainer-card h2 { font-size: 22px; margin-bottom: 8px; }
.explainer-card > p { color: var(--text-muted); margin-bottom: 20px; }
.step-guide { display: flex; flex-direction: column; gap: 14px; }
.step-item { display: flex; gap: 14px; background: rgba(255, 255, 255, 0.02); border: 1px solid var(--border); padding: 14px; border-radius: 12px; }
.step-number { width: 30px; height: 30px; background: var(--primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.step-item h4 { font-size: 14px; margin-bottom: 2px; color: #fff; }
.step-item p { font-size: 12px; color: var(--text-muted); }

/* --- Modal Dialog --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease-out;
}
.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.modal-close-btn:hover { color: var(--text-main); }
.modal-body {
  padding: 24px;
}
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus {
  border-color: var(--border-focus);
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
