/* ════════════════════════════════════════════════════════════════
   BitBookOS Phase UI-3 — QBO-Class Accounting Workspace
   Layered charcoal palette, premium tables, evidence drawer.
   Bloomberg × QBO × Bitwave × Koinly.
   ════════════════════════════════════════════════════════════════ */

/* ── Phase UI-3 Surface Layer ──────────────────────────────────── */
:root {
  --ui3-bg-0:      #0B1020;
  --ui3-bg-1:      #121826;
  --ui3-bg-2:      #161E2E;
  --ui3-surface-1: #1B2435;
  --ui3-surface-2: #222C41;
  --ui3-surface-3: #2A3550;

  --ui3-border-0:  rgba(255,255,255,.04);
  --ui3-border-1:  rgba(255,255,255,.06);
  --ui3-border-2:  rgba(255,255,255,.10);
  --ui3-border-3:  rgba(255,255,255,.16);

  --ui3-text-0:    #F5F7FA;
  --ui3-text-1:    #B6C2D9;
  --ui3-text-2:    #7F8CA3;
  --ui3-text-3:    #4A5568;

  --ui3-accent-blue:    #3B82F6;
  --ui3-accent-blue-dim:#1E3A5F;
  --ui3-accent-cyan:    #22D3EE;
  --ui3-accent-cyan-dim:#0C4A6E;
  --ui3-accent-emerald: #10B981;
  --ui3-accent-em-dim:  #064E3B;
  --ui3-accent-amber:   #D97706;
  --ui3-accent-am-dim:  #451A03;
  --ui3-accent-rose:    #F43F5E;
  --ui3-accent-rose-dim:#4C0519;

  --ui3-glow-blue:   rgba(59,130,246,.15);
  --ui3-glow-emerald:rgba(16,185,129,.12);
  --ui3-glow-amber:  rgba(217,119,6,.12);
  --ui3-glow-rose:   rgba(244,63,94,.12);

  /* Nav */
  --nav-active-glow: 0 0 0 1px rgba(59,130,246,.35), 0 0 12px rgba(59,130,246,.10);
  --nav-active-bg:   rgba(59,130,246,.12);
  --nav-active-text: #93C5FD;
  --nav-hover-bg:    rgba(255,255,255,.04);

  /* Sidebar */
  --sidebar-width: 240px;

  /* Evidence Drawer */
  --drawer-width: 640px;

  /* Context bar */
  --ctx-bar-height: 40px;

  /* Table */
  --table-row-hover: rgba(59,130,246,.04);
  --table-zebra:     rgba(255,255,255,.015);
  --table-header-bg: rgba(0,0,0,.25);
}

/* ══════════════════════════════════════════════════════════════════
   GLOBAL RESETS — Phase UI-3 dark charcoal over existing tokens
   ══════════════════════════════════════════════════════════════════ */

body {
  background: var(--ui3-bg-0) !important;
  color: var(--ui3-text-0) !important;
}

/* ── Sidebar upgrade ─────────────────────────────────────────────── */

#sidebar {
  width: var(--sidebar-width) !important;
  background: var(--ui3-bg-1) !important;
  border-right: 1px solid var(--ui3-border-1) !important;
}

#sidebar > nav {
  padding: 8px 6px !important;
}

/* Section group headers */
.ui3-nav-group-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ui3-text-3);
  padding: 16px 10px 5px;
  display: block;
}

/* Nav items - override existing */
.nav-item {
  display: flex !important;
  align-items: center !important;
  gap: 9px !important;
  padding: 7px 10px !important;
  border-radius: 7px !important;
  margin-bottom: 1px !important;
  cursor: pointer !important;
  color: var(--ui3-text-2) !important;
  font-size: 12.5px !important;
  font-weight: 400 !important;
  transition: background .12s ease, color .12s ease !important;
  border: 1px solid transparent !important;
  background: transparent !important;
}

.nav-item:hover {
  background: var(--nav-hover-bg) !important;
  color: var(--ui3-text-1) !important;
  border-color: transparent !important;
}

.nav-item.nav-active {
  background: var(--nav-active-bg) !important;
  color: var(--nav-active-text) !important;
  border-color: rgba(59,130,246,.25) !important;
  box-shadow: var(--nav-active-glow) !important;
  font-weight: 500 !important;
}

.nav-item.nav-active:hover {
  background: var(--nav-active-bg) !important;
}

