/* =====================================================================
   UML Activity Intake — app.css
   ===================================================================== */

/* ----- Custom properties -------------------------------------------- */
:root {
  --brand: #e67e22;
  --brand-hover: #d35400;
  --brand-soft: rgba(230, 126, 34, 0.14);
  --link: #93c5fd;
  --navy: #050506;
  --blue: #3b82f6;
  --bg: #070708;
  --bg-soft: #0c0c10;
  --panel: #12121a;
  --panel-2: #18181f;
  --panel-muted: #22222c;
  --white: #f4f4f5;
  --text: #ececf1;
  --muted: #9aa3b2;
  --border: #2a2e38;
  --success: #34d399;
  --warn: #fbbf24;
  --error: #f87171;

  --radius: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
  --nav-h: 58px;
  --transition: 160ms ease;
}

/* ----- Reset --------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html { height: 100%; font-size: 16px; }
body {
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, rgba(230, 126, 34, 0.08), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(59, 130, 246, 0.06), transparent 50%),
    var(--bg);
  min-height: 100%;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font: inherit; }
input, select, textarea { font: inherit; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }

/* =====================================================================
   LOGIN PAGE
   ===================================================================== */
body.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 0%, rgba(230, 126, 34, 0.12), transparent 50%),
    linear-gradient(165deg, #050506 0%, #0e1018 45%, #070708 100%);
  padding: 24px;
}

.login-card {
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 48px 40px 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-logo {
  display: inline-block;
  margin-bottom: 28px;
}

.login-logo img {
  margin: 0 auto;
}

.login-title {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.login-subtitle {
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 32px;
}

.ms-signin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 20px;
  background: var(--brand);
  border: 1.5px solid var(--brand);
  border-radius: var(--radius);
  font-size: .92rem;
  font-weight: 600;
  color: #0a0a0a;
  transition: background var(--transition), border-color var(--transition),
              box-shadow var(--transition), transform var(--transition);
}
.ms-signin-btn:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  box-shadow: 0 4px 20px rgba(230, 126, 34, 0.35);
  text-decoration: none;
}
.ms-signin-btn:active {
  transform: translateY(1px);
}
.ms-logo {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.error-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: var(--radius);
  color: #fecaca;
  font-size: .87rem;
  padding: 12px 14px;
  margin-bottom: 20px;
  text-align: left;
  line-height: 1.45;
}
.error-banner svg { flex-shrink: 0; margin-top: 1px; }

.login-help {
  margin-top: 24px;
  font-size: .82rem;
  color: var(--muted);
}
.login-help a { color: var(--brand); }

.login-footer {
  margin-top: 36px;
  font-size: .78rem;
  color: #5c6370;
}

/* =====================================================================
   NAVBAR
   ===================================================================== */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  background: linear-gradient(180deg, #08080a 0%, #050506 100%);
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 0;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 28px;
}
.nav-brand:hover { text-decoration: none; color: var(--white); }
.nav-logo-img {
  height: 40px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  border-radius: 4px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.nav-link {
  color: rgba(255,255,255,.75);
  font-size: .9rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.nav-link:hover {
  background: rgba(255,255,255,.10);
  color: var(--white);
  text-decoration: none;
}
.nav-link.active {
  background: rgba(255,255,255,.16);
  color: var(--white);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.20);
  border-radius: 20px;
  color: var(--white);
  padding: 5px 12px 5px 8px;
  font-size: .88rem;
  font-weight: 500;
  transition: background var(--transition);
}
.user-menu-btn:hover { background: rgba(255,255,255,.18); }
.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: #0a0a0a;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.user-menu-caret {
  width: 14px; height: 14px;
  margin-left: 2px;
  opacity: .7;
  transition: transform var(--transition);
}
.user-menu-btn[aria-expanded="true"] .user-menu-caret {
  transform: rotate(180deg);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  display: none;
}
.user-dropdown.open { display: block; }

.user-dropdown-header {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
}
.user-dropdown-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-dropdown-email {
  font-size: .87rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}
.user-dropdown-role {
  margin-top: 8px;
}

.user-dropdown-footer {
  padding: 8px;
}
.signout-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--error);
  font-size: .93rem;
  font-weight: 500;
  transition: background var(--transition);
}
.signout-btn:hover { background: rgba(248,113,113,.08); }

/* =====================================================================
   MAIN CONTENT
   ===================================================================== */
main {
  padding-top: var(--nav-h);
  min-height: 100vh;
}

.content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

/* =====================================================================
   PAGE HEADER
   ===================================================================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.4px;
}

.page-kicker {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brand);
  margin-bottom: 4px;
}

.page-sub {
  margin-top: 8px;
  font-size: .9rem;
  color: var(--muted);
  max-width: 52ch;
}

.dashboard-hero {
  align-items: flex-start;
}

.summary-chip {
  display: inline-flex;
  align-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: .78rem;
  font-weight: 600;
  margin-left: 10px;
  vertical-align: middle;
  border: 1px solid rgba(230, 126, 34, 0.35);
}

/* =====================================================================
   CARD
   ===================================================================== */
