/* Flashi dashboard design system — matched to Resend's shipped tokens
 * (verified from their app CSS 2026-07-07): Inter/CommitMono, 12-step gray
 * scales, Tailwind-v4 radius steps, dark-first. Values are theirs verbatim
 * where extracted; everything else follows the same system. */

:root, .light {
  --gray-1: #fafafa; --gray-2: #eeeeee; --gray-3: #d7d7d7; --gray-4: #bebebe;
  --gray-5: #989898; --gray-6: #7e7e7e; --gray-7: #656565; --gray-8: #4c4c4c;
  --gray-9: #414141; --gray-10: #3a3a3a; --gray-11: #333333; --gray-12: #191919;
  color-scheme: light;
}
.dark {
  --gray-1: #141517; --gray-2: #191b1e; --gray-3: #212629; --gray-4: #293034;
  --gray-5: #333b3e; --gray-6: #3b4345; --gray-7: #434a4d; --gray-8: #52595b;
  --gray-9: #6e7679; --gray-10: #878d8f; --gray-11: #a1a4a5; --gray-12: #f0f0f0;
  color-scheme: dark;
}
:root {
  /* semantic */
  --bg: var(--gray-1); --surface: var(--gray-2); --surface-2: var(--gray-3);
  --border: var(--gray-4); --border-subtle: var(--gray-3);
  --text: var(--gray-12); --text-muted: var(--gray-11); --text-subtle: var(--gray-9);
  --accent: #f0f0f0; --accent-fg: #141517;              /* Resend-style mono accent */
  --ok: #46a758; --ok-bg: rgba(70,167,88,.14);
  --warn: #ffb224; --warn-bg: rgba(255,178,36,.14);
  --bad: #e5484d; --bad-bg: rgba(229,72,77,.14);
  --info: #3e63dd; --info-bg: rgba(62,99,221,.14);
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "CommitMono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius-xs: .125rem; --radius-sm: .25rem; --radius-md: .375rem;
  --radius-lg: .5rem; --radius-xl: .75rem;
  --sidebar-w: 232px;
}
.light { --accent: #191919; --accent-fg: #fafafa; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 400 14px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: var(--font-mono); font-size: 12.5px; }

/* ── app frame: fixed sidebar + scrollable content ─────────────────────────── */
.frame { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg); border-right: 1px solid var(--border-subtle);
  padding: 10px;
}
.side-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 12px; }
.side-head .word { font-weight: 600; font-size: 14px; letter-spacing: -.01em; }
.side-head .org {
  margin-left: auto; max-width: 90px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--text-muted); font-size: 12px;
}
.nav-group { margin-top: 14px; }
.nav-group > .label {
  padding: 0 8px 4px; font-size: 11px; font-weight: 500; letter-spacing: .02em;
  color: var(--text-subtle); text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 8px; border-radius: var(--radius-md);
  color: var(--text-muted); font-size: 13.5px; line-height: 20px;
}
.nav-item svg { width: 15px; height: 15px; opacity: .82; flex: none; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.on { background: var(--surface-2); color: var(--text); font-weight: 500; }
.side-foot { margin-top: auto; border-top: 1px solid var(--border-subtle); padding-top: 10px; display: grid; gap: 8px; }
.side-foot .who { padding: 0 8px; font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.content { flex: 1; min-width: 0; padding: 28px 36px 64px; max-width: 1200px; }

/* ── page header (title left, actions right — the Resend pattern) ──────────── */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.page-head .sub { color: var(--text-muted); font-size: 13px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ── buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-md); padding: 5px 12px; font-size: 13px; font-weight: 500;
  color: var(--text); transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn.primary:hover { opacity: .9; }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.sm { padding: 3px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ── segmented control (test/live) ─────────────────────────────────────────── */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 2px; }
.seg button { border: 0; background: transparent; padding: 3px 10px; border-radius: var(--radius-sm); font-size: 12.5px; color: var(--text-muted); }
.seg button.on { background: var(--surface-2); color: var(--text); font-weight: 500; }
.seg button.on.test { color: var(--warn); }

/* ── cards + stats ─────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.stat .k { font-size: 12px; color: var(--text-muted); }
.stat .v { font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin-top: 2px; }
.stat .d { font-size: 12px; color: var(--text-subtle); margin-top: 2px; }

/* ── tables (dense, mono ids, row hover — the Resend list pattern) ─────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--text-subtle);
  padding: 7px 10px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap;
}
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.tbl tbody tr:hover { background: var(--surface); }
.tbl tbody tr.click { cursor: pointer; }
.tbl .mono { color: var(--text-muted); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── badges (status vocabulary) ────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px;
  border-radius: 999px; font-size: 11.5px; font-weight: 500; white-space: nowrap;
  background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.badge.warn { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.badge.bad { color: var(--bad); background: var(--bad-bg); border-color: transparent; }
.badge.info { color: var(--info); background: var(--info-bg); border-color: transparent; }

/* ── inputs / forms ────────────────────────────────────────────────────────── */
.field { display: grid; gap: 5px; margin-bottom: 12px; }
.field > label { font-size: 12.5px; font-weight: 500; color: var(--text-muted); }
.input, select.input, textarea.input {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 6px 10px; font-size: 13.5px; width: 100%;
}
.input:focus { outline: none; border-color: var(--gray-8); }
.row { display: flex; gap: 10px; align-items: center; }

/* ── slide-over detail panel ───────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 92vw); z-index: 41;
  background: var(--bg); border-left: 1px solid var(--border);
  padding: 20px 24px; overflow-y: auto;
  animation: slide .16s ease-out;
}
@keyframes slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.panel h2 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.panel .x { position: absolute; top: 14px; right: 16px; border: 0; background: transparent; color: var(--text-subtle); font-size: 18px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13px; margin: 12px 0; }
.kv dt { color: var(--text-subtle); } .kv dd { margin: 0; word-break: break-all; }

/* ── tabs (detail views: the Resend Records/Configuration pattern) ─────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border-subtle); margin: 14px 0 12px; }
.tabs button {
  border: 0; background: transparent; padding: 6px 10px; font-size: 13px;
  color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.on { color: var(--text); border-bottom-color: var(--text); font-weight: 500; }

/* ── misc ──────────────────────────────────────────────────────────────────── */
.empty { padding: 42px 0; text-align: center; color: var(--text-subtle); font-size: 13.5px; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--gray-12); color: var(--gray-1); border-radius: var(--radius-md);
  padding: 8px 14px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.banner {
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
  background: var(--warn-bg); border: 1px solid rgba(255,178,36,.35);
  border-radius: var(--radius-lg); padding: 10px 14px; font-size: 13px;
}
.banner .grow { flex: 1; }
.copy { border: 0; background: transparent; color: var(--text-subtle); padding: 2px; }
.copy:hover { color: var(--text); }

/* ── legacy-page compatibility, restyled to the system (keys/webhooks/settings
   keep their tested logic; these classes give them the Resend skin) ────────── */
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; width: min(480px, 92vw); box-shadow: 0 16px 48px rgba(0,0,0,.4);
}
.modal h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.modal .sub { color: var(--text-muted); font-size: 13px; margin: 0 0 14px; }
.code {
  font-family: var(--font-mono); font-size: 12.5px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 10px 12px; word-break: break-all;
}
.code.inline { display: inline; border: 0; background: var(--surface-2); padding: 1px 6px; border-radius: var(--radius-sm); }
.hint { color: var(--text-subtle); font-size: 12px; }
.trow {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
}
.trow .a { font-size: 13.5px; }
.trow .b { font-size: 12px; color: var(--text-subtle); margin-top: 2px; }
.pill {
  display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
  background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
}
.pill.solid { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.pill.err { color: var(--bad); background: var(--bad-bg); border-color: transparent; }
.pill.muted { opacity: .7; }
.sech { display: flex; align-items: center; margin: 22px 0 10px; }
.sech .t { font-size: 14px; font-weight: 600; }
.sech .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.spin {
  width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--text);
  border-radius: 50%; display: inline-block; animation: rot .7s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }
.auth { min-height: 100vh; display: grid; place-items: center; }
.error { color: var(--bad); font-size: 13.5px; }
.muted { color: var(--text-muted); } .subtle { color: var(--text-subtle); }
.grow { flex: 1; }
hr.sep { border: 0; border-top: 1px solid var(--border-subtle); margin: 16px 0; }
