/* Newslytter — one stylesheet for every page.
   Look: Material 3 (Flutter's default design language), phone first, built with ui-ux-pro-max.
   Colours: a Material 3 scheme from one seed, blue #0b57d0 (ColorScheme.fromSeed), on neutral grey
   surfaces, light and dark. Type: Roboto, kept on this site so the installed app needs nothing from outside; the
   Material type scale (headline / title / body / label). Shapes: cards 12px, dialogs 28px, FAB
   16px, buttons fully round, text fields 4px. Frame: top app bar (64px), a navigation bar at the
   bottom on phones (80px) that becomes a navigation rail on the left from 600px, one floating
   action button per screen. Spacing on a 4/8px rhythm; touch targets 48px; a ripple on every
   tappable thing (app.js). Window classes: compact < 600, medium 600-839, expanded >= 840. */

@font-face {
  font-family: "Roboto";
  src: url("/assets/fonts/roboto-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Colours: Material 3, seed blue #0b57d0, neutral grey surfaces (no tinted surfaces). */
:root {
  --primary: #0b57d0;            --on-primary: #ffffff;
  --primary-container: #d3e3fd;  --on-primary-container: #041e49;
  --secondary: #5b6170;          --on-secondary: #ffffff;
  --secondary-container: #dde3ee; --on-secondary-container: #171c24;
  --tertiary-container: #ffdea8; --on-tertiary-container: #2a1800;
  --error: #b3261e;              --on-error: #ffffff;
  --error-container: #f9dedc;    --on-error-container: #410e0b;
  --success: #146c2e;            --success-container: #c4eed0; --on-success-container: #072711;
  --surface: #f8f9fb;            --on-surface: #1b1c1f;  --on-surface-variant: #44474e;
  --surface-lowest: #ffffff;     --surface-low: #ffffff;  --surface-container: #eef1f5;
  --surface-high: #e9ecf1;       --surface-highest: #e1e4ea;
  --outline: #74777f;            --outline-variant: #d3d6dc;
  --inverse-surface: #2f3033;    --inverse-on-surface: #f1f0f4; --inverse-primary: #a8c7fa;
  --scrim: rgba(0, 0, 0, .4);
  --elev-1: 0 1px 2px rgba(16, 24, 40, .08), 0 1px 3px rgba(16, 24, 40, .06);
  --elev-2: 0 2px 4px rgba(16, 24, 40, .1), 0 4px 10px rgba(16, 24, 40, .08);
  --elev-3: 0 4px 8px rgba(16, 24, 40, .12), 0 8px 20px rgba(16, 24, 40, .1);
  --font: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --appbar: 64px;
  --navbar: 80px;
  --rail: 88px;
  --gutter: 16px;
  --tf-bg: var(--surface);
  --ease: cubic-bezier(.2, 0, 0, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #a8c7fa;            --on-primary: #062e6f;
    --primary-container: #0842a0;  --on-primary-container: #d3e3fd;
    --secondary: #c2c7d2;          --on-secondary: #2c313a;
    --secondary-container: #3a404b; --on-secondary-container: #dde3ee;
    --tertiary-container: #5c4300; --on-tertiary-container: #ffdea8;
    --error: #f2b8b5;              --on-error: #601410;
    --error-container: #8c1d18;    --on-error-container: #f9dedc;
    --success: #8bd8a0;            --success-container: #0f5223; --on-success-container: #c4eed0;
    --surface: #121316;            --on-surface: #e3e2e6;  --on-surface-variant: #c4c6d0;
    --surface-lowest: #0d0e11;     --surface-low: #1a1b1f;  --surface-container: #1e1f23;
    --surface-high: #282a2e;       --surface-highest: #333539;
    --outline: #8e9099;            --outline-variant: #3d4048;
    --inverse-surface: #e3e2e6;    --inverse-on-surface: #2f3033; --inverse-primary: #0b57d0;
    --scrim: rgba(0, 0, 0, .6);
    --elev-1: none;
    color-scheme: dark;
  }
}

/* ---- base ------------------------------------------------------------------------------------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface); color: var(--on-surface); font: 400 16px/24px var(--font); letter-spacing: .01em; min-height: 100vh; }
a { color: var(--primary); }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 400; }
h2 { font-size: 16px; line-height: 24px; font-weight: 500; }
p { margin: 0 0 12px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.ic { flex: none; display: block; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--on-surface-variant); }
.small { font-size: 14px; line-height: 20px; }

/* ---- the frame -------------------------------------------------------------------------------- */
.practice { background: var(--tertiary-container); color: var(--on-tertiary-container); text-align: center; font-size: 12px; line-height: 16px; padding: 6px 16px; }
.appbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 4px; height: var(--appbar); padding: 0 4px;
  background: var(--surface); transition: background-color .2s var(--ease); }
.appbar.is-scrolled { background: var(--surface-low); box-shadow: 0 1px 0 var(--outline-variant); }
.appbar-brand { display: grid; place-items: center; width: 48px; height: 48px; color: var(--primary); flex: none; }
.appbar-title { flex: 1; min-width: 0; font-size: 22px; line-height: 28px; font-weight: 400; margin-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-actions { display: flex; align-items: center; position: relative; }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; overflow: hidden; background: var(--secondary-container); }
.progress span { position: absolute; top: 0; bottom: 0; width: 40%; background: var(--primary); animation: indet 1.4s var(--ease) infinite; }
@keyframes indet { from { left: -40%; } to { left: 100%; } }
.icon-btn { position: relative; overflow: hidden; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; border: 0; background: transparent;
  color: var(--on-surface-variant); cursor: pointer; text-decoration: none; flex: none; }
.icon-btn::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: currentColor; opacity: 0; transition: opacity .15s; }
.icon-btn:hover::before { opacity: .08; }
.initial { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-container); color: var(--on-primary-container); display: grid; place-items: center;
  font-size: 14px; font-weight: 500; }

.navbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--navbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: var(--surface-low); border-top: 1px solid var(--outline-variant); }
.nav-item { position: relative; overflow: hidden; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--on-surface-variant); text-decoration: none; min-height: 48px; }
.nav-pill { display: grid; place-items: center; width: 64px; height: 32px; border-radius: 16px; transition: background-color .2s var(--ease); }
.nav-item:hover .nav-pill { background: color-mix(in srgb, var(--on-surface) 8%, transparent); }
.nav-item[aria-current="page"] { color: var(--on-surface); }
.nav-item[aria-current="page"] .nav-pill { background: var(--secondary-container); color: var(--on-secondary-container); }
.nav-label { font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: .04em; }
.nav-item[aria-current="page"] .nav-label { font-weight: 700; }
.nav-fab { position: fixed; right: 16px; bottom: calc(var(--navbar) + 16px + env(safe-area-inset-bottom)); z-index: 31; }
.nav-fab:empty { display: none; }
body.has-nav { padding-bottom: calc(var(--navbar) + env(safe-area-inset-bottom)); }
body.has-fab main { padding-bottom: 96px; }

.fab { position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 12px; height: 56px; padding: 0 20px 0 16px; border: 0; border-radius: 16px;
  background: var(--primary-container); color: var(--on-primary-container); font: 500 14px/20px var(--font); letter-spacing: .01em; cursor: pointer; box-shadow: var(--elev-3); }
.fab::before { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity .15s; }
.fab:hover::before { opacity: .08; }

main { width: 100%; max-width: 840px; margin: 0 auto; padding: 8px var(--gutter) 32px; }

/* medium and expanded windows: the navigation bar becomes a rail on the left */
@media (min-width: 600px) {
  :root { --gutter: 24px; }
  body.has-nav { padding-bottom: 0; padding-left: var(--rail); }
  .navbar { top: 0; right: auto; width: var(--rail); height: auto; flex-direction: column; justify-content: flex-start; gap: 12px; padding: 12px 0 0; border-top: 0; border-right: 1px solid var(--outline-variant); }
  .nav-item { flex: none; height: 56px; }
  .nav-fab { position: static; display: flex; justify-content: center; margin: 4px 0 28px; }
  .nav-fab:empty { display: flex; height: 56px; }
  .fab { width: 56px; padding: 0; justify-content: center; }
  .fab-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  body.has-fab main { padding-bottom: 32px; }
  .appbar { padding: 0 12px 0 8px; }
}
@media (min-width: 840px) {
  main { padding: 8px 24px 48px; }
}