.card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.dashboard-card {
  background: var(--panel);
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

/* =====================================================================
   TAB BAR
   ===================================================================== */
.tab-bar {
  display: flex;
  align-items: stretch;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  gap: 2px;
  overflow: visible;
  position: relative;
  flex-wrap: nowrap;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 13px 16px 11px;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: .88rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--panel-muted);
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
}
.tab.active .tab-count {
  background: var(--brand-soft);
  color: var(--brand);
}

.tab-overflow {
  margin-left: auto;
  display: flex;
  align-items: center;
  position: relative;
}

.tab-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .83rem;
  color: var(--muted);
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}
.tab-more-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.tab-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: none;
  overflow: hidden;
}
.tab-dropdown.open { display: block; }

.dropdown-tab-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  font-size: .93rem;
  color: var(--text);
  cursor: pointer;
  gap: 12px;
  transition: background var(--transition);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}
.dropdown-tab-item:hover { background: var(--bg); }
.dropdown-tab-item.active {
  color: var(--brand);
  font-weight: 600;
}

/* =====================================================================
   TAB FILTERS
   ===================================================================== */
.tab-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.filter-input,
.filter-select {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .86rem;
  color: var(--text);
  background: var(--bg-soft);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.filter-input { min-width: 220px; }
.filter-select { padding-right: 28px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; }
.filter-input:focus, .filter-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.2);
}

/* =====================================================================
   DATA TABLE
   ===================================================================== */
.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.data-table th {
  background: var(--panel-2);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table th.center,
.data-table td.center { text-align: center; }
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
  color: var(--text);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgba(230, 126, 34, 0.06); }

/* Column width helpers */
.col-time   { width: 90px;  white-space: nowrap; }
.col-from   { width: 200px; }
.col-subject{ max-width: 260px; }
.col-icon   { width: 48px; }

.col-subject span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filename {
  font-size: .79rem;
  color: var(--muted);
  margin-top: 1px;
}

/* Sender cell */
.sender-cell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.sender-init {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-soft) 0%, rgba(59,130,246,0.15) 100%);
  border: 1px solid rgba(230, 126, 34, 0.3);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sender-init-sm {
  width: 26px;
  height: 26px;
  font-size: .68rem;
}

.sender-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sender-name {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 130px;
}

.sender-email {
  display: block;
  font-size: .75rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 130px;
  opacity: 0;
  max-height: 0;
  transition: opacity 150ms ease, max-height 150ms ease;
}

.sender-cell:hover .sender-email,
.sender-cell-sm .sender-email {
  opacity: 1;
  max-height: 20px;
}

.sender-cell-sm .sender-name {
  max-width: 200px;
}
.sender-cell-sm .sender-email {
  max-width: 200px;
}

/* Expand button */
.expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-size: .78rem;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), transform var(--transition);
}
.expand-btn:hover {
  background: var(--bg);
  border-color: #aab4c0;
  color: var(--text);
}
.expand-btn.open {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
  transform: rotate(90deg);
}

/* Expanded row highlight */
.doc-row.expanded td { background: rgba(230, 126, 34, 0.08); }

/* Detail row */
.detail-row td {
  padding: 0;
  background: #070708;
  border-bottom: 1px solid #2a2e38;
}
.detail-row td:hover { background: #070708 !important; }

.expand-panel {
  padding: 16px 18px 18px;
}

.expand-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 6px 12px;
  align-items: baseline;
}

.expand-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
}
.expand-val {
  font-size: .86rem;
  color: var(--text);
  word-break: break-all;
}
.mono-sm {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: .78rem;
  color: var(--muted);
  word-break: break-all;
}

/* =====================================================================
   STATUS ICONS
   ===================================================================== */
.status-ok      { color: var(--success); }
.status-pending { color: var(--warn); }
.status-error   { color: var(--error); }
.status-dash    { color: var(--border); }