/* Nav icon */
.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 13px;
  flex-shrink: 0;
  opacity: .7;
}

.nav-item.nav-active .nav-icon {
  opacity: 1;
}

/* Badge pills on nav items */
.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  flex-shrink: 0;
}
.nav-badge-amber { background: rgba(217,119,6,.2); color: #FCD34D; }
.nav-badge-blue  { background: rgba(59,130,246,.2); color: #93C5FD; }
.nav-badge-rose  { background: rgba(244,63,94,.2);  color: #FDA4AF; }

/* Trust layer widget */
#sidebar .trust-widget {
  margin: 8px 6px;
  padding: 12px 14px;
  background: var(--ui3-surface-1);
  border: 1px solid var(--ui3-border-1);
  border-radius: 8px;
}

/* ── Header upgrade ──────────────────────────────────────────────── */

#app > header {
  background: var(--ui3-bg-1) !important;
  border-bottom: 1px solid var(--ui3-border-1) !important;
  padding: 8px 16px !important;
}

/* ── Context bar upgrade — Phase UI-3 enhanced ───────────────────── */

#governance-context-bar {
  height: var(--ctx-bar-height) !important;
  background: var(--ui3-bg-2) !important;
  border-bottom: 1px solid var(--ui3-border-1) !important;
  padding: 0 16px !important;
  display: flex !important;
  align-items: center !important;
  gap: 0 !important;
  font-size: 11.5px !important;
  flex-shrink: 0 !important;
}

/* Phase UI-3 context bar pills */
.ctx-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ui3-text-1);
  white-space: nowrap;
}

.ctx-pill-entity {
  font-weight: 600;
  color: var(--ui3-text-0);
  padding-left: 4px;
}

.ctx-pill-label {
  color: var(--ui3-text-3);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.ctx-divider {
  width: 1px;
  height: 16px;
  background: var(--ui3-border-2);
  margin: 0 8px;
  flex-shrink: 0;
}

.ctx-spacer { flex: 1; }

.ctx-filing-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  border: 1px solid;
}

.ctx-filing-ready    { background: rgba(16,185,129,.1); color: #6EE7B7; border-color: rgba(16,185,129,.2); }
.ctx-filing-blocked  { background: rgba(244,63,94,.1);  color: #FDA4AF; border-color: rgba(244,63,94,.2); }
.ctx-filing-pending  { background: rgba(217,119,6,.1);  color: #FCD34D; border-color: rgba(217,119,6,.2); }
.ctx-filing-none     { background: var(--ui3-border-0); color: var(--ui3-text-3); border-color: var(--ui3-border-1); }

.ctx-open-items {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--ui3-text-2);
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background .12s;
}
.ctx-open-items:hover { background: var(--ui3-border-1); }
.ctx-open-items .count {
  font-weight: 700;
  color: #FCD34D;
}

/* ── Main content area ───────────────────────────────────────────── */

#accountant-view > main {
  background: var(--ui3-bg-0) !important;
}

section[id^="section-"] {
  padding: 0 !important;
}

.ui3-section-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--ui3-border-1);
  background: var(--ui3-bg-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  flex-shrink: 0;
}

.ui3-section-header h1 {
  font-size: 17px;
  font-weight: 600;
  color: var(--ui3-text-0);
  margin: 0;
  letter-spacing: -.01em;
}

.ui3-section-header p {
  font-size: 12px;
  color: var(--ui3-text-2);
  margin: 2px 0 0;
}

.ui3-section-body {
  padding: 20px 24px;
}

/* ══════════════════════════════════════════════════════════════════
   PREMIUM DATA TABLE
   ══════════════════════════════════════════════════════════════════ */

.ui3-table-wrap {
  background: var(--ui3-surface-1);
  border: 1px solid var(--ui3-border-1);
  border-radius: 10px;
  overflow: hidden;
}

.ui3-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ui3-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--table-header-bg);
}

.ui3-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ui3-text-3);
  border-bottom: 1px solid var(--ui3-border-1);
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.ui3-table thead th.right { text-align: right; }
.ui3-table thead th.center { text-align: center; }

.ui3-table tbody tr {
  border-bottom: 1px solid var(--ui3-border-0);
  transition: background .08s ease;
  cursor: pointer;
}

.ui3-table tbody tr:nth-child(even) {
  background: var(--table-zebra);
}