/* ---- cards ------------------------------------------------------------------------------------ */
.card { background: var(--surface-low); border: 1px solid var(--outline-variant); border-radius: 12px; padding: 16px; --tf-bg: var(--surface-low); }
.card-filled { background: var(--surface-container); border-color: transparent; }
.card-outlined { background: var(--surface); border: 1px solid var(--outline-variant); box-shadow: none; --tf-bg: var(--surface); }
.card-tonal { background: var(--primary-container); color: var(--on-primary-container); border-color: transparent; }
.card-error { background: var(--error-container); color: var(--on-error-container); border-color: transparent; }
.card-link { position: relative; overflow: hidden; display: block; color: inherit; text-decoration: none; }
.card-link::before { content: ""; position: absolute; inset: 0; background: var(--on-surface); opacity: 0; transition: opacity .15s; pointer-events: none; }
.card-link:hover::before { opacity: .08; }
.section { margin-top: 24px; }
.section-head { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.section-head h2 { flex: 1; }
.count { color: var(--on-surface-variant); font-size: 14px; font-weight: 400; margin-left: 6px; }
.stack { display: grid; gap: 8px; }

/* ---- lists ------------------------------------------------------------------------------------ */
.list { list-style: none; margin: 0; padding: 0; }
.list-card { background: var(--surface-low); border: 1px solid var(--outline-variant); border-radius: 12px; overflow: hidden; }
.list-item { position: relative; overflow: hidden; display: flex; align-items: center; gap: 16px; min-height: 72px; padding: 8px 16px; color: inherit; text-decoration: none; }
a.list-item, button.list-item { cursor: pointer; }
button.list-item { width: 100%; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; }
a.list-item::before, button.list-item::before { content: ""; position: absolute; inset: 0; background: var(--on-surface); opacity: 0; transition: opacity .15s; pointer-events: none; }
a.list-item:hover::before, button.list-item:hover::before { opacity: .08; }
.list > li + li { border-top: 1px solid var(--outline-variant); }
.li-main { flex: 1; min-width: 0; }
.li-head { display: block; font-size: 16px; line-height: 24px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-sub { display: block; font-size: 14px; line-height: 20px; color: var(--on-surface-variant); }
.li-trail { flex: none; color: var(--on-surface-variant); font-size: 12px; line-height: 16px; font-weight: 500; text-align: right; display: flex; align-items: center; gap: 4px; }
.empty { color: var(--on-surface-variant); padding: 24px 16px; text-align: center; font-size: 14px; line-height: 20px; }

/* ---- chips and badges ------------------------------------------------------------------------- */
.chip { position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--outline-variant);
  background: transparent; color: var(--on-surface-variant); font: 500 14px/20px var(--font); white-space: nowrap; flex: none; }
.tag { display: inline-flex; align-items: center; flex: none; white-space: nowrap; height: 24px; padding: 0 10px; border-radius: 8px;
  font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: .04em; background: var(--surface-highest); color: var(--on-surface-variant); }
.tag.ok { background: var(--success-container); color: var(--on-success-container); }
.tag.warn { background: var(--tertiary-container); color: var(--on-tertiary-container); }
.tag.bad { background: var(--error-container); color: var(--on-error-container); }
.tag.accent { background: var(--primary-container); color: var(--on-primary-container); }

/* ---- avatars ---------------------------------------------------------------------------------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--surface-highest); display: block; flex: none; }
.avatar-lg { width: 96px; height: 96px; }
.faces { display: flex; padding-left: 10px; flex: none; }
.faces .avatar, .faces .face-more, .faces .face-none { width: 40px; height: 40px; margin-left: -10px; box-shadow: 0 0 0 2px var(--surface-low); border-radius: 50%; }
.faces img { max-width: none; }
.faces .face-more { display: grid; place-items: center; background: var(--secondary-container); color: var(--on-secondary-container); font-size: 12px; font-weight: 500; }
.faces .face-none { background: var(--surface-highest); }
.is-removed .avatar { filter: grayscale(1); opacity: .6; }

/* ---- buttons ---------------------------------------------------------------------------------- */
.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; min-width: 48px; padding: 0 24px;
  border-radius: 20px; border: 0; background: var(--primary); color: var(--on-primary); font: 500 14px/20px var(--font); letter-spacing: .01em;
  cursor: pointer; text-decoration: none; white-space: nowrap; flex: none; }