/* =====================================================================
   BADGES
   ===================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: .76rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-error   { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-gray    { background: #f3f4f6; color: #374151; }
.badge-blue    { background: #dbeafe; color: #1d4ed8; }
.badge-purple  { background: #ede9fe; color: #5b21b6; }
.badge-navy    { background: #dde9f7; color: var(--navy); }
.badge-teal    { background: #ccfbf1; color: #0f766e; }

/* =====================================================================
   BUTTONS
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 500;
  border: 1.5px solid transparent;
  transition: background var(--transition), border-color var(--transition),
              box-shadow var(--transition), opacity var(--transition),
              transform 100ms ease;
  line-height: 1;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--brand);
  color: #0a0a0a;
  border-color: var(--brand);
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  box-shadow: 0 4px 18px rgba(230, 126, 34, 0.35);
}

.btn-secondary {
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--border);
  transition: background var(--transition), border-color var(--transition), transform 100ms ease;
}
.btn-secondary:hover:not(:disabled) {
  background: var(--panel-muted);
  border-color: #3b4250;
  transform: translateY(-1px);
}
.btn-secondary:active:not(:disabled) { transform: translateY(0) scale(0.97); }

.btn-danger-outline {
  background: var(--white);
  color: var(--error);
  border-color: #fca5a5;
}
.btn-danger-outline:hover:not(:disabled) {
  background: #fef2f2;
  border-color: var(--error);
}

.btn-success-outline {
  background: var(--white);
  color: var(--success);
  border-color: #86efac;
}
.btn-success-outline:hover:not(:disabled) {
  background: #f0fdf4;
  border-color: var(--success);
}

.btn-sm {
  padding: 5px 11px;
  font-size: .82rem;
}

/* =====================================================================
   PAGINATION
   ===================================================================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 16px;
  border-top: 1px solid var(--border);
}
.pagination-info {
  color: var(--muted);
  font-size: .82rem;
  margin-right: auto;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: .85rem;
  transition: background var(--transition), border-color var(--transition);
}
.page-btn:hover:not(:disabled) { background: var(--panel-muted); border-color: #3b4250; }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }
.page-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #0a0a0a;
  font-weight: 600;
}

/* =====================================================================
   SUBTABS
   ===================================================================== */
.subtab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}

.subtab {
  padding: 8px 16px 10px;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: .88rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  background: none;
  border-top: none; border-left: none; border-right: none;
}
.subtab:hover { color: var(--text); }
.subtab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}

/* =====================================================================
   ACTION BUTTONS (inline row)
   ===================================================================== */
.action-btns {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* =====================================================================
   MODAL
   ===================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in 140ms ease;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(16px); opacity: 0; }
                      to   { transform: translateY(0);    opacity: 1; } }
@keyframes slide-right { from { transform: translateX(100%); }
                         to   { transform: translateX(0); } }

.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  animation: slide-up 180ms ease;
  overflow: hidden;
}

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

.modal-lead {
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.modal-close {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: var(--radius);
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-form { padding: 20px 22px; }

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

/* =====================================================================
   DRAWER
   ===================================================================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 300;
  animation: fade-in 140ms ease;
}

.drawer-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 420px;
  max-width: 100vw;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 32px rgba(0,0,0,.45);
  z-index: 301;
  display: flex;
  flex-direction: column;
  animation: slide-right 200ms ease;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
}

.drawer-form { display: flex; flex-direction: column; gap: 18px; }

.drawer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
  flex-shrink: 0;
}

/* =====================================================================
   FORMS
   ===================================================================== */
.form-group { display: flex; flex-direction: column; gap: 5px; }

.form-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
}
.req { color: var(--error); margin-left: 2px; }

.form-input {
  height: 38px;
  padding: 0 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .88rem;
  color: var(--text);
  background: var(--bg-soft);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.2);
}
.form-input:read-only {
  background: var(--panel-muted);
  color: var(--muted);
  cursor: default;
}
select.form-input {
  padding-right: 28px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  cursor: pointer;
}
select.form-input:disabled {
  background-color: var(--panel-muted);
  color: var(--muted);
  cursor: not-allowed;
}

.form-textarea {
  width: 100%;
  min-height: 100px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .88rem;
  color: var(--text);
  background: var(--bg-soft);
  outline: none;
  resize: vertical;
  line-height: 1.45;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.2);
}

.form-error {
  font-size: .81rem;
  color: var(--error);
  margin-top: 2px;
}
.hint {
  font-size: .8rem;
  color: var(--muted);
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.radio-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: .88rem;
}
.radio-label input[type="radio"] {
  margin-top: 2px;
  accent-color: var(--brand);
  flex-shrink: 0;
}
.radio-desc {
  font-size: .8rem;
  color: var(--muted);
  margin-top: 2px;
}

/* =====================================================================
   TOAST
   ===================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: .88rem;
  font-weight: 500;
  max-width: 340px;
  pointer-events: all;
  animation: slide-up 200ms ease;
  color: var(--white);
}
.toast-success { background: #166534; }
.toast-error   { background: #991b1b; }
.toast-info    { background: #2d3748; }

/* =====================================================================
   INTAKE REVIEW PANEL — legacy (kept for safety)
   ===================================================================== */
.review-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* =====================================================================
   INTAKE REVIEW PANEL — redesigned (rp-*)
   ===================================================================== */