.ui3-table tbody tr:hover {
  background: var(--table-row-hover);
  box-shadow: inset 3px 0 0 var(--ui3-accent-blue);
}

.ui3-table tbody td {
  padding: 10px 14px;
  color: var(--ui3-text-1);
  vertical-align: middle;
}

.ui3-table tbody td.right { text-align: right; }
.ui3-table tbody td.center { text-align: center; }

.ui3-table tbody td.mono {
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  font-size: 11px;
}

/* Table text hierarchy */
.ui3-table .cell-primary {
  color: var(--ui3-text-0);
  font-weight: 500;
}

.ui3-table .cell-secondary {
  color: var(--ui3-text-2);
  font-size: 11px;
  margin-top: 1px;
}

.ui3-table .cell-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ui3-text-3);
}

/* ── Integrity badges in table rows ─────────────────────────────── */

.integrity-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  border-left: 3px solid;
  white-space: nowrap;
}

.integrity-pill-confirmed {
  background: rgba(16,185,129,.08);
  color: #6EE7B7;
  border-left-color: var(--ui3-accent-emerald);
}
.integrity-pill-inclusive {
  background: rgba(59,130,246,.08);
  color: #93C5FD;
  border-left-color: var(--ui3-accent-blue);
  border-left-style: dashed;
}
.integrity-pill-candidate {
  background: rgba(148,163,184,.06);
  color: #94A3B8;
  border-left-color: #475569;
  border-left-style: dotted;
}
.integrity-pill-unresolved {
  background: rgba(217,119,6,.08);
  color: #FCD34D;
  border-left-color: var(--ui3-accent-amber);
}
.integrity-pill-conflicted {
  background: rgba(244,63,94,.08);
  color: #FDA4AF;
  border-left-color: var(--ui3-accent-rose);
  border-left-style: double;
}
.integrity-pill-blocked {
  background: rgba(244,63,94,.12);
  color: #FCA5A5;
  border-left-color: var(--ui3-accent-rose);
}
.integrity-pill-insufficient {
  background: rgba(100,116,139,.08);
  color: #94A3B8;
  border-left-color: #334155;
}

/* Semantic reason labels */
.reason-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(217,119,6,.08);
  color: #FCD34D;
  border: 1px solid rgba(217,119,6,.15);
  white-space: nowrap;
}

.reason-label-rose {
  background: rgba(244,63,94,.08);
  color: #FDA4AF;
  border-color: rgba(244,63,94,.15);
}

.reason-label-blue {
  background: rgba(59,130,246,.08);
  color: #93C5FD;
  border-color: rgba(59,130,246,.15);
}

.reason-label-neutral {
  background: var(--ui3-border-0);
  color: var(--ui3-text-2);
  border-color: var(--ui3-border-1);
}

/* ── Intelligence summary below tx hash ────────────────────────── */
.tx-intelligence {
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--ui3-text-2);
}
.tx-intelligence .intel-flag {
  color: #FCD34D;
  font-weight: 600;
}
.tx-intelligence .intel-ok {
  color: #6EE7B7;
  font-weight: 600;
}