.btn::before { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity .15s; pointer-events: none; }
.btn:hover::before { opacity: .08; }
.btn:active::before { opacity: .12; }
.btn.tonal { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn.outlined { background: transparent; color: var(--primary); border: 1px solid var(--outline); }
.btn.quiet, .btn.text { background: transparent; color: var(--primary); padding: 0 12px; }
.btn.danger { background: transparent; color: var(--error); padding: 0 12px; }
.btn.small { height: 36px; padding: 0 16px; }
.btn.wide { width: 100%; }
.btn[disabled] { background: color-mix(in srgb, var(--on-surface) 12%, transparent); color: color-mix(in srgb, var(--on-surface) 50%, transparent); border-color: transparent; cursor: default; }
.btn.quiet[disabled], .btn.text[disabled] { background: transparent; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .18; transform: scale(0); animation: ripple .55s var(--ease) forwards; pointer-events: none; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

/* ---- text fields (outlined, floating label) --------------------------------------------------- */
.tf { position: relative; margin: 8px 0 0; }
.tf input { width: 100%; height: 56px; padding: 16px; font: 400 16px/24px var(--font); color: var(--on-surface); background: transparent;
  border: 1px solid var(--outline); border-radius: 4px; outline: 0; }
.tf input:hover { border-color: var(--on-surface); }
.tf input:focus { border: 2px solid var(--primary); padding: 15px; }
.tf label { position: absolute; left: 12px; top: 16px; padding: 0 4px; font-size: 16px; line-height: 24px; color: var(--on-surface-variant); background: var(--tf-bg);
  pointer-events: none; transition: top .15s var(--ease), font-size .15s var(--ease), color .15s; }
.tf input:focus + label, .tf input:not(:placeholder-shown) + label { top: -9px; font-size: 12px; line-height: 16px; }
.tf input:focus + label { color: var(--primary); }
.tf input::placeholder { color: transparent; }
.tf input:focus::placeholder { color: var(--on-surface-variant); }
.tf input[aria-invalid=true] { border-color: var(--error); }
.tf input[aria-invalid=true] + label { color: var(--error); }
.tf-help { font-size: 12px; line-height: 16px; color: var(--on-surface-variant); margin: 4px 16px 0; }
.tf-error { font-size: 12px; line-height: 16px; color: var(--error); margin: 4px 16px 0; }
.tf .code { font-variant-numeric: tabular-nums; font-size: 24px; letter-spacing: .4em; text-align: center; }

/* ---- messages --------------------------------------------------------------------------------- */
.note { border-radius: 12px; padding: 12px 16px; background: var(--surface-highest); margin: 0 0 16px; font-size: 14px; line-height: 20px; }
.note.bad { background: var(--error-container); color: var(--on-error-container); }
.note.ok { background: var(--success-container); color: var(--on-success-container); }
.toast { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 50; display: flex; align-items: center; gap: 12px;
  min-height: 48px; padding: 14px 16px; border-radius: 4px; background: var(--inverse-surface); color: var(--inverse-on-surface); font-size: 14px; line-height: 20px; box-shadow: var(--elev-3); }
body.has-nav .toast { bottom: calc(var(--navbar) + 16px + env(safe-area-inset-bottom)); }
body.has-fab .toast { bottom: calc(var(--navbar) + 88px + env(safe-area-inset-bottom)); }
.toast .btn { background: transparent; color: var(--inverse-primary); padding: 0 8px; margin-left: auto !important; }
@media (min-width: 600px) { .toast, body.has-nav .toast, body.has-fab .toast { left: calc(var(--rail) + 24px); right: auto; max-width: 560px; bottom: 24px; } }

/* ---- dialogs and menus ------------------------------------------------------------------------ */
dialog { --tf-bg: var(--surface-high); border: 0; border-radius: 28px; padding: 0; width: min(560px, calc(100% - 48px)); background: var(--surface-high); color: var(--on-surface); box-shadow: var(--elev-3); }
dialog::backdrop { background: var(--scrim); }
.dlg { padding: 24px; }
.dlg h2 { font-size: 24px; line-height: 32px; font-weight: 400; margin-bottom: 16px; }
.dlg-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.dlg-head h2 { margin: 0; }
.dlg p.desc { font-size: 14px; line-height: 20px; color: var(--on-surface-variant); }
.dlg .btns { margin-top: 24px; justify-content: flex-end; }
.menu { position: absolute; right: 0; top: 48px; z-index: 40; min-width: 220px; padding: 8px 0; border-radius: 4px; background: var(--surface-container); box-shadow: var(--elev-2); }
.menu-item { position: relative; overflow: hidden; display: flex; align-items: center; width: 100%; height: 48px; padding: 0 16px; border: 0; background: transparent;
  color: var(--on-surface); font: 400 14px/20px var(--font); text-align: left; cursor: pointer; }
.menu-item::before { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity .15s; }
.menu-item:hover::before, .menu-item:focus-visible::before { opacity: .08; }
.menu-item.is-danger { color: var(--error); }

/* ---- tabs ------------------------------------------------------------------------------------- */
.tabs { position: sticky; top: var(--appbar); z-index: 20; display: flex; background: var(--surface); border-bottom: 1px solid var(--surface-highest); margin: 0 calc(-1 * var(--gutter)); }
.tab { position: relative; overflow: hidden; flex: 1; height: 48px; border: 0; background: transparent; color: var(--on-surface-variant); font: 500 14px/20px var(--font); cursor: pointer; }
.tab[aria-selected="true"] { color: var(--primary); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 56px; height: 3px; margin-left: -28px; border-radius: 3px 3px 0 0; background: var(--primary); }
.tab .count { font-weight: 400; margin-left: 2px; color: inherit; }
@media (min-width: 600px) { .tabs { margin: 0; } .tab { flex: none; padding: 0 24px; } }
.tabpanel { padding-top: 16px; }

/* ---- home ------------------------------------------------------------------------------------- */
.hello { margin: 8px 0 16px; }
.hello h2 { font-size: 28px; line-height: 36px; font-weight: 400; }
.finding { display: flex; gap: 16px; align-items: flex-start; }
.finding p { margin: 0; font-size: 14px; line-height: 20px; }
.finding strong { font-weight: 500; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.stat { border-radius: 12px; padding: 16px; background: var(--surface-low); border: 1px solid var(--outline-variant); }
.stat-value { font-size: 32px; line-height: 40px; font-weight: 400; margin: 0; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 14px; line-height: 20px; color: var(--on-surface-variant); margin: 0; }
.stat.is-lead { background: var(--primary-container); color: var(--on-primary-container); border-color: transparent; }
.stat.is-lead .stat-label { color: var(--on-primary-container); }
@media (min-width: 840px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.nl-top { display: flex; align-items: center; gap: 16px; }
.nl-week { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
/* A newsletter's description (written from its channels) and its most off-topic channel, under its name. */
.nl-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 12px; font-size: 14px; line-height: 20px; color: var(--on-surface-variant); }
.nl-fit { display: block; margin-top: 6px; font-size: 12px; line-height: 16px; color: var(--on-surface-variant); }
.nl-fit strong { font-weight: 500; color: var(--on-surface); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; flex: 1; max-width: 240px; }
.week i { display: block; height: 8px; border-radius: 4px; background: transparent; box-shadow: inset 0 0 0 1px var(--outline-variant); font-style: normal; }
.week i.sent { background: var(--primary); box-shadow: none; }
.week i.nil { background: var(--outline-variant); box-shadow: none; }
.week i.failed { background: var(--error); box-shadow: none; }
.nl-week .li-trail { margin-left: auto; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--on-surface-variant); font-size: 12px; line-height: 16px; margin: 0 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 16px; height: 8px; border-radius: 4px; display: inline-block; }
.swatch.sent { background: var(--primary); }
.swatch.nil { background: var(--outline-variant); }
.swatch.failed { background: var(--error); }
.st-ok { color: var(--success); }
.st-bad { color: var(--error); }
.nl-grid { display: grid; gap: 8px; list-style: none; margin: 0; padding: 0; }
@media (min-width: 840px) { .nl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.skel { height: 112px; border-radius: 12px; background: var(--surface-container); }
.kv { list-style: none; margin: 0; padding: 0; }
.kv li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; font-size: 14px; line-height: 20px; }
.kv li + li { border-top: 1px solid var(--outline-variant); }
.kv span:first-child { color: var(--on-surface-variant); }

/* ---- one newsletter --------------------------------------------------------------------------- */
.summary { margin: 8px 0 16px; }
.summary p { margin: 0; font-size: 14px; line-height: 20px; }
.danger-zone { margin-top: 32px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.danger-zone p { margin: 0; color: var(--on-surface-variant); font-size: 14px; line-height: 20px; flex: 1 1 240px; }

/* ---- settings --------------------------------------------------------------------------------- */
.set-group { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--primary); margin: 24px 16px 8px; }
.set-card { background: var(--surface-low); border: 1px solid var(--outline-variant); border-radius: 12px; padding: 16px; --tf-bg: var(--surface-low); }
.set-card > :last-child { margin-bottom: 0; }

/* ---- one email -------------------------------------------------------------------------------- */
.reader { width: 100%; min-height: 72vh; border: 0; background: var(--surface-container); display: block; }
.reader-frame { margin-top: 8px; border-radius: 12px; overflow: hidden; background: var(--surface-container); }

/* ---- sign in, set-up (no frame) --------------------------------------------------------------- */
.solo { max-width: 440px; padding: 48px 16px; }
.solo .brand { display: inline-flex; color: var(--primary); margin-bottom: 24px; }
.solo .brand .mark { width: 48px; height: 48px; }
.solo h1 { font-size: 28px; line-height: 36px; font-weight: 400; }
.solo .lead { color: var(--on-surface-variant); font-size: 14px; line-height: 20px; margin: 8px 0 24px; }
.solo .foot { color: var(--on-surface-variant); font-size: 14px; line-height: 20px; margin: 16px 0 0; text-align: center; }
.steps { margin: 0; padding-left: 20px; }
.steps > li { margin-bottom: 24px; }
.steps > li:last-child { margin-bottom: 0; }

/* ---- channel page: numbers, search, filters, a reading panel ------------------------------------ */
main.wide { max-width: 1360px; }
.ch-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin: 8px 0 20px; }
.ch-head .avatar { width: 72px; height: 72px; }
.ch-id { flex: 1 1 320px; min-width: 0; }
.ch-id h1 { font-size: 28px; line-height: 36px; font-weight: 400; }
.ch-id .sub { margin: 2px 0 0; font-size: 14px; line-height: 20px; color: var(--on-surface-variant); }
.ch-id .desc { margin: 6px 0 0; font-size: 14px; line-height: 20px; color: var(--on-surface-variant); max-width: 80ch; }
.ch-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; position: relative; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 840px) { .kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.kpi { border-radius: 12px; padding: 14px 16px; background: var(--surface-low); border: 1px solid var(--outline-variant); min-width: 0; }
.kpi-label { margin: 0; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--on-surface-variant); }
.kpi-value { margin: 2px 0; font-size: 28px; line-height: 36px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { margin: 0; font-size: 12px; line-height: 16px; color: var(--on-surface-variant); }
.insights { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.insights .card { flex: 1 1 380px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; }
.card-head span { font-size: 12px; line-height: 16px; color: var(--on-surface-variant); }
.hours { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; align-items: end; height: 96px; margin-top: 16px; }
.hours i { display: block; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--surface-highest); }
.hours i.on { background: var(--primary); }
.hours-axis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); font-size: 11px; line-height: 16px; color: var(--on-surface-variant); margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--outline-variant); }
.insight-note { margin: 10px 0 0; font-size: 13px; line-height: 18px; color: var(--on-surface-variant); }
.insight-note strong { color: var(--on-surface); font-weight: 500; }
.topics { display: grid; gap: 2px; margin-top: 10px; }
.topic { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 32px; align-items: center; gap: 12px; min-height: 36px;
  padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--on-surface); font: 500 13px/18px var(--font); text-align: left; cursor: pointer; }
