/* SendRelay Ops — internal admin. Dense, dark, emerald accent (#10b981).
   EN-only (ops is the one bilingual exception). WCAG AA contrast. */
:root {
  --bg: #0b1220;
  --panel: #111a2b;
  --panel-2: #16213a;
  --line: #233149;
  --ink: #e8eef7;
  --ink-muted: #9fb0c8;
  --accent: #10b981;
  --accent-ink: #04231a;
  --t3: #f0617a;     /* security/legal/money — never auto-resolve */
  --t2: #d9a441;     /* support/sales */
  --out: #6b7a91;
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 15px; line-height: 1.5;
}
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 10px 18px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(11,18,32,0.92); backdrop-filter: blur(8px); z-index: 5;
}
.brand { font-weight: 800; letter-spacing: 0.2px; }
.brand span { color: var(--accent); }
.tabs { display: flex; gap: 4px; }
.tabs button {
  font: inherit; color: var(--ink-muted); background: none; border: 0; cursor: pointer;
  padding: 8px 12px; border-radius: 8px;
}
.tabs button:hover { color: var(--ink); background: var(--panel); }
.tabs button.active { color: var(--accent); background: var(--panel); }
.who { margin-left: auto; color: var(--ink-muted); font-size: 13px; }
main { padding: 18px; max-width: 1180px; margin: 0 auto; }
.loading, .empty { color: var(--ink-muted); padding: 40px 0; text-align: center; }

/* filter bar */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.filters select, .filters input {
  font: inherit; background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px;
}
.filters .spacer { flex: 1; }
.btn {
  font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: 8px;
  padding: 8px 14px; background: var(--accent); color: var(--accent-ink);
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.ghost { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }

/* case list */
.list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row {
  display: grid; grid-template-columns: 130px 70px 1fr 200px 130px 90px; gap: 12px; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--panel); }
.row .subj { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .muted { color: var(--ink-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--panel-2); color: var(--ink-muted); border: 1px solid var(--line);
}
.tier { font-weight: 800; font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.tier.T3 { background: rgba(240,97,122,0.16); color: var(--t3); }
.tier.T2 { background: rgba(217,164,65,0.16); color: var(--t2); }
.tier.OUT { background: rgba(107,122,145,0.16); color: var(--out); }
.status { font-size: 12px; color: var(--ink-muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; background: var(--accent); }

/* case detail */
.back { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0 0 12px; }
.case-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.case-head h1 { font-size: 20px; margin: 0; }
.case-sub { color: var(--ink-muted); margin: 0 0 16px; font-size: 14px; }
.thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.msg { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: var(--panel); }
.msg.outbound { background: var(--panel-2); border-color: var(--accent); }
.msg .meta { font-size: 12px; color: var(--ink-muted); margin-bottom: 6px; display: flex; gap: 8px; }
.msg .meta b { color: var(--ink); }
.msg .body { white-space: pre-wrap; word-break: break-word; }
.msg.internal { opacity: 0.8; border-style: dashed; }
.privacy-note { margin-top: 8px; font-size: 12px; color: var(--accent); opacity: 0.85; }

/* reply box */
.reply { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--panel); }
.reply textarea {
  width: 100%; min-height: 120px; resize: vertical; font: inherit; background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 10px;
}
.reply .actions { display: flex; gap: 10px; align-items: center; }
.reply select { font: inherit; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.notice { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.notice.err { background: rgba(240,97,122,0.14); color: var(--t3); }
.notice.ok { background: rgba(16,185,129,0.14); color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: 12px; color: var(--ink-muted); }

/* forms (tenants) */
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--panel); margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field label { font-size: 12px; color: var(--ink-muted); }
.field input, .field select { font: inherit; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline .field { margin-bottom: 0; }

@media (max-width: 720px) {
  .row { grid-template-columns: 1fr 60px; grid-auto-flow: row; }
  .row .muted, .row .status { display: none; }
}