/* ── LP event row visual encoding ───────────────────────────────── */
.lp-event-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.lp-add      { background: rgba(16,185,129,.12); color: #6EE7B7; border: 1px solid rgba(16,185,129,.2); }
.lp-remove   { background: rgba(244,63,94,.10);  color: #FDA4AF; border: 1px solid rgba(244,63,94,.2); }
.lp-fee      { background: rgba(59,130,246,.10); color: #93C5FD; border: 1px solid rgba(59,130,246,.2); }
.lp-stake    { background: rgba(139,92,246,.10); color: #C4B5FD; border: 1px solid rgba(139,92,246,.2); }
.lp-unstake  { background: rgba(168,85,247,.10); color: #D8B4FE; border: 1px solid rgba(168,85,247,.2); }
.lp-rebase   { background: rgba(34,211,238,.10); color: #67E8F9; border: 1px solid rgba(34,211,238,.2); }
.lp-vault    { background: rgba(251,191,36,.10); color: #FDE68A; border: 1px solid rgba(251,191,36,.2); }
.lp-swap     { background: rgba(107,114,128,.10);color: #D1D5DB; border: 1px solid rgba(107,114,128,.2); }
.lp-claim    { background: rgba(16,185,129,.08); color: #A7F3D0; border: 1px solid rgba(16,185,129,.15); }

/* Protocol pair display */
.protocol-pair {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--ui3-text-0);
}

.protocol-pair .arrow {
  color: var(--ui3-text-3);
  font-size: 10px;
}

.protocol-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--ui3-surface-2);
  border: 1px solid var(--ui3-border-1);
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ui3-text-1);
}

/* ══════════════════════════════════════════════════════════════════
   REVIEW QUEUE — Operations Desk Layout
   3-column: left=tx summary, center=evidence/issue, right=actions
   ══════════════════════════════════════════════════════════════════ */

.ops-queue-row {
  display: grid;
  grid-template-columns: 2fr 3fr auto;
  gap: 0;
  background: var(--ui3-surface-1);
  border: 1px solid var(--ui3-border-1);
  border-radius: 8px;
  margin-bottom: 6px;
  overflow: hidden;
  transition: border-color .12s ease, box-shadow .12s ease;
}

.ops-queue-row:hover {
  border-color: rgba(59,130,246,.2);
  box-shadow: 0 0 0 1px rgba(59,130,246,.08);
}

.ops-queue-row.priority-high {
  border-left: 3px solid var(--ui3-accent-rose);
}
.ops-queue-row.priority-medium {
  border-left: 3px solid var(--ui3-accent-amber);
}
.ops-queue-row.priority-low {
  border-left: 3px solid var(--ui3-surface-3);
}

/* Left: tx summary */
.oq-left {
  padding: 14px 16px;
  border-right: 1px solid var(--ui3-border-0);
  cursor: pointer;
  min-width: 0;
}
.oq-left:hover { background: rgba(255,255,255,.015); }

.oq-tx-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.oq-chain-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--ui3-surface-2);
  border: 1px solid var(--ui3-border-1);
  color: var(--ui3-text-2);
  flex-shrink: 0;
}

.oq-hash {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ui3-text-2);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color .12s;
}
.oq-hash:hover { color: #93C5FD; }

.oq-timestamp {
  font-size: 10px;
  color: var(--ui3-text-3);
  margin-left: auto;
  flex-shrink: 0;
  white-space: nowrap;
}

.oq-asset-row {
  font-size: 12px;
  font-weight: 500;
  color: var(--ui3-text-0);
  margin-bottom: 4px;
}

.oq-amount {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--ui3-text-0);
}

.oq-usd-value {
  font-size: 10.5px;
  color: var(--ui3-text-2);
  margin-left: 4px;
}

.oq-wallets {
  font-size: 10.5px;
  color: var(--ui3-text-3);
  margin-top: 4px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.oq-wallet-addr {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  background: var(--ui3-surface-2);
  border: 1px solid var(--ui3-border-0);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--ui3-text-2);
}

/* Center: evidence / issue */
.oq-center {
  padding: 14px 16px;
  border-right: 1px solid var(--ui3-border-0);
  min-width: 0;
}

.oq-issue-primary {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ui3-text-0);
  margin-bottom: 5px;
}

.oq-issue-secondary {
  font-size: 11.5px;
  color: var(--ui3-text-2);
  margin-bottom: 8px;
  line-height: 1.5;
}

.oq-reason-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.oq-confidence-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.oq-confidence-bar-track {
  flex: 1;
  height: 3px;
  background: var(--ui3-surface-2);
  border-radius: 2px;
  overflow: hidden;
}

.oq-confidence-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .4s ease;
}

.oq-confidence-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--ui3-text-2);
  white-space: nowrap;
}

.oq-filing-impact {
  font-size: 10.5px;
  font-style: italic;
  color: var(--ui3-text-3);
  margin-top: 4px;
}

/* Right: actions */
.oq-right {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 130px;
  justify-content: center;
  flex-shrink: 0;
}

.oq-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  border: 1px solid;
  white-space: nowrap;
  width: 100%;
  background: none;
  text-align: center;
}

.oq-btn-evidence {
  background: rgba(59,130,246,.12);
  border-color: rgba(59,130,246,.25);
  color: #93C5FD;
}
.oq-btn-evidence:hover { background: rgba(59,130,246,.18); }

.oq-btn-attest {
  background: rgba(16,185,129,.1);
  border-color: rgba(16,185,129,.2);
  color: #6EE7B7;
}
.oq-btn-attest:hover { background: rgba(16,185,129,.16); }

.oq-btn-escalate {
  background: rgba(217,119,6,.08);
  border-color: rgba(217,119,6,.18);
  color: #FCD34D;
}
.oq-btn-escalate:hover { background: rgba(217,119,6,.14); }