.topic:hover { background: var(--surface-container); }
.topic[aria-pressed="true"] { background: var(--primary-container); color: var(--on-primary-container); }
.topic .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic .bar { height: 8px; border-radius: 4px; background: var(--surface-container); overflow: hidden; }
.topic .bar b { display: block; height: 8px; border-radius: 4px; background: var(--primary); }
.topic .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--on-surface-variant); }
.filters { margin-top: 8px; display: grid; gap: 12px; }
.f-row { display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: center; }
.search { flex: 1 1 320px; min-width: 0; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 8px 0 16px; border-radius: 24px; background: var(--surface-container); color: var(--on-surface-variant); }
.search:focus-within { outline: 2px solid var(--primary); outline-offset: 0; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--on-surface); font: 400 15px/20px var(--font); }
.search input::-webkit-search-cancel-button { display: none; }
.search .icon-btn { width: 40px; height: 40px; }
/* Material 3 segmented buttons: each segment carries its own border, so the ripple and the rounded ends stay clean. */
.seg { display: inline-flex; flex: none; }
.seg button { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 14px; margin-left: -1px;
  border: 1px solid var(--outline); border-radius: 0; background: transparent; color: var(--on-surface); font: 500 13px/18px var(--font); white-space: nowrap; cursor: pointer; }