.rp-shell {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #0e0e14;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #2a2e38;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}

/* Status strip */
.rp-status-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: .84rem;
  line-height: 1.4;
}
.rp-status-ready {
  background: rgba(52, 211, 153, 0.1);
  border-bottom: 1px solid rgba(52, 211, 153, 0.22);
  color: #86efcc;
}
.rp-status-pending {
  background: rgba(251, 191, 36, 0.09);
  border-bottom: 1px solid rgba(251, 191, 36, 0.22);
  color: #fcd34d;
}
.rp-status-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.rp-status-ready  .rp-status-dot { background: var(--success); box-shadow: 0 0 6px rgba(52,211,153,.6); }
.rp-status-pending .rp-status-dot { background: var(--warn);    box-shadow: 0 0 6px rgba(251,191,36,.5); animation: pulse-dot 1.8s ease-in-out infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* Email header block */
.rp-email-header {
  padding: 18px 20px 16px;
  border-bottom: 1px solid #2a2e38;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rp-email-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.rp-sender {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.rp-sender-avatar {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(230,126,34,.25) 0%, rgba(59,130,246,.2) 100%);
  border: 1.5px solid rgba(230,126,34,.4);
  color: #e67e22;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .03em;
}
.rp-sender-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.rp-sender-name {
  font-size: .95rem;
  font-weight: 600;
  color: #f0f0f6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rp-sender-addr {
  font-size: .83rem;
  color: #8a93a6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rp-email-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.rp-time {
  font-size: .83rem;
  color: #8a93a6;
  white-space: nowrap;
}
.rp-subject {
  font-size: 1.05rem;
  font-weight: 600;
  color: #f0f0f5;
  line-height: 1.35;
  letter-spacing: -.015em;
}
.rp-attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1c1c28;
  border: 1px solid #2a2e38;
  border-radius: 6px;
  padding: 5px 11px;
  font-size: .78rem;
  color: #9aa3b2;
  max-width: fit-content;
}
.rp-attachment svg { opacity: .55; flex-shrink: 0; }

/* Section wrapper */
.rp-section {
  padding: 16px 20px;
  border-bottom: 1px solid #222230;
}
.rp-section:last-child { border-bottom: none; }
.rp-section-label {
  font-size: .69rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #e67e22;
  margin-bottom: 14px;
}
.rp-section-label-hint {
  color: #7a8494;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-size: .69rem;
}
.rp-note {
  font-size: .86rem;
  color: #8a93a6;
  line-height: 1.6;
  margin-top: 12px;
}

/* Classifier stat cards */
.rp-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 820px) { .rp-stats-row { grid-template-columns: repeat(2, 1fr); } }
.rp-stat {
  background: #18181f;
  border: 1px solid #2a2e38;
  border-radius: 8px;
  padding: 13px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 160ms ease, background 160ms ease;
}
.rp-stat:hover { border-color: #3b4250; background: #1c1c26; }
.rp-stat-accent {
  background: linear-gradient(145deg, rgba(230,126,34,.12) 0%, #18181f 65%);
  border-color: rgba(230,126,34,.32);
}
.rp-stat-accent:hover { border-color: rgba(230,126,34,.55); }
.rp-stat-label {
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: #7a8494;
}
.rp-stat-val {
  font-size: .88rem;
  font-weight: 600;
  color: #e8e8f0;
  line-height: 1.35;
}
.rp-stat-pct {
  font-size: 1.35rem;
  font-weight: 800;
  color: #e67e22;
  line-height: 1;
}
.rp-stat-pct small { font-size: .72rem; font-weight: 700; color: #e67e22; margin-left: 1px; }

/* PDF preview */
.rp-pdf-section { padding-bottom: 4px; }

.pdf-preview-mount {
  background: #0a0a10;
  border: 1px solid #222230;
  border-radius: 8px;
  overflow: hidden;
  display: inline-flex;
  flex-direction: column;
}

.pdf-viewport-wrap {
  position: relative;
  width: fit-content;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: #141420;
  padding: 8px;
  border-radius: 6px 6px 0 0;
  cursor: zoom-in;
}
.pdf-viewport-wrap:hover .pdf-expand-hint { opacity: 1; }

.pdf-expand-hint {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(10,10,20,.82);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 5px;
  padding: 4px 8px;
  font-size: .72rem;
  color: #c8d0e8;
  font-family: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
  backdrop-filter: blur(4px);
}

.pdf-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 3px;
  box-shadow: 0 2px 16px rgba(0,0,0,.6);
}

.pdf-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10,10,16,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.pdf-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 8px;
  background: #0e0e18;
  border-top: 1px solid #1e1e2c;
}

.pdf-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  background: #1c1c2c;
  border: 1px solid #2e3040;
  border-radius: 5px;
  color: #c0c8dc;
  font-size: .75rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 100ms ease;
}
.pdf-nav-btn:hover:not(:disabled) {
  background: #252538;
  border-color: #3e4258;
  color: #e8eaf6;
  transform: translateY(-1px);
}
.pdf-nav-btn:active:not(:disabled) { transform: translateY(0) scale(.97); }
.pdf-nav-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.pdf-page-label {
  font-size: .72rem;
  color: #8a93a6;
  min-width: 60px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.pdf-unsupported {
  padding: 24px 20px;
  font-size: .84rem;
  color: #6a7385;
  text-align: center;
}

/* PDF lightbox */
.pdf-lb-backdrop {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0,0,0,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 180ms ease;
}
.pdf-lb-backdrop.pdf-lb-in  { opacity: 1; }
.pdf-lb-backdrop.pdf-lb-out { opacity: 0; }

.pdf-lb-box {
  background: #0e0e18;
  border: 1px solid #2a2e42;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0,0,0,.7);
  display: flex;
  flex-direction: column;
  max-width: 860px;
  width: 100%;
  max-height: calc(100vh - 48px);
  overflow: hidden;
  transform: scale(.94);
  transition: transform 180ms ease;
}
.pdf-lb-backdrop.pdf-lb-in .pdf-lb-box { transform: scale(1); }

.pdf-lb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #1e2030;
  flex-shrink: 0;
}
.pdf-lb-title {
  font-size: .9rem;
  font-weight: 600;
  color: #d0d8f0;
}
.pdf-lb-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px;
  color: #8a93b0;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.pdf-lb-close:hover { background: rgba(255,255,255,.12); color: #e8eaf6; }

