/* Likelyread dashboard. Same language as the landing page: Bricolage Grotesque,
   white ground, ink, one tone step for surfaces, signal red only for opens and the
   primary action. Square page elements; small radii stay on chips. No shadows. */
:root {
  --bg: #ffffff;
  --surface: #f2f2f2;
  --surface-2: #e4e4e4;
  --ink: #0a0a0a;
  --muted: #5f5f5f;
  --soft: #8a8a8a;
  --accent: #d92b21;
  --accent-strong: #b8221a;
  --accent-tint: #fde8e6;
  --accent-deep: #a51d16;
  --font: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --margin: clamp(1rem, 2.6vw, 2.5rem);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 400 15px/1.5 var(--font); font-optical-sizing: auto; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: var(--surface); padding: 0.05em 0.35em; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.error { color: var(--accent-deep); }
.error:empty { display: none; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wordmark { font-weight: 600; font-size: 20px; letter-spacing: -0.03em; text-decoration: none; }

/* ---------- controls ---------- */
input, select { background: var(--surface); color: var(--ink); border: 0; border-radius: 0; padding: 0 12px; height: 40px; font: inherit; min-width: 0; }
select { padding-right: 28px; appearance: none; background: var(--surface) no-repeat right 11px center / 9px 6px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 6'%3E%3Cpath d='M0 0h9L4.5 6z' fill='%230a0a0a'/%3E%3C/svg%3E"); max-width: 220px; text-overflow: ellipsis; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; background-color: #fff; }
input[type="checkbox"] { height: auto; accent-color: var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 16px; border: 0; border-radius: 0; background: var(--surface); color: var(--ink); font: 500 15px/1 var(--font); cursor: pointer; white-space: nowrap; transition: background-color 150ms ease, transform 120ms ease; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.danger { background: transparent; color: var(--accent-deep); }
.btn.danger:hover { background: var(--accent-tint); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--margin); }
.login-card { width: min(420px, 100%); display: grid; gap: 12px; }
.login-card .wordmark { margin-bottom: 28px; }
.login-title { font-size: clamp(36px, 6vw, 52px); line-height: 0.98; letter-spacing: -0.04em; font-weight: 600; }
.login-card label { font-size: 13px; color: var(--muted); margin-top: 8px; }
.login-card .btn { margin-top: 8px; height: 48px; }
.check { display: flex; gap: 8px; align-items: center; }

/* ---------- shell ---------- */
.topbar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 28px; padding: 14px var(--margin); background: var(--bg); flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); font-weight: 500; transition: background-color 150ms ease, color 150ms ease; }
.tabs a:hover { color: var(--ink); background: var(--surface); }
.tabs a.active { color: var(--ink); background: var(--surface); }
.topbar-right { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.view { max-width: 1280px; margin: 0 auto; padding: 24px var(--margin) 48px; }
.view > div { display: grid; gap: 56px; }
.foot { max-width: 1280px; margin: 0 auto; padding: 24px var(--margin) 40px; font-size: 13px; color: var(--muted); max-width: 70ch; margin-left: max(var(--margin), calc((100vw - 1280px) / 2 + var(--margin))); }
.loading { color: var(--muted); padding: 64px 0; }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head h2 { font-size: 26px; line-height: 1.05; letter-spacing: -0.03em; font-weight: 600; }
.empty { color: var(--muted); padding: 20px 0; }

/* ---------- overview ---------- */
.headline { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 40px; align-items: end; }
.headline h1 { font-size: clamp(40px, 6vw, 84px); line-height: 0.95; letter-spacing: -0.045em; font-weight: 600; }
.headline h1 .rate { color: var(--accent); }
.headline p { font-size: 18px; max-width: 34ch; color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tile { background: var(--surface); padding: 18px 18px 20px; min-height: 132px; display: flex; flex-direction: column; justify-content: space-between; }
.tile:nth-child(even) { background: var(--surface-2); }
.tile-value { font-size: 40px; line-height: 1; letter-spacing: -0.04em; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile-label { font-size: 14px; color: var(--ink); }
.tile-label small { display: block; color: var(--muted); font-size: 13px; }
.split { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 40px; align-items: start; }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #ececec; stroke-width: 1; }
.chart .axis { fill: var(--soft); font-size: 11px; font-family: var(--font); }
.chart .sent { fill: #d6d6d6; }
.chart .opens { fill: var(--accent); }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; display: inline-block; }
.sw.sent { background: #d6d6d6; }
.sw.opens { background: var(--accent); }

/* bands (recent opens) */
.bands { display: grid; gap: 4px; }
.bands li { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center; padding: 12px 14px; background: var(--surface); }
.bands li:nth-child(even) { background: var(--surface-2); }
.bands a { font-weight: 500; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bands a:hover { text-decoration: underline; }
.bands .when { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bands .sub { grid-column: 1 / -1; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0 4px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 0 14px 4px; white-space: nowrap; }
td { padding: 13px 14px; background: var(--surface); vertical-align: middle; }
tbody tr:nth-child(even) td { background: #f7f7f7; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
tr.dimrow td { color: var(--muted); }
.ellipsis { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--surface-2); color: #3f3f3f; white-space: nowrap; }
.chip.open { background: var(--accent-tint); color: var(--accent-deep); }
.chip.dim { color: var(--soft); background: #ececec; font-weight: 400; }
.chip-sub { font-weight: 400; opacity: .8; }
.tag { font-size: 13px; color: var(--ink); white-space: nowrap; }
.tag.none { color: var(--soft); }

.rate-cell { display: flex; align-items: center; gap: 10px; min-width: 130px; font-variant-numeric: tabular-nums; }
.rate-bar { flex: 1; height: 6px; background: var(--surface-2); overflow: hidden; }
.rate-fill { height: 100%; background: var(--accent); }

.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters input { width: 280px; }
.pager { display: flex; gap: 12px; align-items: center; padding-top: 16px; }

/* ---------- email detail ---------- */
.back { font-size: 14px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); }
.detail-head { display: grid; gap: 14px; }
.detail-head h1 { font-size: clamp(30px, 4vw, 52px); line-height: 1; letter-spacing: -0.04em; font-weight: 600; max-width: 24ch; overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.fact { background: var(--surface); padding: 14px 16px; min-width: 0; }
.fact:nth-child(even) { background: var(--surface-2); }
.fact dt { font-size: 13px; color: var(--muted); }
.fact dd { margin-top: 4px; font-weight: 500; overflow-wrap: anywhere; }
.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form input { background: var(--surface); width: 280px; }
.why { color: var(--ink); max-width: 38ch; }
.ua { max-width: 260px; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.danger-zone { display: flex; justify-content: flex-end; }

@media (max-width: 900px) {
  .headline, .split { grid-template-columns: 1fr; gap: 24px; }
  .tiles, .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { gap: 12px; }
  .topbar-right { margin-left: 0; width: 100%; }
  .topbar-right select { flex: 1; max-width: none; }
  .filters input { width: 100%; }
}

/* connect */
.link-field { width: min(520px, 100%); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.connect-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.connect-step { background: var(--surface); padding: 18px; display: grid; grid-template-columns: auto 1fr; gap: 14px; }
.connect-step:nth-child(even) { background: var(--surface-2); }
.connect-n { font-size: 28px; line-height: 1; font-weight: 600; color: var(--accent); }
.connect-step h3 { font-size: 18px; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.02em; }
@media (max-width: 900px) { .connect-steps { grid-template-columns: 1fr; } }