.seg button:first-child { margin-left: 0; border-radius: 20px 0 0 20px; padding-left: 16px; }
.seg button:last-child { border-radius: 0 20px 20px 0; padding-right: 16px; }
.seg button:hover { background: color-mix(in srgb, var(--on-surface) 6%, transparent); }
.seg button[aria-pressed="true"] { background: var(--secondary-container); color: var(--on-secondary-container); }
.select { height: 40px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--outline); background: var(--surface-low); color: var(--on-surface); font: 400 14px/20px var(--font); }
.f-tools { display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; }
.f-sort { display: flex; align-items: center; gap: 8px; font-size: 14px; line-height: 20px; color: var(--on-surface-variant); }
.chip-strip { display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: center; }
.chip-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.f-label { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--on-surface-variant); min-width: 64px; }
button.chip { cursor: pointer; }
button.chip:hover { background: var(--surface-container); }
.chip[aria-pressed="true"] { background: var(--secondary-container); color: var(--on-secondary-container); border-color: transparent; }
.chip .n { font-weight: 400; font-variant-numeric: tabular-nums; opacity: .8; }
.f-sep { width: 1px; height: 24px; background: var(--outline-variant); margin: 0 4px; flex: none; }
.f-foot { display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--outline-variant); }
.f-foot p { margin: 0; font-size: 14px; line-height: 20px; color: var(--on-surface-variant); }
.f-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.results { display: flex; gap: 16px; align-items: flex-start; margin-top: 16px; }
.vlist { flex: 1 1 0; min-width: 0; display: grid; gap: 8px; align-content: start; }
.vcard { position: relative; display: flex; gap: 16px; padding: 12px; border-radius: 12px; background: var(--surface-low); border: 1px solid var(--outline-variant); cursor: pointer; }
.vcard:hover { border-color: var(--outline); }
.vcard.is-sel { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.vthumb { position: relative; flex: none; width: 176px; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--surface-highest); align-self: flex-start; }
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vbody { flex: 1; min-width: 0; display: grid; gap: 6px; align-content: start; }
.vmeta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; line-height: 16px; color: var(--on-surface-variant); }
.vtitle { margin: 0; font-size: 16px; line-height: 22px; font-weight: 500; }
.vtitle button { all: unset; cursor: pointer; }
.vtitle button:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.vgist { margin: 0; font-size: 14px; line-height: 20px; color: var(--on-surface-variant); }
.vhit { display: flex; gap: 8px; align-items: baseline; font-size: 13px; line-height: 18px; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--tertiary-container) 45%, transparent); }
.vhit .where { font-weight: 500; color: var(--on-surface); }
.vacts { display: flex; gap: 0 4px; flex-wrap: wrap; align-items: center; margin-left: -8px; }
.vacts .btn { height: 32px; padding: 0 8px; font-size: 13px; }
.vacts .n { margin-left: auto; font-size: 12px; color: var(--on-surface-variant); }
mark { background: var(--tertiary-container); color: var(--on-tertiary-container); border-radius: 3px; padding: 0 1px; }
.ts { flex: none; display: inline-block; min-width: 40px; text-align: center; font-size: 12px; font-weight: 500; line-height: 20px; padding: 0 6px; border-radius: 6px;
  background: var(--primary-container); color: var(--on-primary-container); text-decoration: none; font-variant-numeric: tabular-nums; }