.pdf-lb-canvas-wrap {
  position: relative;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  background: #0a0a12;
}
.pdf-lb-canvas {
  display: block;
  border-radius: 4px;
  box-shadow: 0 4px 30px rgba(0,0,0,.6);
  max-width: 100%;
}
.pdf-lb-loading {
  position: absolute;
  inset: 0;
  background: rgba(10,10,18,.7);
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}

.pdf-lb-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 12px 18px;
  background: #0e0e18;
  border-top: 1px solid #1e2030;
  flex-shrink: 0;
}
.pdf-lb-controls .pdf-nav-btn {
  padding: 6px 16px;
  font-size: .84rem;
}
.pdf-lb-label {
  min-width: 100px;
  font-size: .84rem;
}

/* Action buttons */
.rp-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  background: #111118;
  border-top: 1px solid #2a2e38;
  flex-wrap: wrap;
}

.rp-btn-approve {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 26px;
  background: linear-gradient(135deg, #fb923c 0%, #e67e22 55%, #c2681a 100%);
  color: #0a0a0a;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .015em;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255,255,255,.14) inset,
              0 3px 12px rgba(230,126,34,.35),
              0 1px 3px rgba(0,0,0,.4);
  transition: filter 150ms ease, transform 100ms ease, box-shadow 150ms ease;
  position: relative;
  overflow: hidden;
}
.rp-btn-approve::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.08) 0%, transparent 60%);
  pointer-events: none;
}
.rp-btn-approve:hover:not(:disabled) {
  filter: brightness(1.1) saturate(1.1);
  box-shadow: 0 1px 0 rgba(255,255,255,.14) inset,
              0 6px 24px rgba(230,126,34,.55),
              0 2px 6px rgba(0,0,0,.5);
  transform: translateY(-2px);
}
.rp-btn-approve:active:not(:disabled) {
  filter: brightness(.95);
  transform: translateY(0) scale(.97);
  box-shadow: 0 1px 0 rgba(255,255,255,.1) inset, 0 2px 8px rgba(230,126,34,.3);
}
.rp-btn-approve:disabled { opacity: .45; cursor: not-allowed; }

.rp-btn-override {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 50%, #b91c1c 100%);
  color: #fecaca;
  border: 1px solid rgba(248,113,113,.25);
  border-radius: 8px;
  font-family: inherit;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset,
              0 3px 10px rgba(185,28,28,.35),
              0 1px 3px rgba(0,0,0,.4);
  transition: filter 150ms ease, transform 100ms ease, box-shadow 150ms ease;
  position: relative;
  overflow: hidden;
}
.rp-btn-override::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.06) 0%, transparent 60%);
  pointer-events: none;
}
.rp-btn-override:hover:not(:disabled) {
  filter: brightness(1.12) saturate(1.1);
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset,
              0 5px 20px rgba(185,28,28,.5),
              0 2px 6px rgba(0,0,0,.5);
  transform: translateY(-2px);
}
.rp-btn-override:active:not(:disabled) {
  filter: brightness(.9);
  transform: translateY(0) scale(.97);
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 2px 6px rgba(185,28,28,.3);
}
.rp-btn-override:disabled { opacity: .45; cursor: not-allowed; }

