/* Notify dashboard. Plain CSS, no build step. Light + dark themes via tokens. */

:root {
  --bg: #f6f7fb;
  --bg-elev: #ffffff;
  --bg-sunken: #eef0f6;
  --bg-hover: #f1f2f8;
  --border: #e3e5ee;
  --border-strong: #cfd3e0;
  --text: #151826;
  --text-2: #4b5168;
  --text-3: #7a8098;
  --accent: #5b5bf0;
  --accent-hover: #4a49dc;
  --accent-soft: #ececfe;
  --accent-text: #4338ca;
  --on-accent: #ffffff;
  --ok: #12996b;
  --ok-soft: #e3f6ee;
  --warn: #b7791f;
  --warn-soft: #fdf3e1;
  --bad: #d63c4a;
  --bad-soft: #fde8ea;
  --info: #2f7de1;
  --info-soft: #e5f0fd;
  --c-sent: #5b5bf0;
  --c-failed: #e5484d;
  --c-invalid: #f2a33a;
  --shadow-sm: 0 1px 2px rgb(20 24 40 / 6%);
  --shadow: 0 1px 3px rgb(20 24 40 / 6%), 0 8px 24px rgb(20 24 40 / 6%);
  --shadow-lg: 0 24px 64px rgb(20 24 40 / 18%);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar-w: 252px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0f17;
    --bg-elev: #151824;
    --bg-sunken: #10131d;
    --bg-hover: #1c2030;
    --border: #252a3b;
    --border-strong: #343a50;
    --text: #eceef6;
    --text-2: #b0b5c9;
    --text-3: #7d839b;
    --accent: #7375ff;
    --accent-hover: #8587ff;
    --accent-soft: #23254a;
    --accent-text: #a5a7ff;
    --ok: #3ccf91;
    --ok-soft: #12302a;
    --warn: #f0b44c;
    --warn-soft: #33281a;
    --bad: #ff6b74;
    --bad-soft: #3a1a21;
    --info: #5ea2ff;
    --info-soft: #172a45;
    --c-sent: #7375ff;
    --c-failed: #ff6b74;
    --c-invalid: #f0b44c;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 30%);
    --shadow: 0 1px 3px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
    --shadow-lg: 0 24px 64px rgb(0 0 0 / 55%);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d0f17;
  --bg-elev: #151824;
  --bg-sunken: #10131d;
  --bg-hover: #1c2030;
  --border: #252a3b;
  --border-strong: #343a50;
  --text: #eceef6;
  --text-2: #b0b5c9;
  --text-3: #7d839b;
  --accent: #7375ff;
  --accent-hover: #8587ff;
  --accent-soft: #23254a;
  --accent-text: #a5a7ff;
  --ok: #3ccf91;
  --ok-soft: #12302a;
  --warn: #f0b44c;
  --warn-soft: #33281a;
  --bad: #ff6b74;
  --bad-soft: #3a1a21;
  --info: #5ea2ff;
  --info-soft: #172a45;
  --c-sent: #7375ff;
  --c-failed: #ff6b74;
  --c-invalid: #f0b44c;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 30%);
  --shadow: 0 1px 3px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
  --shadow-lg: 0 24px 64px rgb(0 0 0 / 55%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 620; }
h3 { font-size: 14px; font-weight: 620; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 22px; height: 22px; }
.hidden { display: none !important; }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

svg.logo { width: 15px; height: 15px; flex: none; fill: currentColor; }
.grow-1 { flex: 1; min-width: 0; }
.cell-stack.right { justify-items: end; text-align: right; }
.pre-line { white-space: pre-line; }
.err-list { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 2px; }
.callout > div { min-width: 0; overflow-wrap: anywhere; }
.chip-i-wrap { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.page-meta { margin: -10px 0 20px; }

/* ---------- Boot / spinner ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Buttons ---------- */
.btn {
  --b-bg: var(--bg-elev); --b-fg: var(--text); --b-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--b-bd); background: var(--b-bg); color: var(--b-fg);
  font: inherit; font-weight: 560; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  box-shadow: var(--shadow-sm);
  text-decoration: none !important;
}
.btn:hover { background: var(--bg-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.primary { --b-bg: var(--accent); --b-fg: var(--on-accent); --b-bd: transparent; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.danger { --b-bg: var(--bad); --b-fg: #fff; --b-bd: transparent; }
.btn.danger:hover:not(:disabled) { filter: brightness(1.06); background: var(--bad); }
.btn.danger-ghost { --b-fg: var(--bad); }
.btn.ghost { --b-bg: transparent; --b-bd: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn.icon { width: 36px; padding: 0; }
.btn.icon.sm { width: 30px; }
.btn.block { width: 100%; }
.btn .spinner { flex: none; width: 15px; height: 15px; border-width: 2px; border-color: color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-weight: 560; font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.hint { font-size: 12.5px; color: var(--text-3); }
.error-text { font-size: 12.5px; color: var(--bad); }
.input, .select, .textarea {
  width: 100%; min-width: 0;
  border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--text);
  border-radius: var(--radius-sm); font: inherit; padding: 8px 11px; min-height: 38px;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
.textarea.code, .input.code { font-family: var(--mono); font-size: 12.5px; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%237a8098'%3E%3Cpath d='M5.3 7.3a1 1 0 0 1 1.4 0L10 10.6l3.3-3.3a1 1 0 1 1 1.4 1.4l-4 4a1 1 0 0 1-1.4 0l-4-4a1 1 0 0 1 0-1.4Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.input-group { position: relative; display: flex; align-items: center; }
.input-group > svg { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; }
.input-group > .input { padding-left: 36px; }
.counter { font-weight: 450; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--bad); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stack { display: grid; gap: 16px; }
.stack.sm { gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .2s; margin: 0; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 25%); transition: transform .2s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }

.segmented { justify-self: start; display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--bg-sunken); border: 1px solid var(--border); flex-wrap: wrap; }
.segmented button {
  border: 0; background: transparent; color: var(--text-2); font: inherit; font-weight: 560; font-size: 13px;
  padding: 6px 12px; border-radius: 7px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.segmented button[aria-pressed="true"] { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); }

.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 18px; text-align: center;
  color: var(--text-2); cursor: pointer; transition: border-color .15s, background .15s; display: grid; gap: 4px; place-items: center;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { display: none; }
.dropzone .file-name { font-weight: 600; color: var(--text); }
.file-chosen { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-sunken); font-weight: 600; min-width: 0; }
.file-chosen > span { flex: 1; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--bg-elev); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 12px; gap: 14px; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; font-weight: 700; font-size: 16px; letter-spacing: -0.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 9px; }
.brand small { display: block; font-weight: 500; font-size: 11.5px; color: var(--text-3); letter-spacing: 0; }
.app-switch { display: grid; gap: 6px; padding: 0 4px; }
.app-switch .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px;
  color: var(--text-2); font-weight: 540; text-decoration: none;
}
.nav a:hover { background: var(--bg-hover); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.nav .section { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 12px 10px 4px; font-weight: 600; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text); text-decoration: none !important; min-width: 0; }
.user-chip:hover, .user-chip[aria-current="page"] { background: var(--bg-hover); }
.user-chip .cell-stack { font-size: 13px; line-height: 1.3; }
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap .input { padding-right: 44px; }
.pw-wrap .pw-toggle { position: absolute; right: 4px; color: var(--text-3); }
.form-error:empty { display: none; }
.verify-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 32px; background: var(--warn-soft); color: var(--text); border-bottom: 1px solid var(--border); font-size: 13.5px; }
.verify-banner svg { color: var(--warn); }
.verify-banner > span { flex: 1; min-width: 200px; }
.boot-inline { display: grid; place-items: center; padding: 40px; }
@media (max-width: 980px) { .verify-banner { padding: 10px 16px; } }
.int-ids { margin-bottom: 16px; }
.int-tabs { margin: 24px 0 16px; }
.plat-row { gap: 14px; }
.plat-row .plat-logo { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-sunken); flex: none; }
.plat-row .plat-logo svg { width: 22px; height: 22px; }
.step-no { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700; font-size: 13px;
  background: var(--accent-soft); color: var(--accent-text); }
.step-no.done { background: var(--ok); color: #fff; }
.step-no svg { width: 14px; height: 14px; stroke-width: 3; }
.sdk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.sdk-card {
  display: grid; justify-items: center; gap: 10px; padding: 20px 12px; border-radius: 12px; cursor: pointer; font: inherit; font-size: 14px;
  font-weight: 560; color: var(--text); background: var(--bg-elev); border: 1px solid var(--border-strong); transition: border-color .15s, background .15s;
}
.sdk-card:hover { border-color: var(--accent); }
.sdk-card[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.sdk-card .sdk-logo svg { width: 40px; height: 40px; }
.sdk-card .sdk-logo svg.i { stroke-width: 1.6; }
.int-steps li { line-height: 1.6; }
.int-steps .btn { margin: 4px 4px 0 0; vertical-align: middle; }
.code-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.code-card .code-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; background: var(--bg-sunken); border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; }
.code-card .code-head > span:first-child { flex: 1; }
.code-card pre.code { border: 0; border-radius: 0; max-height: 460px; }
.switch-auth { text-align: center; color: var(--text-2); }
ol.steps { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 8px; color: var(--text-2); }
ol.steps b { color: var(--text); }
.brand small { max-width: 170px; }
.login .card code { overflow-wrap: anywhere; }
.sidebar-foot .nav-btn { justify-content: flex-start; color: var(--text-2); font-weight: 540; }
.sidebar-foot { margin-top: auto; display: grid; gap: 6px; border-top: 1px solid var(--border); padding-top: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: none; position: sticky; top: 0; z-index: 30; height: 56px; padding: 0 12px;
  align-items: center; gap: 8px; background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .title { font-weight: 650; flex: 1; min-width: 0; }
.content { padding: 28px 32px 56px; max-width: 1240px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--text-3); margin-top: 4px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13px; margin-bottom: 6px; }
.breadcrumb a { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); line-height: 1; }
.breadcrumb a:hover { color: var(--text); }
.scrim { display: none; }

/* ---------- Cards ---------- */
.card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head p { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.cards { display: grid; gap: 20px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { padding: 16px 18px; display: grid; gap: 6px; }
.stat .k { color: var(--text-3); font-size: 12.5px; font-weight: 560; display: flex; align-items: center; gap: 7px; }
.stat .v { font-size: 26px; font-weight: 680; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .s { font-size: 12.5px; color: var(--text-3); }
.stat .k .chip-i { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.stat .k .chip-i.ok { background: var(--ok-soft); color: var(--ok); }
.stat .k .chip-i.bad { background: var(--bad-soft); color: var(--bad); }
.stat .k .chip-i.warn { background: var(--warn-soft); color: var(--warn); }
.stat .k .chip-i.accent { background: var(--info-soft); color: var(--info); }

.two-col { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 20px; align-items: start; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--bg-sunken); color: var(--text-2); white-space: nowrap; border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badge.outline { background: transparent; border-color: var(--border-strong); }
.badge.pulse::before { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.platform { display: inline-flex; align-items: center; gap: 6px; font-weight: 560; }
.platform svg { width: 15px; height: 15px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-3); padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--bg-sunken); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--bg-hover); }
.table .actions { text-align: right; white-space: nowrap; }
.table .msg-title { font-weight: 600; max-width: 360px; }
.table .msg-body { color: var(--text-3); max-width: 360px; font-size: 13px; }
.cell-stack { display: grid; gap: 2px; min-width: 0; }

.progress { height: 6px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; display: flex; min-width: 80px; }
.progress span { display: block; height: 100%; }
.progress .p-sent { background: var(--c-sent); }
.progress .p-failed { background: var(--c-failed); }
.progress .p-invalid { background: var(--c-invalid); }

.empty { padding: 44px 20px; text-align: center; display: grid; gap: 10px; place-items: center; color: var(--text-3); }
.empty .empty-i { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.empty h3 { color: var(--text); font-size: 15px; }
.empty p { max-width: 380px; }

.load-more { display: flex; justify-content: center; padding: 14px; border-top: 1px solid var(--border); }

/* ---------- Filters ---------- */
.toolbar { display: flex; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center; }
.toolbar .input-group { flex: 1 1 260px; }
.toolbar .select { width: auto; min-width: 140px; flex: 0 1 auto; }

/* ---------- Chart ---------- */
.chart { width: 100%; height: 220px; display: block; }
.chart .grid line { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .axis text { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .bar-sent { fill: var(--c-sent); }
.chart .bar-failed { fill: var(--c-failed); }
.chart .bar-invalid { fill: var(--c-invalid); }
.chart .col:hover rect.hit { fill: var(--bg-hover); }
.chart rect.hit { fill: transparent; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend .l-sent { background: var(--c-sent); }
.legend .l-failed { background: var(--c-failed); }
.legend .l-invalid { background: var(--c-invalid); }
.legend .l-opened { background: var(--ok); border-radius: 50%; }
.chart .line-opened { fill: none; stroke: var(--ok); stroke-width: 2; stroke-linejoin: round; pointer-events: none; }
.chart .dot-opened { fill: var(--bg-elev); stroke: var(--ok); stroke-width: 2; pointer-events: none; }

/* ---------- Lists ---------- */
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none !important; min-width: 0; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--bg-hover); }
.kv { display: grid; grid-template-columns: minmax(110px, 160px) minmax(0, 1fr); gap: 10px 16px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.copy-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.copy-line code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.checklist { display: grid; gap: 4px; }
.checklist a, .checklist div.ci { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none !important; }
.checklist a:hover { background: var(--bg-hover); }
.checklist .ck { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex: none; }
.checklist .done .ck { background: var(--ok); border-color: var(--ok); color: #fff; }
.checklist .done .ck svg { width: 13px; height: 13px; stroke-width: 3; }
.checklist .done span.t { color: var(--text-3); text-decoration: line-through; }

pre.code {
  margin: 0; padding: 14px 16px; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius);
  font: 12.5px/1.55 var(--mono); overflow: auto; max-height: 360px; color: var(--text-2); white-space: pre;
}

.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--info-soft); color: var(--text); font-size: 13.5px; align-items: flex-start; }
.callout svg { color: var(--info); margin-top: 1px; }
.callout.warn { background: var(--warn-soft); }
.callout.warn svg { color: var(--warn); }
.callout.bad { background: var(--bad-soft); }
.callout.bad svg { color: var(--bad); }
.callout.ok { background: var(--ok-soft); }
.callout.ok svg { color: var(--ok); }

details.more { border: 1px solid var(--border); border-radius: var(--radius); }
details.more > summary { list-style: none; cursor: pointer; padding: 12px 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary svg.chev { margin-left: auto; transition: transform .2s; color: var(--text-3); }
details.more[open] > summary svg.chev { transform: rotate(180deg); }
details.more > .more-body { padding: 4px 14px 16px; display: grid; gap: 14px; }

.tag-rows { display: grid; gap: 8px; }
.tag-row { display: grid; grid-template-columns: 1fr 1fr 36px; gap: 8px; }

/* ---------- Apps grid ---------- */
.apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.app-card { padding: 18px; display: grid; gap: 14px; color: inherit; text-decoration: none !important; transition: border-color .15s, box-shadow .15s, transform .15s; }
.app-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.app-avatar { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6); flex: none; font-size: 16px; }
.app-avatar.c1 { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.app-avatar.c2 { background: linear-gradient(135deg, #10b981, #0ea5e9); }
.app-avatar.c3 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.app-avatar.c4 { background: linear-gradient(135deg, #ec4899, #8b5cf6); }
.app-avatar.img { object-fit: cover; background: var(--bg-sunken); padding: 0; }
.notif img.ni { object-fit: cover; background: #fff; }
.notif-a .ah img.a-icon { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; }
.app-avatar.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 12.5px; }

/* ---------- Send page ---------- */
.composer { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.preview-col { position: sticky; top: 24px; display: grid; gap: 12px; }
.phone {
  border-radius: 34px; padding: 10px; background: #0b0c10; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 340px; margin: 0 auto;
}
.phone-screen {
  border-radius: 26px; min-height: 420px; padding: 18px 12px; position: relative; overflow: hidden;
  background: radial-gradient(120% 80% at 10% 0%, #8b5cf6 0%, transparent 55%), radial-gradient(120% 90% at 100% 100%, #0ea5e9 0%, transparent 55%), linear-gradient(160deg, #312e81, #1e1b4b 60%, #0f172a);
  color: #fff;
}
.phone-screen.android { background: radial-gradient(120% 80% at 0% 0%, #10b981 0%, transparent 55%), radial-gradient(120% 80% at 100% 100%, #6366f1 0%, transparent 60%), linear-gradient(170deg, #134e4a, #0f172a); }
.lock-time { text-align: center; font-size: 58px; font-weight: 300; letter-spacing: -0.02em; line-height: 1; margin-top: 18px; }
.lock-date { text-align: center; font-size: 15px; font-weight: 500; opacity: .9; margin-top: 6px; margin-bottom: 26px; }
.notif {
  border-radius: 20px; padding: 11px 13px; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px;
  background: rgb(245 245 250 / 72%); color: #111; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 6px 20px rgb(0 0 0 / 20%);
}
.notif .ni { width: 36px; height: 36px; border-radius: 9px; background: linear-gradient(135deg, #6366f1, #8b5cf6); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; }
.notif .nh { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.notif .nh b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif .nh span { color: #555; font-size: 12px; flex: none; }
.notif .nsub { font-size: 13px; font-weight: 600; }
.notif .nb { font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; white-space: pre-line; }
.notif-a {
  border-radius: 18px; padding: 12px 14px; background: rgb(32 33 40 / 88%); color: #eee; display: grid; gap: 4px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 30%); margin-top: 40px;
}
.notif-a .ah { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #bbb; }
.notif-a .ah i { width: 16px; height: 16px; border-radius: 50%; display: inline-block; background: var(--a-color, #6366f1); }
.notif-a .at { font-weight: 600; font-size: 14px; color: #fff; }
.notif-a .ab { font-size: 13px; color: #ccc; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; white-space: pre-line; }
.notif-a img { width: 100%; border-radius: 10px; margin-top: 6px; max-height: 140px; object-fit: cover; }
.preview-empty { opacity: .65; font-style: italic; }
.size-meter { font-size: 12px; color: var(--text-3); display: flex; justify-content: space-between; }
.audience-box { display: grid; gap: 12px; }
.browser { border-radius: 14px; overflow: hidden; border: 1px solid var(--border-strong); box-shadow: var(--shadow); background: var(--bg-elev); }
.browser-bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; background: var(--bg-sunken); border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-3); }
.browser-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); display: inline-block; }
.browser-bar span { margin-left: 8px; flex: 1; background: var(--bg-elev); border-radius: 6px; padding: 3px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browser-page { min-height: 260px; padding: 14px; display: flex; justify-content: flex-end; align-items: flex-start; background: linear-gradient(180deg, var(--bg) 0%, var(--bg-sunken) 100%); }
.web-notif { width: 100%; max-width: 300px; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px; padding: 12px; border-radius: 10px; background: #fff; color: #111; box-shadow: 0 8px 28px rgb(0 0 0 / 22%); font-size: 13px; }
.web-notif .wi { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6); object-fit: cover; }
.web-notif .wsite { color: #666; font-size: 11.5px; }
.web-notif .wb { color: #333; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; white-space: pre-line; }
.web-notif .wimg { grid-column: 1 / -1; width: 100%; max-height: 140px; object-fit: cover; border-radius: 6px; margin-top: 4px; }
.ab-box { display: grid; gap: 12px; padding: 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--bg-sunken); }
.ab-label { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.range { width: 100%; accent-color: var(--accent); }
.sm-select { width: auto; min-width: 170px; height: 32px; font-size: 13px; }
.dt-input { width: auto; flex: 0 1 220px; }
.rule-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(110px, 1fr) minmax(120px, 1.2fr) 36px; gap: 8px; align-items: start; }
.rule-list { display: grid; gap: 8px; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.modal.wide:has(.inapp-editor) { max-width: 940px; }
.inapp-editor { grid-template-columns: minmax(0, 1fr) 300px; }
.inapp-editor .preview-col { top: 0; }
.match-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-2); }
.count-pill { display: inline-flex; align-items: baseline; gap: 6px; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); font-size: 13px; }
.count-pill b { font-size: 18px; font-variant-numeric: tabular-nums; }
.btn-rows { display: grid; gap: 8px; }
.btn-row { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(110px, 0.8fr) minmax(140px, 1.4fr) 36px; gap: 8px; align-items: start; }
.inapp-card { border-radius: 16px; overflow: hidden; background: #fff; color: #151826; box-shadow: 0 18px 48px rgb(0 0 0 / 30%); width: 100%; max-width: 300px; }
.inapp-card img { display: block; width: 100%; max-height: 150px; object-fit: cover; }
.inapp-card .ib { padding: 16px; display: grid; gap: 6px; }
.inapp-card .it { font-weight: 700; font-size: 16px; }
.inapp-card .ix { color: #4b5168; font-size: 13.5px; white-space: pre-line; overflow-wrap: anywhere; }
.inapp-card .ibtns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.inapp-card .ibtns span { border-radius: 9px; padding: 7px 12px; font-weight: 600; font-size: 13px; background: #eef0f6; }
.inapp-card .ibtns span:last-child { background: #5b5bf0; color: #fff; }
.phone-screen.dim { display: grid; place-items: center; background: linear-gradient(160deg, #1f2937, #0f172a); }
.send-bar {
  position: sticky; bottom: 0; z-index: 5; margin-top: 4px; padding: 14px 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---------- Modal / drawer ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgb(10 12 20 / 48%); display: grid; place-items: center; padding: 16px;
  animation: fade .15s ease-out;
}
.modal {
  width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: pop .18s ease-out;
}
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 6px; }
.modal-head p { color: var(--text-3); margin-top: 4px; font-size: 13.5px; }
.modal-body { padding: 14px 20px 6px; display: grid; gap: 16px; }
.modal-foot { padding: 16px 20px 18px; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 100; background: rgb(10 12 20 / 40%); animation: fade .15s ease-out; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); z-index: 101; overflow-y: auto;
  background: var(--bg-elev); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: slide .2s ease-out;
  display: flex; flex-direction: column;
}
.drawer .modal-body { padding-bottom: 24px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }

.secret-box { display: grid; gap: 6px; }
.secret-box .copy-line { padding: 9px 10px 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-sunken); }
.secret-box code { flex: 1; overflow-wrap: anywhere; white-space: normal; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius);
  background: var(--text); color: var(--bg-elev); box-shadow: var(--shadow-lg); animation: pop .2s ease-out; font-size: 13.5px;
}
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok svg { color: var(--ok); }
.toast .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(60% 50% at 15% 10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent), radial-gradient(50% 50% at 90% 90%, color-mix(in srgb, #0ea5e9 12%, transparent), transparent), var(--bg);
}
.login .card { width: 100%; max-width: 420px; padding: 32px 28px; display: grid; gap: 22px; box-shadow: var(--shadow); }
.login .logo { width: 48px; height: 48px; border-radius: 14px; }
.login h1 { font-size: 22px; }
.login p.sub { color: var(--text-3); margin-top: 6px; }

/* ---------- Skeleton ---------- */
.skel { background: linear-gradient(90deg, var(--bg-sunken), var(--bg-hover), var(--bg-sunken)); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel.line { height: 12px; }
.skel.block { height: 96px; border-radius: var(--radius-lg); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .composer { grid-template-columns: minmax(0, 1fr) 320px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 86vw); transform: translateX(-102%);
    transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  .layout.nav-open .sidebar { transform: none; }
  .layout.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgb(10 12 20 / 45%); z-index: 35; }
  .topbar { display: flex; }
  .content { padding: 20px 16px 48px; }
  .two-col, .composer { grid-template-columns: minmax(0, 1fr); }
  .preview-col { position: static; }
  .phone { max-width: 300px; }
  .page-head h1 { font-size: 20px; }
}

@media (max-width: 720px) {
  .stats { gap: 10px; }
  .stat { padding: 14px; }
  .stat .v { font-size: 22px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .card-head, .card-body { padding-left: 16px; padding-right: 16px; }
  .list-item { padding-left: 16px; padding-right: 16px; }
  .toolbar .select { flex: 1 1 120px; }

  /* Tables become stacked cards. */
  table.table.stack-sm thead { display: none; }
  table.table.stack-sm, .table.stack-sm tbody, .table.stack-sm tr, .table.stack-sm td { display: block; width: 100%; }
  .table.stack-sm tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table.stack-sm tr:last-child { border-bottom: 0; }
  .table.stack-sm td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; align-items: center; text-align: right; }
  .table.stack-sm td::before { content: attr(data-label); color: var(--text-3); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; text-align: left; flex: none; }
  .table.stack-sm td.primary { display: block; text-align: left; padding-bottom: 6px; }
  .table.stack-sm td.primary::before { display: none; }
  .table.stack-sm td.actions { justify-content: flex-end; padding-top: 8px; }
  .table.stack-sm td.actions::before { display: none; }
  .table .msg-title, .table .msg-body { max-width: none; }
  .tag-row { grid-template-columns: 1fr 1fr 36px; }
  .rule-row, .btn-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px; }
  .rule-row > :nth-child(3), .btn-row > :nth-child(3) { grid-column: 1 / 3; grid-row: 2; }
  .inapp-editor { grid-template-columns: minmax(0, 1fr); }
  .send-bar { border-radius: 0; }
  .send-bar .btn.primary { flex: 1; }
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal { max-width: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; }
  .modal-foot .btn { flex: 1; }
  .toasts { right: 16px; left: 16px; bottom: 16px; width: auto; }
  .phone-screen { min-height: 340px; }
  .lock-time { font-size: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