.oq-btn-ask {
  background: var(--ui3-border-0);
  border-color: var(--ui3-border-1);
  color: var(--ui3-text-2);
}
.oq-btn-ask:hover { background: var(--ui3-border-1); color: var(--ui3-text-1); }

/* ══════════════════════════════════════════════════════════════════
   EVIDENCE DRAWER — The Hero Interaction
   Full-height right panel, slides in over main content.
   ══════════════════════════════════════════════════════════════════ */

#evidence-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: none;
  backdrop-filter: blur(1px);
}

#evidence-drawer-backdrop.open {
  display: block;
  animation: drawerBackdropIn .2s ease;
}

@keyframes drawerBackdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#evidence-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--drawer-width);
  max-width: 95vw;
  background: var(--ui3-bg-1);
  border-left: 1px solid var(--ui3-border-2);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.32,.72,0,1);
  box-shadow: -16px 0 48px rgba(0,0,0,.4);
}

#evidence-drawer.open {
  transform: translateX(0);
}

/* Drawer header */
.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--ui3-border-1);
  flex-shrink: 0;
  background: var(--ui3-bg-2);
}

.drawer-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.drawer-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ui3-text-0);
  letter-spacing: -.01em;
}

.drawer-subtitle {
  font-size: 11px;
  color: var(--ui3-text-2);
  margin-top: 2px;
}

.drawer-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--ui3-border-1);
  border: none;
  color: var(--ui3-text-2);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .12s;
}
.drawer-close:hover { background: var(--ui3-border-2); color: var(--ui3-text-0); }

.drawer-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.drawer-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 500;
  background: var(--ui3-surface-1);
  border: 1px solid var(--ui3-border-1);
  color: var(--ui3-text-2);
  white-space: nowrap;
}

.drawer-hash-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  cursor: pointer;
  transition: background .12s;
}
.drawer-hash-chip:hover { background: var(--ui3-surface-2); color: #93C5FD; }

/* Drawer tabs */
.drawer-tabs {
  display: flex;
  gap: 0;
  background: var(--ui3-bg-2);
  border-bottom: 1px solid var(--ui3-border-1);
  padding: 0 20px;
  overflow-x: auto;
  flex-shrink: 0;
}

.drawer-tab {
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ui3-text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color .12s, border-color .12s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.drawer-tab:hover { color: var(--ui3-text-1); }

.drawer-tab.active {
  color: #93C5FD;
  border-bottom-color: var(--ui3-accent-blue);
  font-weight: 600;
}

/* Drawer body */
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  min-height: 0;
}

.drawer-panel { display: none; }
.drawer-panel.active { display: block; }

/* Drawer data sections */
.drawer-section {
  margin-bottom: 20px;
}

.drawer-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ui3-text-3);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--ui3-border-0);
}

.drawer-kv {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.drawer-kv-item {
  background: var(--ui3-surface-1);
  border: 1px solid var(--ui3-border-0);
  border-radius: 6px;
  padding: 8px 12px;
}

.drawer-kv-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--ui3-text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 3px;
}

.drawer-kv-value {
  font-size: 12px;
  font-weight: 500;
  color: var(--ui3-text-0);
}

.drawer-kv-value.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

/* Raw evidence panel */
.drawer-raw-block {
  background: var(--ui3-bg-0);
  border: 1px solid var(--ui3-border-1);
  border-radius: 6px;
  padding: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ui3-text-1);
  white-space: pre-wrap;
  overflow-x: auto;
  line-height: 1.7;
  max-height: 320px;
  overflow-y: auto;
}

/* Lineage timeline */
.drawer-lineage-item {
  display: flex;
  gap: 12px;
  position: relative;
  padding-bottom: 16px;
}

.drawer-lineage-item:last-child {
  padding-bottom: 0;
}

.drawer-lineage-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 24px;
  bottom: 0;
  width: 1px;
  background: var(--ui3-border-1);
}

.drawer-lineage-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
  background: var(--ui3-bg-1);
}

.lineage-dot-confirmed { border-color: var(--ui3-accent-emerald); color: var(--ui3-accent-emerald); }
.lineage-dot-review    { border-color: var(--ui3-accent-amber); color: var(--ui3-accent-amber); }
.lineage-dot-import    { border-color: var(--ui3-accent-blue); color: var(--ui3-accent-blue); }
.lineage-dot-attest    { border-color: #8B5CF6; color: #8B5CF6; }

.drawer-lineage-content {
  flex: 1;
  min-width: 0;
}

.drawer-lineage-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ui3-text-0);
}