.ts:hover { text-decoration: underline; }
.vtable-wrap { background: var(--surface-low); border: 1px solid var(--outline-variant); border-radius: 12px; overflow-x: auto; }
.vtable { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 14px; line-height: 20px; }
.vtable th { text-align: left; font-size: 12px; font-weight: 500; color: var(--on-surface-variant); padding: 10px 12px; border-bottom: 1px solid var(--outline-variant); white-space: nowrap; }
.vtable td { padding: 8px 12px; border-bottom: 1px solid var(--outline-variant); vertical-align: middle; }
.vtable tr:last-child td { border-bottom: 0; }
.vtable tbody tr { cursor: pointer; }
.vtable tbody tr:hover { background: var(--surface-container); }
.vtable tr.is-sel { background: color-mix(in srgb, var(--primary-container) 55%, transparent); }
.vtable .r { text-align: right; font-variant-numeric: tabular-nums; }
.vtable .when { white-space: nowrap; color: var(--on-surface-variant); font-variant-numeric: tabular-nums; }
.vtable .icon-btn { width: 40px; height: 40px; display: inline-grid; }
.panel { flex: 0 0 420px; min-width: 0; position: sticky; top: calc(var(--appbar) + 8px); max-height: calc(100vh - var(--appbar) - 16px); overflow-y: auto;
  background: var(--surface-low); border: 1px solid var(--outline-variant); border-radius: 12px; }
