:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #0f172a;
  background: #f8fafc;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f8fafc; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; }
.centered { min-height: 100vh; display: grid; place-items: center; color: #64748b; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: #111827; color: #e5e7eb; padding: 22px 16px; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 24px; }
.brandMark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: #f8fafc; color: #111827; font-weight: 800; }
.brandMark.large { width: 56px; height: 56px; border: 1px solid #e2e8f0; margin-bottom: 12px; }
.brand strong, .brand span, .sidebarFoot strong, .sidebarFoot span { display: block; }
.brand span { color: #94a3b8; font-size: .8rem; margin-top: 2px; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav button { text-align: left; border: 0; border-radius: 9px; padding: 11px 12px; color: #cbd5e1; background: transparent; }
.sidebar nav button:hover, .sidebar nav button.active { background: #1f2937; color: white; }
.sidebarFoot { margin-top: auto; font-size: .72rem; color: #64748b; padding: 10px 8px; }
.sidebarFoot strong { color: #e2e8f0; font-size: .8rem; margin-bottom: 2px; }
.sidebarFoot button { margin-top: 10px; border: 1px solid #334155; background: transparent; color: #cbd5e1; border-radius: 8px; padding: 7px 9px; width: 100%; }
main { min-width: 0; padding: 28px 34px 70px; }
header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; }
h1 { font-size: 1.9rem; margin: 0 0 5px; letter-spacing: -.025em; }
h2, h3 { color: #0f172a; }
header p, .tableHeader p { margin: 0; color: #64748b; }
.status { display: flex; align-items: center; gap: 8px; background: white; border: 1px solid #e2e8f0; border-radius: 999px; padding: 7px 11px; color: #475569; font-size: .82rem; }
.status span { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }
.error, .notice { padding: 12px 14px; margin-bottom: 18px; border-radius: 10px; white-space: pre-wrap; }
.error { border: 1px solid #fecaca; background: #fff1f2; color: #9f1239; }
.notice { border: 1px solid #bbf7d0; background: #f0fdf4; color: #166534; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.card, .panel { background: white; border: 1px solid #e2e8f0; border-radius: 14px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
/* Pinned foreground: inside the dark workspace shell these light surfaces
   must not inherit the shell's near-white body ink (:root loses to body). */
.card, .panel, .message, .loginCard, .modal { color: #0f172a; }
.card { padding: 18px; }
.card span { color: #64748b; font-size: .82rem; }
.card strong { display: block; font-size: 1.7rem; margin-top: 7px; }
.panel { padding: 20px; }
.panel h2 { margin: 0 0 10px; font-size: 1.05rem; }
.panel p { color: #64748b; line-height: 1.55; }
.panelGrid, .collectorGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.collectorGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sourceChips { display: flex; flex-wrap: wrap; gap: 8px; }
.sourceChips span, .badge { border-radius: 999px; padding: 4px 8px; background: #eef2ff; color: #3730a3; font-size: .75rem; font-weight: 600; }
.badge.interactive { cursor: pointer; }
.badge.interactive:hover { background: #fee2e2; color: #991b1b; }
.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(200px, 320px) auto; gap: 10px; margin-bottom: 14px; align-items: center; }
.toolbar input, .toolbar select, .assignRow select, .loginCard input { width: 100%; border: 1px solid #cbd5e1; border-radius: 10px; background: white; padding: 11px 12px; color: #0f172a; outline: none; }
.toolbar input:focus, .toolbar select:focus, .assignRow select:focus, .loginCard input:focus { border-color: #64748b; box-shadow: 0 0 0 3px rgba(100, 116, 139, .12); }
.check { display: flex; align-items: center; gap: 7px; white-space: nowrap; font-size: .82rem; color: #475569; }
.check input { width: auto; }
.messageList { display: grid; gap: 10px; }
.message { background: white; border: 1px solid #e2e8f0; border-radius: 14px; padding: 16px 18px; }
.messageHead { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.messageHead strong, .messageHead span { display: block; }
.messageHead span { margin-top: 3px; color: #64748b; font-size: .75rem; text-transform: capitalize; }
.messageHead time { color: #64748b; font-size: .78rem; white-space: nowrap; }
.message p { white-space: pre-wrap; line-height: 1.55; margin: 14px 0; }
.subject { font-weight: 650; margin-top: 12px; }
.messageMeta { display: flex; justify-content: space-between; gap: 16px; color: #64748b; font-size: .8rem; align-items: center; }
.caseBadges { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }
.assignRow { margin-top: 10px; display: flex; justify-content: flex-end; }
.assignRow select { width: auto; min-width: 220px; padding: 7px 9px; font-size: .8rem; }
.loading, .empty { padding: 30px; text-align: center; color: #64748b; }
.tablePanel { padding: 0; overflow: hidden; }
.tableHeader { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px 20px; border-bottom: 1px solid #e2e8f0; }
.tableHeader h2 { margin: 0; }
.tableHeader button, td button, .modalActions button, .error button { border: 0; border-radius: 9px; padding: 8px 11px; background: #111827; color: white; }
.tableWrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 650px; }
th, td { padding: 12px 16px; border-bottom: 1px solid #eef2f7; text-align: left; vertical-align: top; }
th { color: #64748b; font-size: .75rem; background: #f8fafc; }
td { font-size: .88rem; }
td small { display: block; margin-top: 3px; color: #64748b; max-width: 440px; overflow-wrap: anywhere; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f8fafc; }
.loginShell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg,#f8fafc,#eef2ff); }
.loginCard { width: min(420px,100%); background: white; border: 1px solid #e2e8f0; border-radius: 18px; padding: 30px; box-shadow: 0 20px 50px rgba(15,23,42,.08); }
.loginCard h1 { font-size: 1.55rem; }
.loginCard p { color: #64748b; margin-bottom: 22px; }
.loginCard label { display: grid; gap: 6px; font-size: .82rem; font-weight: 650; margin: 13px 0; }
.loginCard button { width: 100%; margin-top: 10px; padding: 11px; border: 0; border-radius: 10px; background: #111827; color: white; font-weight: 700; }
.modalBackdrop { position: fixed; z-index: 100; inset: 0; background: rgba(15,23,42,.55); display: grid; place-items: center; padding: 20px; }
.modal { width: min(760px,100%); max-height: min(820px,90vh); overflow: auto; background: white; border-radius: 18px; border: 1px solid #e2e8f0; box-shadow: 0 24px 70px rgba(15,23,42,.25); padding: 22px; }
.modalHead { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid #e2e8f0; padding-bottom: 14px; }
.modalHead h2 { margin: 0; }
.modalHead p { margin: 5px 0 0; color: #64748b; }
.modalHead > button { border: 0; background: transparent; font-size: 1.6rem; color: #64748b; }
.modal h3 { margin: 20px 0 8px; font-size: .9rem; }
.identityList { display: grid; gap: 8px; }
.identity { border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; }
.identity strong, .identity span, .identity small { display: block; }
.identity span { margin-top: 2px; color: #475569; font-size: .8rem; }
.identity small { margin-top: 3px; color: #94a3b8; font-size: .72rem; }
.modalActions { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid #e2e8f0; margin-top: 20px; padding-top: 16px; }
.modalActions .danger { background: #991b1b; }
.formRow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.formRow input { flex: 1 1 10rem; min-width: 0; border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px 10px; }
.formRow button { border: 0; border-radius: 9px; padding: 8px 11px; background: #111827; color: white; }
.mergeRow { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid #f1f5f9; }
.mergeRow button { border: 0; border-radius: 9px; padding: 6px 10px; background: #111827; color: white; }
.mergeRow .danger { background: #991b1b; }
.formGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 8px; margin-top: 12px; }
.formGrid input, .formGrid select { border: 1px solid #cbd5e1; border-radius: 8px; padding: 8px 10px; background: white; color: #0f172a; min-inline-size: 0; }
.formGrid button { border: 0; border-radius: 9px; padding: 8px 11px; background: #111827; color: white; }
.pickChip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #cbd5e1; border-radius: 999px; padding: 6px 6px 6px 12px; background: white; font-size: .82rem; }
.pickChip button { border: 0; border-radius: 999px; background: #e2e8f0; color: #0f172a; inline-size: 1.4rem; block-size: 1.4rem; line-height: 1; }
.pickWrap { display: inline-flex; }
.pickWrap > button { border: 1px solid #cbd5e1; border-radius: 10px; background: white; padding: 8px 11px; color: #0f172a; }
.pickOpen { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pickOpen input { border: 1px solid #cbd5e1; border-radius: 8px; padding: 7px 9px; min-inline-size: 10rem; }
.pickOpen button { border: 1px solid #cbd5e1; border-radius: 8px; background: white; padding: 6px 9px; color: #0f172a; }
.mobileNav { display: none; }

@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 950px) {
  .shell { grid-template-columns: 210px minmax(0, 1fr); }
  main { padding: 24px 22px 70px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collectorGrid { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .check { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .shell { display: block; }
  .sidebar { display: none; }
  main { padding: max(18px, env(safe-area-inset-top)) 14px calc(84px + env(safe-area-inset-bottom)); }
  header { margin-bottom: 16px; }
  header p { font-size: .8rem; }
  h1 { font-size: 1.5rem; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { padding: 14px; }
  .card strong { font-size: 1.35rem; }
  .panelGrid { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr; }
  .check { grid-column: auto; }
  .messageHead { display: block; }
  .messageHead time { display: block; margin-top: 6px; }
  .messageMeta { align-items: flex-start; flex-direction: column; }
  .caseBadges { justify-content: flex-start; }
  .assignRow { justify-content: flex-start; }
  .assignRow select { width: 100%; }
  .mobileNav { position: fixed; z-index: 50; display: grid; grid-template-columns: repeat(5, 1fr); left: 0; right: 0; bottom: 0; padding: 7px 5px calc(7px + env(safe-area-inset-bottom)); background: rgba(17, 24, 39, .97); backdrop-filter: blur(12px); }
  .mobileNav button { border: 0; background: transparent; color: #94a3b8; font-size: .68rem; padding: 8px 2px; }
  .mobileNav button.active { color: white; font-weight: 700; }
  .modalBackdrop { align-items: end; padding: 0; }
  .modal { border-radius: 18px 18px 0 0; max-height: 88vh; width: 100%; }
}