.drawer-lineage-detail {
  font-size: 11px;
  color: var(--ui3-text-2);
  margin-top: 2px;
}

.drawer-lineage-time {
  font-size: 10px;
  color: var(--ui3-text-3);
  margin-top: 2px;
}

/* Review history */
.drawer-review-item {
  background: var(--ui3-surface-1);
  border: 1px solid var(--ui3-border-0);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.drawer-review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.drawer-review-actor {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ui3-text-0);
}

.drawer-review-time {
  font-size: 10px;
  color: var(--ui3-text-3);
}

.drawer-review-note {
  font-size: 11.5px;
  color: var(--ui3-text-1);
  line-height: 1.5;
}

/* Drawer bottom actions — fixed at bottom */
.drawer-actions {
  border-top: 1px solid var(--ui3-border-1);
  padding: 14px 20px;
  background: var(--ui3-bg-2);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.drawer-action-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  border: 1px solid;
  background: none;
  white-space: nowrap;
}

.drawer-btn-primary {
  background: var(--ui3-accent-blue);
  border-color: var(--ui3-accent-blue);
  color: #fff;
  flex: none;
  padding: 9px 20px;
}
.drawer-btn-primary:hover { background: #2563EB; }

.drawer-btn-approve {
  background: rgba(16,185,129,.12);
  border-color: rgba(16,185,129,.25);
  color: #6EE7B7;
}
.drawer-btn-approve:hover { background: rgba(16,185,129,.2); }

.drawer-btn-escalate {
  background: rgba(217,119,6,.08);
  border-color: rgba(217,119,6,.2);
  color: #FCD34D;
}
.drawer-btn-escalate:hover { background: rgba(217,119,6,.14); }

.drawer-btn-ask {
  background: var(--ui3-border-0);
  border-color: var(--ui3-border-1);
  color: var(--ui3-text-2);
}
.drawer-btn-ask:hover { background: var(--ui3-border-1); color: var(--ui3-text-0); }

.drawer-btn-incomplete {
  background: rgba(244,63,94,.08);
  border-color: rgba(244,63,94,.15);
  color: #FDA4AF;
}
.drawer-btn-incomplete:hover { background: rgba(244,63,94,.14); }

/* ══════════════════════════════════════════════════════════════════
   DENSITY MODE TOGGLE
   ══════════════════════════════════════════════════════════════════ */

.density-toggle {
  display: flex;
  gap: 1px;
  background: var(--ui3-surface-1);
  border: 1px solid var(--ui3-border-1);
  border-radius: 6px;
  padding: 2px;
  flex-shrink: 0;
}

.density-btn {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, color .12s;
  color: var(--ui3-text-3);
  border: none;
  background: none;
}

.density-btn.active {
  background: var(--ui3-surface-3);
  color: var(--ui3-text-0);
}

.density-btn:hover:not(.active) {
  color: var(--ui3-text-2);
  background: var(--ui3-border-0);
}

/* Density: Executive mode — fewer columns, bigger text */
body.density-executive .ui3-table .hide-executive { display: none !important; }
body.density-executive .ui3-table tbody td { padding: 13px 14px; font-size: 13px; }
body.density-executive .ui3-table thead th { padding: 12px 14px; }

/* Density: Client mode — simplified, no technical columns */
body.density-client .ui3-table .hide-client { display: none !important; }
body.density-client .ui3-table tbody td { padding: 12px 14px; font-size: 13px; }
body.density-client .integrity-pill { display: none; }

/* ══════════════════════════════════════════════════════════════════
   CLIENT PORTAL SURFACE
   ══════════════════════════════════════════════════════════════════ */

#client-view {
  background: var(--ui3-bg-0);
}

.client-welcome-banner {
  background: linear-gradient(135deg, var(--ui3-bg-2) 0%, var(--ui3-surface-1) 100%);
  border: 1px solid var(--ui3-border-2);
  border-radius: 10px;
  padding: 24px 28px;
  margin-bottom: 20px;
}

.client-status-card {
  background: var(--ui3-surface-1);
  border: 1px solid var(--ui3-border-1);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 10px;
  transition: border-color .12s;
}