.review-banner {
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: .86rem;
  line-height: 1.45;
  border: 1px solid var(--border);
}
.review-banner-warn {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fde68a;
}
.review-banner-ok {
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.3);
  color: #a7f3d0;
}

.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 900px) {
  .review-grid { grid-template-columns: 1fr; }
}

.review-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.review-card-accent {
  background: linear-gradient(145deg, rgba(230, 126, 34, 0.07) 0%, var(--panel) 55%);
  border-color: rgba(230, 126, 34, 0.25);
}
.review-card-full {
  grid-column: 1 / -1;
}

.review-card-head {
  margin-bottom: 14px;
}
.review-card-eyebrow {
  display: block;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand);
  margin-bottom: 4px;
}
.review-card-title {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.review-dl {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.review-dl-row {
  display: grid;
  grid-template-columns: minmax(100px, 130px) 1fr;
  gap: 8px 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: .84rem;
}
.review-dl-row:last-child { border-bottom: none; }
.review-dl-row dt {
  color: var(--muted);
  font-weight: 600;
}
.review-dl-row dd {
  color: var(--text);
  word-break: break-word;
}

.review-facts {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.review-facts li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: .8rem;
}
.review-facts li span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: .68rem;
  font-weight: 600;
}
.review-facts li strong {
  font-size: .92rem;
  font-weight: 600;
  color: var(--text);
}

.review-note {
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.45;
}
.review-pii-hint {
  margin-top: 10px;
}

.masked-pre {
  margin: 0;
  max-height: 320px;
  overflow: auto;
  padding: 14px 16px;
  background: #050508;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: .78rem;
  line-height: 1.5;
  color: #d1d5db;
  white-space: pre-wrap;
  word-break: break-word;
}

.masked-empty {
  padding: 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.5;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
}

.btn-approve {
  background: linear-gradient(135deg, #f97316 0%, var(--brand) 100%);
  color: #0a0a0a;
  border: 1.5px solid var(--brand);
  font-weight: 700;
  padding: 10px 22px;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(230, 126, 34, 0.2), 0 0 0 0 rgba(230, 126, 34, 0);
  transition: background var(--transition), border-color var(--transition),
              box-shadow var(--transition), transform 100ms ease;
  letter-spacing: 0.01em;
}
.btn-approve:hover:not(:disabled) {
  background: linear-gradient(135deg, #fb923c 0%, var(--brand-hover) 100%);
  border-color: var(--brand-hover);
  box-shadow: 0 4px 20px rgba(230, 126, 34, 0.4), 0 0 0 3px rgba(230, 126, 34, 0.15);
  transform: translateY(-1px);
}
.btn-approve:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 8px rgba(230, 126, 34, 0.25);
}

.btn-override {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--border);
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius);
  transition: background var(--transition), border-color var(--transition),
              color var(--transition), transform 100ms ease;
}
.btn-override:hover:not(:disabled) {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.07);
  transform: translateY(-1px);
}
.btn-override:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.btn-danger-solid {
  background: #b91c1c;
  color: #fff;
  border: 1.5px solid #b91c1c;
  font-weight: 600;
  transition: background var(--transition), border-color var(--transition),
              box-shadow var(--transition), transform 100ms ease;
}
.btn-danger-solid:hover:not(:disabled) {
  background: #991b1b;
  border-color: #991b1b;
  box-shadow: 0 4px 16px rgba(185, 28, 28, 0.35);
  transform: translateY(-1px);
}
.btn-danger-solid:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

/* Tech details toggle */
.tech-details-wrap {
  margin-top: 10px;
  border-top: 1px solid #222230;
  padding-top: 8px;
}