.panel-close { display: none; }
.p-thumb { display: block; position: relative; aspect-ratio: 16 / 9; background: var(--surface-highest); }
.p-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.p-thumb .play { position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; border-radius: 50%; background: rgba(0, 0, 0, .6); display: grid; place-items: center; color: #fff; }
.p-head { padding: 16px 16px 0; display: grid; gap: 6px; }
.p-head h2 { font-size: 18px; line-height: 24px; font-weight: 500; }
.p-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; position: relative; }
.p-acts .btn { height: 36px; padding: 0 14px; }
.panel .tabs { position: static; margin: 12px 0 0; }
.panel .tab { flex: 1; padding: 0; }
.p-body { padding: 16px; }
.p-gist { margin: 0 0 14px; font-size: 15px; line-height: 22px; }
.p-moments { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.p-moments li { display: flex; gap: 10px; align-items: baseline; font-size: 14px; line-height: 20px; }
.tr-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--outline-variant); }
.tr-tools .search { height: 40px; flex: 1 1 180px; }
.tr-tools .count { margin: 0; font-size: 12px; }
.tr-lines { list-style: none; margin: 0; padding: 8px; display: grid; gap: 2px; }
.tr-lines li { display: flex; gap: 10px; align-items: baseline; padding: 6px 8px; border-radius: 8px; font-size: 14px; line-height: 21px; }
.tr-lines li.hit { background: color-mix(in srgb, var(--tertiary-container) 45%, transparent); }
.tr-lines li span { flex: 1; min-width: 0; }
.tr-lines .icon-btn { width: 32px; height: 32px; align-self: center; opacity: .55; }
.tr-lines li:hover .icon-btn, .tr-lines .icon-btn:focus-visible { opacity: 1; }
.tr-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--outline-variant); position: sticky; bottom: 0; background: var(--surface-low); }
.tr-foot label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--on-surface-variant); min-height: 40px; cursor: pointer; margin-right: auto; }
.tr-foot input { width: 18px; height: 18px; accent-color: var(--primary); }
.tr-foot .btn { height: 36px; padding: 0 14px; }
.skel-line { height: 12px; border-radius: 6px; background: var(--surface-container); margin: 14px 16px; }
.menu .menu-item { gap: 12px; text-decoration: none; }
.menu-head { margin: 0; padding: 6px 16px 8px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--on-surface-variant); }
.menu-sep { height: 1px; background: var(--outline-variant); margin: 8px 0; }
.share-menu { top: 44px; min-width: 300px; border-radius: 12px; }
/* Up to 1099px the reading panel is a sheet over the page, opened by choosing a video. */
@media (max-width: 1099px) {
  .panel { position: fixed; inset: 0; z-index: 45; max-height: none; border: 0; border-radius: 0; flex: none; display: none; padding-bottom: env(safe-area-inset-bottom); }
  .panel.is-open { display: block; }
  .panel-close { display: grid; position: absolute; top: 8px; left: 8px; z-index: 2; background: rgba(0, 0, 0, .55); color: #fff; }
  body.sheet-open { overflow: hidden; }
}
/* Phones: search on top; "search in" and sort share one line; the status and date chips are one row that
   scrolls sideways (labels go to screen readers only); cards only; the footer is the count plus two icon buttons. */
@media (max-width: 599px) {
  .vcard { flex-direction: column; gap: 10px; }
  .vthumb { width: 100%; }
  .ch-head { gap: 12px; }
  .ch-head .avatar { width: 56px; height: 56px; }
  .ch-id h1 { font-size: 24px; line-height: 32px; }
  .ch-actions { width: 100%; flex-wrap: nowrap; }
  .ch-actions .btn { flex: 1 1 0; min-width: 0; padding: 0 12px; }
  .kpi:last-child:nth-child(odd) { grid-column: span 2; }
  .wide-only { display: none; }
  .filters { padding: 12px; gap: 12px; }
  .filters .f-row { gap: 12px; }
  .search { flex-basis: 100%; }
  .f-tools { width: 100%; flex-wrap: nowrap; }
  .f-tools .seg { flex: none; }
  .f-sort { flex: 1; min-width: 0; }
  .f-sort .select { width: 100%; min-width: 0; }
  .f-view { display: none; }
  .chip-strip { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 2px 12px;
    scroll-padding-inline: 12px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); }
  .chip-strip::-webkit-scrollbar { display: none; }
  .chip-group { flex-wrap: nowrap; }
  .chip-strip .f-label { display: none; }
  .chip-strip .chip { padding: 0 12px; }
  .chip-strip > :last-child { padding-right: 24px; }
  .f-foot { flex-wrap: nowrap; gap: 8px; padding-top: 10px; }
  .f-foot p { flex: 1; min-width: 0; font-size: 13px; line-height: 18px; }
  .f-acts { flex-wrap: nowrap; gap: 4px; }
  .f-acts .lbl { display: none; }
  .f-acts .btn.outlined { width: 40px; height: 40px; min-width: 40px; padding: 0; border-radius: 50%; }
  .f-acts .btn.text { padding: 0 8px; }
}
.args { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--surface-container); border-radius: 8px; padding: 12px; margin: 8px 0 0; white-space: pre-wrap; }
.args:empty { display: none; }

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