.client-status-card:hover { border-color: var(--ui3-border-2); }

.client-status-card.needs-action {
  border-left: 3px solid var(--ui3-accent-amber);
}

.client-status-card.ok {
  border-left: 3px solid var(--ui3-accent-emerald);
}

.client-action-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(217,119,6,.12);
  border: 1px solid rgba(217,119,6,.2);
  color: #FCD34D;
}

.client-translation {
  font-size: 13px;
  color: var(--ui3-text-0);
  font-weight: 500;
  line-height: 1.5;
}

.client-translation-detail {
  font-size: 12px;
  color: var(--ui3-text-2);
  margin-top: 4px;
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════════════
   ACTION CENTER — Not vanity metrics
   ══════════════════════════════════════════════════════════════════ */

.action-center-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.action-center-card {
  background: var(--ui3-surface-1);
  border: 1px solid var(--ui3-border-1);
  border-radius: 8px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
}

.action-center-card:hover {
  border-color: rgba(59,130,246,.2);
  box-shadow: 0 0 0 1px rgba(59,130,246,.06);
}

.action-center-card.urgent {
  border-color: rgba(244,63,94,.2);
  background: rgba(244,63,94,.03);
}

.action-center-card.urgent:hover {
  border-color: rgba(244,63,94,.3);
}

.action-count {
  font-size: 28px;
  font-weight: 700;
  color: var(--ui3-text-0);
  line-height: 1;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.action-count.urgent { color: #FDA4AF; }
.action-count.amber  { color: #FCD34D; }
.action-count.ok     { color: #6EE7B7; }

.action-label {
  font-size: 12px;
  color: var(--ui3-text-2);
  font-weight: 500;
}

.action-sublabel {
  font-size: 10.5px;
  color: var(--ui3-text-3);
  margin-top: 2px;
}

/* Client attention list */
.client-attention-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ui3-border-0);
  gap: 12px;
  cursor: pointer;
  transition: background .08s;
}

.client-attention-row:last-child { border-bottom: none; }
.client-attention-row:hover { background: var(--ui3-border-0); }

.client-attention-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ui3-text-0);
}

.client-attention-reason {
  font-size: 11px;
  color: var(--ui3-text-2);
  margin-top: 1px;
}

/* ══════════════════════════════════════════════════════════════════
   SEARCH / FILTER BAR
   ══════════════════════════════════════════════════════════════════ */

.ui3-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--ui3-bg-1);
  border-bottom: 1px solid var(--ui3-border-1);
  flex-shrink: 0;
}

.ui3-search-input {
  flex: 1;
  min-width: 0;
  background: var(--ui3-surface-1);
  border: 1px solid var(--ui3-border-1);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--ui3-text-0);
  outline: none;
  transition: border-color .12s;
}
.ui3-search-input:focus { border-color: rgba(59,130,246,.4); }
.ui3-search-input::placeholder { color: var(--ui3-text-3); }

.ui3-filter-select {
  background: var(--ui3-surface-1);
  border: 1px solid var(--ui3-border-1);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--ui3-text-1);
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════
   BUTTON UTILITIES
   ══════════════════════════════════════════════════════════════════ */

.ui3-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  border: 1px solid;
  white-space: nowrap;
  background: none;
}

.ui3-btn-primary {
  background: var(--ui3-accent-blue);
  border-color: var(--ui3-accent-blue);
  color: #fff;
}
.ui3-btn-primary:hover { background: #2563EB; }

.ui3-btn-secondary {
  background: var(--ui3-border-0);
  border-color: var(--ui3-border-1);
  color: var(--ui3-text-1);
}
.ui3-btn-secondary:hover { background: var(--ui3-border-1); color: var(--ui3-text-0); }

.ui3-btn-ghost {
  background: none;
  border-color: transparent;
  color: var(--ui3-text-2);
}
.ui3-btn-ghost:hover { background: var(--ui3-border-0); color: var(--ui3-text-1); }

/* Scrollbar override */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ui3-surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ui3-border-2); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --drawer-width: 100vw; }
  .ops-queue-row { grid-template-columns: 1fr; }
  .oq-left, .oq-center { border-right: none; border-bottom: 1px solid var(--ui3-border-0); }
  .oq-right { flex-direction: row; flex-wrap: wrap; }
  .action-center-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .action-center-row { grid-template-columns: 1fr; }
  .drawer-kv { grid-template-columns: 1fr; }
}