.tech-details-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: #7a8494;
  font-size: .82rem;
  font-weight: 500;
  padding: 4px 0;
  cursor: pointer;
  transition: color 150ms ease;
}
.tech-details-toggle:hover { color: #c0c8d8; }
.tech-chevron {
  transition: transform 200ms ease;
  opacity: .55;
}
.tech-details-toggle.is-open .tech-chevron { transform: rotate(180deg); }

.tech-details-body .review-dl-row { border-color: #1e1e28; }
.tech-details-body .review-dl-row dt { font-size: .8rem; color: #5a6374; }
.tech-details-body .review-dl-row dd { font-size: .82rem; color: #9aa3b2; }

/* =====================================================================
   UTILITIES
   ===================================================================== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--muted);
  font-size: .9rem;
  gap: 10px;
}
.loading::before,
.loading-sm::before {
  content: '';
  display: inline-block;
  width: 18px; height: 18px;
  border: 2.5px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
.loading-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: .82rem;
}
.loading-sm::before { width: 13px; height: 13px; border-width: 2px; }

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  color: var(--muted);
  gap: 10px;
  text-align: center;
}
.empty-state svg { opacity: .35; }
.empty-state p { font-size: .9rem; }

.error-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: var(--radius);
  color: #fecaca;
  font-size: .88rem;
}

.muted { color: var(--muted); }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 768px) {
  .content { padding: 16px 12px 32px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .drawer-panel { width: 100vw; }
  .tab-bar { padding: 0 8px; }
  .tab { padding: 12px 10px 10px; font-size: .83rem; }
  .data-table th, .data-table td { padding: 8px 8px; }
  .filter-input { min-width: 160px; }
}

/* =====================================================================
   THEME TOGGLE BUTTON
   ===================================================================== */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.75);
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), transform 120ms ease;
}
.theme-toggle-btn:hover {
  background: rgba(255,255,255,.18);
  color: #fff;
  transform: rotate(18deg);
}

/* =====================================================================
   LIGHT THEME — variable overrides
   ===================================================================== */
html[data-theme="light"] {
  --bg:          #f1f3f8;
  --bg-soft:     #ffffff;
  --panel:       #ffffff;
  --panel-2:     #f6f7fc;
  --panel-muted: #eceef5;
  --text:        #1a1a2e;
  --muted:       #6b7280;
  --border:      #dde1ea;
  --link:        #2563eb;
  --shadow:      0 4px 24px rgba(0,0,0,.08);
  --shadow-lg:   0 20px 50px rgba(0,0,0,.12);
}

/* Body background */
html[data-theme="light"] body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(230,126,34,.05), transparent 55%),
    radial-gradient(900px 500px at 90% 0%,   rgba(59,130,246,.04), transparent 50%),
    #f1f3f8;
}

/* Navbar */
html[data-theme="light"] #navbar {
  background: #ffffff;
  border-bottom-color: #dde1ea;
  box-shadow: 0 1px 0 rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
}
html[data-theme="light"] .nav-brand { color: #1a1a2e; }
html[data-theme="light"] .nav-brand:hover { color: #1a1a2e; }
html[data-theme="light"] .nav-link { color: rgba(26,26,46,.6); }
html[data-theme="light"] .nav-link:hover {
  background: rgba(0,0,0,.05);
  color: #1a1a2e;
}
html[data-theme="light"] .nav-link.active {
  background: rgba(0,0,0,.07);
  color: #1a1a2e;
}
html[data-theme="light"] .user-menu-btn {
  background: rgba(0,0,0,.05);
  border-color: rgba(0,0,0,.12);
  color: #1a1a2e;
}
html[data-theme="light"] .user-menu-btn:hover { background: rgba(0,0,0,.09); }
html[data-theme="light"] .theme-toggle-btn {
  background: rgba(0,0,0,.06);
  border-color: rgba(0,0,0,.11);
  color: rgba(26,26,46,.65);
}
html[data-theme="light"] .theme-toggle-btn:hover {
  background: rgba(0,0,0,.11);
  color: #1a1a2e;
}

/* Detail row */
html[data-theme="light"] .detail-row td {
  background: #f6f7fc;
  border-bottom-color: #dde1ea;
}
html[data-theme="light"] .detail-row td:hover { background: #f6f7fc !important; }

/* Data table */
html[data-theme="light"] .data-table td {
  border-bottom-color: rgba(0,0,0,.06);
}
html[data-theme="light"] .data-table tbody tr:hover td {
  background: rgba(230,126,34,.05);
}

/* Sender init */
html[data-theme="light"] .sender-init {
  background: linear-gradient(135deg, rgba(230,126,34,.12) 0%, rgba(59,130,246,.1) 100%);
}

/* Btn secondary in light mode */
html[data-theme="light"] .btn-secondary {
  background: #eceef5;
  border-color: #dde1ea;
  color: #1a1a2e;
}
html[data-theme="light"] .btn-secondary:hover:not(:disabled) {
  background: #e2e5ee;
  border-color: #c5cad8;
}
html[data-theme="light"] .btn-danger-outline {
  background: #fff;
}
html[data-theme="light"] .btn-success-outline {
  background: #fff;
}

/* Mono */
html[data-theme="light"] .mono-sm { color: #6b7280; }

/* Review DL rows */
html[data-theme="light"] .review-dl-row { border-bottom-color: rgba(0,0,0,.06); }
html[data-theme="light"] .review-dl-row dt { color: #6b7280; }
html[data-theme="light"] .review-dl-row dd { color: #1a1a2e; }

/* Review card */
html[data-theme="light"] .review-card { box-shadow: none; }

/* ── rp-* panel ──────────────────────────────────────────────────── */
html[data-theme="light"] .rp-shell {
  background: #ffffff;
  border-color: #dde1ea;
  box-shadow: 0 2px 14px rgba(0,0,0,.06);
}
html[data-theme="light"] .rp-status-ready {
  background: rgba(52,211,153,.07);
  border-bottom-color: rgba(52,211,153,.2);
  color: #0d6e5c;
}
html[data-theme="light"] .rp-status-pending {
  background: rgba(251,191,36,.07);
  border-bottom-color: rgba(251,191,36,.22);
  color: #92400e;
}
html[data-theme="light"] .rp-email-header { border-bottom-color: #e5e8f0; }
html[data-theme="light"] .rp-sender-avatar {
  background: linear-gradient(135deg, rgba(230,126,34,.15) 0%, rgba(59,130,246,.1) 100%);
  border-color: rgba(230,126,34,.3);
}
html[data-theme="light"] .rp-sender-name { color: #1a1a2e; }
html[data-theme="light"] .rp-sender-addr { color: #6b7280; }
html[data-theme="light"] .rp-time { color: #6b7280; }
html[data-theme="light"] .rp-subject { color: #1a1a2e; }
html[data-theme="light"] .rp-attachment {
  background: #f0f2f8;
  border-color: #dde1ea;
  color: #6b7280;
}
html[data-theme="light"] .rp-section { border-bottom-color: #e5e8f0; }
html[data-theme="light"] .rp-note { color: #6b7280; }
html[data-theme="light"] .rp-stat {
  background: #f6f7fc;
  border-color: #dde1ea;
}
html[data-theme="light"] .rp-stat:hover {
  background: #edeef6;
  border-color: #c5cad8;
}
html[data-theme="light"] .rp-stat-accent {
  background: linear-gradient(145deg, rgba(230,126,34,.08) 0%, #f6f7fc 65%);
  border-color: rgba(230,126,34,.28);
}
html[data-theme="light"] .rp-stat-accent:hover { border-color: rgba(230,126,34,.48); }
html[data-theme="light"] .rp-stat-label { color: #9aa3b2; }
html[data-theme="light"] .rp-stat-val { color: #1a1a2e; }
html[data-theme="light"] .rp-actions {
  background: #f6f7fc;
  border-top-color: #dde1ea;
}
html[data-theme="light"] .tech-details-wrap { border-top-color: #e5e8f0; }
html[data-theme="light"] .tech-details-toggle { color: #8a93a6; }
html[data-theme="light"] .tech-details-toggle:hover { color: #4a5568; }
html[data-theme="light"] .tech-details-body .review-dl-row { border-color: #e5e8f0; }
html[data-theme="light"] .tech-details-body .review-dl-row dt { color: #9aa3b2; }
html[data-theme="light"] .tech-details-body .review-dl-row dd { color: #4a5568; }

/* ── PDF preview ─────────────────────────────────────────────────── */
html[data-theme="light"] .pdf-preview-mount {
  background: #f2f4f9;
  border-color: #dde1ea;
}
html[data-theme="light"] .pdf-viewport-wrap { background: #e4e7f0; }
html[data-theme="light"] .pdf-expand-hint {
  background: rgba(255,255,255,.88);
  border-color: rgba(0,0,0,.1);
  color: #4a5568;
}
html[data-theme="light"] .pdf-controls {
  background: #eef0f6;
  border-top-color: #dde1ea;
}
html[data-theme="light"] .pdf-nav-btn {
  background: #e4e7f0;
  border-color: #cdd1df;
  color: #4a5568;
}
html[data-theme="light"] .pdf-nav-btn:hover:not(:disabled) {
  background: #d8dcea;
  border-color: #b8bece;
  color: #1a1a2e;
}
html[data-theme="light"] .pdf-page-label { color: #6b7280; }
html[data-theme="light"] .pdf-unsupported { color: #9aa3b2; }
html[data-theme="light"] .pdf-loading-overlay { background: rgba(232,235,244,.75); }

html[data-theme="light"] .pdf-lb-box {
  background: #f6f7fc;
  border-color: #dde1ea;
  box-shadow: 0 24px 80px rgba(0,0,0,.2);
}
html[data-theme="light"] .pdf-lb-header { border-bottom-color: #e5e8f0; }
html[data-theme="light"] .pdf-lb-title { color: #1a1a2e; }
html[data-theme="light"] .pdf-lb-close {
  background: rgba(0,0,0,.05);
  border-color: rgba(0,0,0,.1);
  color: #6b7280;
}
html[data-theme="light"] .pdf-lb-close:hover {
  background: rgba(0,0,0,.1);
  color: #1a1a2e;
}
html[data-theme="light"] .pdf-lb-canvas-wrap { background: #e4e7f0; }
html[data-theme="light"] .pdf-lb-controls {
  background: #eef0f6;
  border-top-color: #dde1ea;
}
html[data-theme="light"] .pdf-lb-loading { background: rgba(232,235,244,.75); }
