/* Alpha Stock, in the Alpha Subscriptions look: black and white with the sunset gradient
   (purple → magenta → orange) as the one accent, and Source Sans 3 throughout. */
@font-face {
  font-family: "Source Sans 3"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("/fonts/source-sans-3-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Sans 3"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("/fonts/source-sans-3-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C4, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  /* From alphasubscriptions.com */
  --ink: #000000;
  --text: #2c2c2c;
  --muted: #6d6d6d;
  --line: #e1e1e1;
  --line-soft: #ececec;
  --surface: #f5f5f5;
  --paper: #ffffff;
  --night: #0c0c0e;
  --night-2: #17171b;
  --night-3: #232329;
  --purple: #7b1fa2;
  --magenta: #e01e5a;
  --ember: #ff5a1f;
  --sunset: linear-gradient(135deg, #7b1fa2, #e01e5a 55%, #ff5a1f);
  --sunset-flat: linear-gradient(90deg, #7b1fa2, #e01e5a 55%, #ff5a1f);
  --ember-text: #b8360c;
  --ember-wash: #fff1ea;
  --good: #0b7a54;
  --bad: #c9252d;
  --bad-soft: #fde6e6;
  --blue: #3b63fb;

  --font: "Source Sans 3", "Trebuchet MS", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;

  --r-card: 18px;
  --r-control: 10px;
  --shadow-card: 0 1px 0 rgb(0 0 0 / 0.03), 0 14px 34px -20px rgb(0 0 0 / 0.35);
  --shadow-lift: 0 1px 0 rgb(0 0 0 / 0.04), 0 24px 50px -24px rgb(0 0 0 / 0.45);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--surface); color: var(--text); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Icons are inline SVG drawn by app.js into [data-icon] spans. */
[data-icon] { display: inline-flex; width: 1.05em; height: 1.05em; flex: none; }
[data-icon] svg { width: 100%; height: 100%; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 100vh; }

/* ---------- Rail ---------- */
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px;
  padding: 28px 22px 22px; color: #dcdcdc;
  background:
    radial-gradient(90% 40% at 0% 0%, rgb(224 30 90 / 0.22), transparent 65%),
    radial-gradient(70% 30% at 100% 100%, rgb(255 90 31 / 0.12), transparent 70%),
    var(--night);
}
.rail::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 1px;
  background: linear-gradient(180deg, transparent, rgb(255 90 31 / 0.5), rgb(123 31 162 / 0.4), transparent);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 8px 22px -8px rgb(224 30 90 / 0.8); }
.brand-name { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -0.01em; color: #fff; }
.brand-sub { margin: 0; font-size: 13px; color: #a3a3a3; }

.products { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -8px; padding: 0 8px; }
.rail-heading { margin: 0 0 8px 10px; font-size: 13px; color: #8a8a8a; }
.product-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.product {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border: 0; border-radius: var(--r-control); background: transparent;
  color: #cfcfcf; text-align: left; cursor: pointer; position: relative;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.product:hover { background: rgb(255 255 255 / 0.05); color: #fff; }
.product.on { background: rgb(255 255 255 / 0.09); color: #fff; }
.product.on::before {
  content: ""; position: absolute; left: -8px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px;
  background: linear-gradient(180deg, var(--ember), var(--magenta), var(--purple));
}
.product-name { font-size: 16.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-count {
  min-width: 26px; padding: 1px 8px; border-radius: 999px; text-align: center; font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: #a3a3a3; background: rgb(255 255 255 / 0.07);
}
.product.on .product-count { color: #fff; background: var(--sunset); }
.rail-empty { margin: 4px 10px; font-size: 14px; color: #8a8a8a; }

.new-product {
  display: flex; gap: 6px; padding: 6px; border-radius: 14px;
  background: rgb(255 255 255 / 0.06); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.09);
}
.new-product input { flex: 1; min-width: 0; border: 0; background: transparent; color: #fff; padding: 8px 10px; border-radius: 8px; }
.new-product input::placeholder { color: #7d7d7d; }
.new-product input:focus-visible { outline: none; }
.new-product:focus-within { box-shadow: inset 0 0 0 1px rgb(255 90 31 / 0.65); }
.add-product {
  width: 38px; border: 0; border-radius: 9px; cursor: pointer; display: grid; place-items: center;
  color: #fff; background: var(--sunset);
}
.add-product:hover { filter: brightness(1.08); }
.rail-error { margin: -12px 4px 0; font-size: 14px; color: #ff9c94; }
.rail-foot { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: 13px; line-height: 1.5; color: #7d7d7d; }
.rail-foot [data-icon] { margin-top: 2px; color: var(--ember); }

/* ---------- Stage ---------- */
.stage { padding: 44px 48px 40px; display: flex; flex-direction: column; min-width: 0; }
.stage-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 30px; }
.title-block h1 {
  margin: 0; font-weight: 900; font-size: clamp(36px, 3.6vw, 52px);
  line-height: 1; letter-spacing: -0.025em; color: var(--ink);
}
.title-block h1::after {
  content: ""; display: block; width: 64px; height: 4px; margin-top: 14px; border-radius: 4px; background: var(--sunset-flat);
}
.meta { margin: 12px 0 0; color: var(--muted); }
.meta strong { color: var(--ember-text); font-weight: 700; }
.tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.search {
  display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 44px; width: 300px; max-width: 100%;
  border-radius: 12px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); color: var(--muted);
}
.search:focus-within { box-shadow: inset 0 0 0 1.5px var(--blue), 0 0 0 3px rgb(59 99 251 / 0.18); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; height: 100%; color: var(--ink); }
.search input:focus-visible { outline: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px;
  border-radius: 12px; border: 0; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.primary { color: #fff; background: var(--ink); box-shadow: 0 10px 24px -14px rgb(0 0 0 / 0.9); position: relative; isolation: isolate; }
.btn.primary::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--sunset);
  opacity: 0; transition: opacity 0.2s var(--ease);
}
.btn.primary:hover:not(:disabled)::before { opacity: 1; }
.btn.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 28px -14px rgb(224 30 90 / 0.8); }
.btn.primary:active:not(:disabled) { transform: translateY(0); }
.btn.quiet { background: transparent; color: var(--muted); padding: 0 12px; }
.btn.quiet:hover { background: var(--line-soft); color: var(--ink); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); color: var(--bad); }

/* ---------- Sign in ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(120% 80% at 50% 0%, #1a1a1a 0%, #000 60%);
}
.login-card {
  position: relative; width: min(400px, 100%); display: flex; flex-direction: column; gap: 10px;
  padding: 36px 32px 32px; background: var(--paper); border-radius: 20px; overflow: hidden;
  box-shadow: 0 40px 80px -30px rgb(224 30 90 / 0.45);
}
.login-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--sunset-flat); }
.login-mark { margin-bottom: 6px; }
.login-title { margin: 0; font-size: 28px; line-height: 1.15; color: var(--ink); }
.login-sub { margin: 0 0 14px; color: var(--muted); line-height: 1.5; }
.login-card label { font-weight: 700; font-size: 14px; color: var(--ink); }
.login-card input {
  height: 46px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); font: inherit;
}
.login-card input:focus-visible { outline: none; box-shadow: inset 0 0 0 1.5px var(--ink), 0 0 0 3px rgb(255 90 31 / 0.25); }
.login-card .btn { margin-top: 8px; width: 100%; }
.sign-out {
  align-self: flex-start; margin-top: -14px; padding: 6px 0; border: 0; background: none; cursor: pointer;
  color: #9a9a9a; font: inherit; font-size: 13px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
}
.sign-out:hover, .sign-out:focus-visible { color: #fff; }

/* ---------- Account cards ---------- */
.accounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 20px; align-content: start; }
.acct {
  position: relative; display: flex; flex-direction: column; gap: 16px; padding: 20px 20px 18px;
  background: var(--paper); border-radius: var(--r-card); box-shadow: var(--shadow-card); overflow: hidden;
  transition: box-shadow 0.2s var(--ease);
}
.acct::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--sunset-flat); }
.acct:hover { box-shadow: var(--shadow-lift); }
.acct-head { display: flex; align-items: center; gap: 14px; }
.monogram {
  width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 17px; font-weight: 800; color: #fff; background: var(--sunset);
  box-shadow: 0 8px 18px -10px rgb(224 30 90 / 0.9);
}
.acct-title { min-width: 0; flex: 1; }
.acct-title h3 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -0.01em; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-title p { margin: 1px 0 0; font-size: 13px; color: var(--muted); }
.acct-menu { display: flex; gap: 2px; opacity: 0.55; transition: opacity 0.15s; }
.acct:hover .acct-menu, .acct:focus-within .acct-menu { opacity: 1; }

.icon-btn {
  width: 32px; height: 32px; border: 0; border-radius: 9px; display: grid; place-items: center;
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }
.icon-btn.danger:hover { background: var(--bad-soft); color: var(--bad); }

.fields { margin: 0; display: grid; gap: 2px; }
.field { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 36px; border-top: 1px solid var(--line-soft); }
.field:first-child { border-top: 0; }
.field dt { font-size: 13.5px; color: var(--muted); }
.field dd { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.field .secret { font-family: var(--mono); font-size: 13.5px; letter-spacing: 0.02em; }
.field .secret.masked { letter-spacing: 0.18em; color: var(--muted); }
.field-actions { display: flex; gap: 2px; }
.field-actions .icon-btn { width: 28px; height: 28px; }
.postal { font-variant-numeric: tabular-nums; letter-spacing: 0.06em; font-weight: 600; }

.card-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card-slot {
  display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 12px; min-width: 0;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-soft);
}
.card-slot span:first-child { font-size: 13px; color: var(--muted); }
.card-slot .value { display: flex; align-items: center; gap: 6px; min-width: 0; }
.card-slot .value .secret { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 13px; }
.card-slot .value .icon-btn { width: 24px; height: 24px; margin-left: auto; }
.card-slot.missing { background: var(--ember-wash); box-shadow: inset 0 0 0 1px rgb(255 90 31 / 0.3); }
.card-slot.missing button.fill {
  border: 0; background: none; padding: 0; color: var(--ember-text); font-weight: 700; cursor: pointer;
  text-decoration: underline; text-decoration-color: rgb(255 90 31 / 0.5); text-underline-offset: 3px;
}

.acct-note { margin: -4px 0 0; font-size: 14px; color: var(--muted); font-style: italic; }
.no-match { grid-column: 1 / -1; color: var(--muted); padding: 40px 0; text-align: center; }

/* ---------- Empty state ---------- */
.empty { margin: 6vh auto 0; max-width: 460px; text-align: center; }
.empty h2 { margin: 28px 0 8px; font-size: 28px; font-weight: 900; letter-spacing: -0.02em; color: var(--ink); }
.empty p { margin: 0 0 22px; color: var(--muted); }
.empty-card { position: relative; width: 220px; height: 136px; margin: 0 auto; }
.empty-card span { position: absolute; inset: 0; border-radius: 16px; background: var(--night); box-shadow: var(--shadow-lift); overflow: hidden; }
.empty-card span:nth-child(1) { transform: rotate(-9deg) translate(-26px, 8px); background: var(--purple); opacity: 0.45; }
.empty-card span:nth-child(2) { transform: rotate(-3deg) translate(-8px, 2px); background: var(--magenta); opacity: 0.6; }
.empty-card span:nth-child(3) { background: radial-gradient(120% 90% at 100% 0%, rgb(255 90 31 / 0.45), transparent 60%), var(--night); }
.empty-card span:nth-child(3)::after {
  content: ""; position: absolute; left: 18px; top: 22px; width: 34px; height: 26px; border-radius: 6px; background: var(--sunset);
}

.stage-foot { margin-top: auto; padding-top: 48px; display: flex; justify-content: flex-end; }

/* ---------- Dialog ---------- */
dialog {
  padding: 0; border: 0; border-radius: 24px; width: min(940px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  background: var(--paper); color: var(--text); box-shadow: 0 40px 90px -30px rgb(0 0 0 / 0.65); overflow: hidden;
}
dialog::backdrop { background: rgb(12 12 14 / 0.6); backdrop-filter: blur(6px); }
dialog[open] { animation: rise 0.28s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(0.985); } }

.sheet { display: grid; grid-template-columns: 360px minmax(0, 1fr); max-height: calc(100vh - 32px); }
.preview-side {
  display: flex; flex-direction: column; gap: 28px; padding: 34px 30px 28px; color: #dcdcdc;
  background:
    radial-gradient(90% 45% at 100% 0%, rgb(224 30 90 / 0.28), transparent 65%),
    radial-gradient(80% 40% at 0% 100%, rgb(123 31 162 / 0.25), transparent 70%),
    var(--night);
}

/* The live identity card: the one showpiece of the page. */
.id-card {
  position: relative; aspect-ratio: 1.586; border-radius: 18px; padding: 18px 20px; overflow: hidden;
  display: grid; grid-template-rows: auto 1fr auto auto auto; color: #fff;
  background:
    radial-gradient(110% 90% at 105% -5%, rgb(255 90 31 / 0.55), transparent 50%),
    radial-gradient(90% 80% at -10% 110%, rgb(123 31 162 / 0.6), transparent 55%),
    linear-gradient(150deg, var(--night-3), var(--night-2) 50%, #08080a);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12), 0 26px 50px -24px rgb(0 0 0 / 0.8);
}
.id-card::after {
  content: ""; position: absolute; inset: -40% auto -40% -60%; width: 45%;
  background: linear-gradient(100deg, transparent, rgb(255 220 200 / 0.35), transparent);
  transform: translateX(0) rotate(12deg); opacity: 0; pointer-events: none;
}
.id-card.mint::after { animation: sheen 0.9s var(--ease); }
.id-card.mint .id-name, .id-card.mint .id-email, .id-card.mint .id-postal, .id-card.mint .id-monogram { animation: settle 0.5s var(--ease); }
@keyframes sheen { 0% { opacity: 0; transform: translateX(0) rotate(12deg); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateX(420%) rotate(12deg); } }
@keyframes settle { from { opacity: 0; transform: translateY(6px); filter: blur(3px); } }

.id-top { display: flex; justify-content: space-between; align-items: center; }
.id-chip {
  width: 38px; height: 28px; border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 45%, rgb(0 0 0 / 0.25) 45% 55%, transparent 55%),
    linear-gradient(0deg, transparent 45%, rgb(0 0 0 / 0.25) 45% 55%, transparent 55%),
    var(--sunset);
}
.id-product { font-size: 15px; font-weight: 700; color: #fff; opacity: 0.9; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.id-monogram {
  align-self: center; justify-self: end; font-size: 46px; font-weight: 900; line-height: 1; letter-spacing: -0.03em;
  color: rgb(255 255 255 / 0.14);
}
.id-name { margin: 0; font-size: 23px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.id-email { margin: 4px 0 10px; font-size: 13px; color: #d6d6d6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.id-bottom { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; color: #b0b0b0; }
.id-postal { font-variant-numeric: tabular-nums; letter-spacing: 0.14em; color: #fff; font-size: 15px; font-weight: 700; }

.preview-caption { margin: -8px 4px 0; flex: 1; font-size: 15.5px; line-height: 1.55; color: #bdbdbd; }
.suggest { display: grid; gap: 8px; }
.suggest label { font-size: 13px; color: #a3a3a3; }
.suggest select {
  height: 42px; padding: 0 10px; border-radius: 10px; border: 0; color: #fff;
  background: rgb(255 255 255 / 0.07); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12);
}
.suggest select option { color: var(--ink); }
.btn.ghost-light { margin-top: 4px; color: #fff; background: var(--sunset); box-shadow: 0 12px 26px -14px rgb(224 30 90 / 0.9); }
.btn.ghost-light:hover { filter: brightness(1.08); transform: translateY(-1px); }

.form-side { padding: 30px 34px 26px; overflow-y: auto; display: flex; flex-direction: column; }
.form-side .product-field { margin-top: 10px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sheet-head h2 { margin: 0; font-size: 28px; font-weight: 900; letter-spacing: -0.02em; color: var(--ink); }
fieldset { border: 0; padding: 0; margin: 18px 0 0; display: grid; gap: 12px; }
legend { padding: 0; margin-bottom: 10px; font-size: 16px; font-weight: 800; color: var(--ink); display: flex; gap: 10px; align-items: baseline; }
.legend-note { font-size: 13px; font-weight: 600; color: var(--ember-text); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-side label, .small-sheet label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.form-side input, .form-side select, .small-sheet input, .small-sheet select {
  height: 44px; width: 100%; padding: 0 12px; border-radius: var(--r-control); border: 0; color: var(--ink); font-weight: 400;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}
.form-side select, .small-sheet select { font-weight: 600; cursor: pointer; }
.form-side input::placeholder, .small-sheet input::placeholder { color: #a3a3a3; }
.form-side input:focus-visible, .form-side select:focus-visible, .small-sheet input:focus-visible, .small-sheet select:focus-visible {
  outline: none; background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--blue), 0 0 0 3px rgb(59 99 251 / 0.2);
}
.form-side input[name="password"] { font-family: var(--mono); font-size: 14px; }
.with-action { position: relative; display: block; }
.with-action input { padding-right: 44px; }
.with-action.two input { padding-right: 80px; }
.mini {
  position: absolute; right: 7px; top: 7px; width: 30px; height: 30px; border: 0; border-radius: 8px; cursor: pointer;
  display: grid; place-items: center; color: #fff; background: var(--sunset);
}
.mini:hover { filter: brightness(1.08); }
/* The copy button sits quietly in every field and wakes up on hover or focus. */
.mini.copy { color: var(--muted); background: transparent; }
.mini.copy:hover, .mini.copy:focus-visible { color: var(--ink); background: var(--line-soft); filter: none; }
.with-action.two .mini:not(.copy) { right: 41px; }
.form-error { margin: 16px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-size: 14px; font-weight: 600; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: auto; padding-top: 24px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 10;
  display: flex; align-items: center; gap: 10px; padding: 11px 18px 11px 14px; border-radius: 14px;
  color: #fff; font-weight: 600; background: var(--night); box-shadow: 0 18px 40px -16px rgb(0 0 0 / 0.75);
  animation: toast-in 0.25s var(--ease);
}
.toast::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--sunset); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- Sections in the rail ---------- */
.sections { display: grid; gap: 2px; padding-bottom: 18px; border-bottom: 1px solid rgb(255 255 255 / 0.08); }
.section-link {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--r-control);
  color: #bdbdbd; text-decoration: none; font-weight: 600; font-size: 16px;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.section-link [data-icon] { width: 19px; height: 19px; color: #8a8a8a; transition: color 0.18s var(--ease); }
.section-link:hover { background: rgb(255 255 255 / 0.05); color: #fff; }
.section-link.on { background: rgb(255 255 255 / 0.09); color: #fff; }
.section-link.on [data-icon] { color: var(--ember); }
.section-link.on::before {
  content: ""; position: absolute; left: -8px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px;
  background: linear-gradient(180deg, var(--ember), var(--magenta), var(--purple));
}
.section-name { flex: 1; }
.section-count {
  min-width: 26px; padding: 1px 8px; border-radius: 999px; text-align: center; font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: #a3a3a3; background: rgb(255 255 255 / 0.07);
}
.section-link.on .section-count { color: #fff; background: rgb(255 255 255 / 0.16); }
.section-link .alert-count.hot { color: #fff; background: var(--bad); box-shadow: 0 0 0 3px rgb(201 37 45 / 0.25); }
.rail .products { padding-top: 2px; }

/* ---------- Alert banner ---------- */
.alert {
  display: flex; align-items: center; gap: 16px; margin: -16px 0 30px; padding: 14px 16px 14px 14px;
  border-radius: 16px; color: #e8e8e8; position: relative; overflow: hidden;
  background: radial-gradient(70% 140% at 0% 50%, rgb(201 37 45 / 0.35), transparent 60%), var(--night);
  box-shadow: var(--shadow-lift), inset 0 0 0 1px rgb(255 255 255 / 0.06);
  animation: rise 0.35s var(--ease);
}
.alert-icon {
  width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; color: #fff;
  background: var(--bad); box-shadow: 0 8px 20px -8px rgb(201 37 45 / 0.9);
}
.alert-icon [data-icon] { width: 20px; height: 20px; }
.alert-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.alert-text strong { color: #fff; font-size: 16.5px; }
.alert-text span { font-size: 14px; color: #bdbdbd; overflow: hidden; text-overflow: ellipsis; }
.alert-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.alert-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 16px; border: 0; border-radius: 10px;
  font-weight: 700; cursor: pointer; color: var(--ink); background: #fff;
}
.alert-btn:hover { background: #f0f0f0; }
.alert-btn.ghost { color: #fff; background: rgb(255 255 255 / 0.1); }
.alert-btn.ghost:hover { background: rgb(255 255 255 / 0.18); }

/* ---------- Header extras ---------- */
.tool-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.btn.outline { color: var(--ink); background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.btn.outline:hover { box-shadow: inset 0 0 0 1.5px var(--ink); transform: translateY(-1px); }
.btn.small { height: 34px; padding: 0 12px; border-radius: 9px; font-size: 14px; gap: 6px; }
.btn.small.primary { box-shadow: 0 8px 18px -12px rgb(0 0 0 / 0.9); }
.filter-pill {
  display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; padding: 1px 4px 1px 10px; border-radius: 999px;
  font-size: 14px; font-weight: 700; color: #fff; background: var(--ink); vertical-align: 1px;
}
.pill-x { width: 20px; height: 20px; border: 0; border-radius: 50%; background: rgb(255 255 255 / 0.16); color: #fff; cursor: pointer; line-height: 1; padding: 0; }
.pill-x:hover { background: var(--magenta); }

.filters { margin: -12px 0 22px; }
.segmented { display: inline-flex; padding: 4px; gap: 2px; border-radius: 12px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.segmented button {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.segmented button:hover { color: var(--ink); }
.segmented button.on { color: #fff; background: var(--ink); }
.seg-count { font-size: 12.5px; font-variant-numeric: tabular-nums; padding: 0 7px; border-radius: 999px; background: var(--line-soft); color: var(--muted); }
.segmented button.on .seg-count { background: rgb(255 255 255 / 0.18); color: #fff; }

/* ---------- Account state ---------- */
.acct-title p { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.acct-product { font-weight: 700; color: var(--text); }
.chip {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.chip.trial { color: var(--purple); background: #f4e8fa; }
.chip.ready { color: var(--good); background: #e3f5ee; }
.chip.sold { color: #fff; background: var(--ink); }
.chip.agent { color: #2b49c9; background: #e8edff; }
.chip.due { color: #fff; background: var(--bad); }
.acct.trial::before { background: linear-gradient(90deg, var(--purple), #b04bd6); }
.acct.is-due::before { background: var(--bad); height: 4px; }

.acct-foot { display: grid; gap: 10px; margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--line); }
.meter-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; }
.meter-left { color: var(--muted); }
.meter-left strong { color: var(--ink); font-size: 17px; font-weight: 800; }
.meter-date { color: var(--muted); font-size: 13.5px; }
.meter { position: relative; display: block; height: 8px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.meter-fill {
  position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, var(--purple), var(--magenta) 60%, var(--ember));
  transform-origin: left; transform: scaleX(var(--done, 0)); transition: transform 0.6s var(--ease);
}
.link-btn {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; border: 0; background: none;
  color: var(--ink); font-weight: 700; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line);
  text-underline-offset: 4px; text-decoration-thickness: 2px;
}
.link-btn:hover { text-decoration-color: var(--magenta); }
.link-btn [data-icon] { color: var(--magenta); }

.ready-foot { grid-template-columns: auto 1fr; align-items: center; gap: 12px; }
.ready-foot .link-btn, .ready-foot .holder { justify-self: end; }
.sold-tag { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.sold-tag button {
  height: 32px; padding: 0 13px; border: 0; border-radius: 8px; background: transparent; color: var(--muted);
  font-weight: 700; font-size: 14px; cursor: pointer; transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.sold-tag button:hover:not(:disabled):not(.on) { color: var(--ink); }
.sold-tag button:disabled { cursor: not-allowed; }
.sold-tag.is-open button.on { color: var(--good); background: var(--paper); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.sold-tag.is-sold button.on { color: #fff; background: var(--sunset); box-shadow: 0 6px 14px -8px rgb(224 30 90 / 0.9); }
.holder {
  display: grid; justify-items: end; gap: 1px; padding: 6px 10px; border: 0; border-radius: 10px; min-width: 0;
  background: transparent; cursor: pointer; text-align: right;
}
.holder:hover { background: var(--surface); }
.holder-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink); }
.holder-name [data-icon] { color: #2b49c9; }
.holder-date { font-size: 13px; color: var(--muted); }
.holder.due .holder-date { color: var(--bad); font-weight: 700; }

/* ---------- Agents ---------- */
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; align-content: start; }
.agent-card {
  display: flex; flex-direction: column; gap: 18px; padding: 22px; border-radius: var(--r-card);
  background: var(--paper); box-shadow: var(--shadow-card); transition: box-shadow 0.2s var(--ease);
}
.agent-card:hover { box-shadow: var(--shadow-lift); }
.agent-card.is-due { box-shadow: var(--shadow-card), inset 0 0 0 1.5px rgb(201 37 45 / 0.45); }
.agent-head { display: flex; align-items: center; gap: 14px; }
.agent-mark {
  width: 50px; height: 50px; flex: none; border-radius: 15px; display: grid; place-items: center;
  font-size: 18px; font-weight: 900; color: #fff;
  background: radial-gradient(120% 120% at 100% 0%, rgb(255 90 31 / 0.7), transparent 55%), var(--night);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.1), 0 10px 22px -12px rgb(0 0 0 / 0.8);
}
.agent-title { flex: 1; min-width: 0; }
.agent-title h3 { margin: 0; }
.agent-open {
  padding: 0; border: 0; background: none; cursor: pointer; font-size: 20px; font-weight: 800; letter-spacing: -0.01em;
  color: var(--ink); text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.agent-open:hover { text-decoration: underline; text-decoration-color: var(--magenta); text-underline-offset: 4px; }
.agent-title p { margin: 1px 0 0; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-stats { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border-radius: 12px; overflow: hidden; background: var(--line-soft); }
.stat { padding: 10px 12px; background: var(--surface); min-width: 0; }
.stat dt { font-size: 12.5px; color: var(--muted); }
.stat dd { margin: 2px 0 0; font-size: 18px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat.due dd { color: var(--bad); }
.agent-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.back-link {
  display: inline-flex; align-items: center; gap: 6px; margin: -14px 0 18px; padding: 4px 0; border: 0; background: none;
  color: var(--muted); font-weight: 700; cursor: pointer;
}
.back-link:hover { color: var(--ink); }
.detail-stats {
  margin: 0 0 22px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; border-radius: 16px; overflow: hidden;
  background: var(--line-soft); box-shadow: var(--shadow-card);
}
.detail-stats .stat { background: var(--paper); padding: 16px 18px; }
.detail-stats .stat dd { font-size: 20px; }
.inline-empty { padding: 40px; border-radius: var(--r-card); background: var(--paper); text-align: center; box-shadow: var(--shadow-card); }
.inline-empty p { margin: 0 auto 18px; max-width: 420px; color: var(--muted); }

/* ---------- Rows (agent accounts, renewals) ---------- */
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.row {
  position: relative; display: grid; align-items: center; gap: 16px; padding: 14px 16px 14px 18px; border-radius: 14px;
  grid-template-columns: 110px minmax(200px, 1.6fr) minmax(120px, 1fr) minmax(130px, 1fr) auto;
  background: var(--paper); box-shadow: var(--shadow-card);
}
.row.is-due::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--bad); }
.row-product {
  justify-self: start; max-width: 100%; padding: 3px 10px; border-radius: 8px; font-size: 13px; font-weight: 800;
  color: #fff; background: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-login { display: grid; gap: 2px; min-width: 0; }
.row-email, .row-secret { display: flex; align-items: center; gap: 4px; min-width: 0; }
.row-email > span:first-child { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-secret .secret { font-family: var(--mono); font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-secret .secret.masked { letter-spacing: 0.18em; color: var(--muted); }
.row .icon-btn { width: 26px; height: 26px; flex: none; }
.row-agent {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 0; border-radius: 9px;
  background: #eef1ff; color: #2b49c9; font-weight: 700; cursor: pointer; max-width: 100%;
}
.row-agent:hover { background: #e0e6ff; }
.row-given { font-size: 14px; color: var(--muted); }
.when { display: grid; gap: 0; }
.when strong { font-size: 14.5px; color: var(--ink); }
.when small { font-size: 13px; color: var(--muted); }
.when.due strong { color: var(--bad); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.renewals { display: grid; gap: 34px; }
.renew-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.renew-head h2 { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: -0.015em; color: var(--ink); }
.renew-head p { margin: 1px 0 0; color: var(--muted); font-size: 14.5px; }
.renew-icon { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; color: var(--muted); background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.renew-icon [data-icon] { width: 20px; height: 20px; }
.renew-group.due .renew-icon { color: #fff; background: var(--bad); box-shadow: 0 8px 20px -10px rgb(201 37 45 / 0.9); }

/* ---------- Compact dialogs (agent, give accounts) ---------- */
dialog.compact { width: min(520px, calc(100vw - 32px)); }
.small-sheet { display: flex; flex-direction: column; gap: 14px; padding: 28px 30px 24px; max-height: calc(100vh - 32px); overflow-y: auto; }
.small-sheet::before { content: ""; display: block; height: 4px; margin: -28px -30px 10px; background: var(--sunset-flat); }
.small-sheet .sheet-head { margin-bottom: 0; }
.small-sheet .sheet-head h2 { font-size: 25px; }
.sheet-lead { margin: -6px 0 4px; color: var(--muted); font-size: 15px; }
.hint { font-size: 12.5px; font-weight: 600; color: var(--good); }
.give-summary { margin: 0; padding: 12px 14px; border-radius: 12px; font-size: 14.5px; font-weight: 600; color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-soft); }
.give-summary:empty { display: none; }
.small-sheet .form-error { margin: 0; }
.small-sheet .sheet-actions { padding-top: 6px; }

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: relative; height: auto; }
  .products { max-height: 220px; }
  .stage { padding: 28px 18px; }
  .sheet { grid-template-columns: minmax(0, 1fr); }
  .preview-side { padding: 22px; }
  .preview-caption { flex: none; }
  .id-card { max-width: 360px; }
  .sections { grid-template-columns: 1fr 1fr; }
  .detail-stats { grid-template-columns: 1fr 1fr; }
  .alert { flex-wrap: wrap; margin-top: 0; }
}
@media (max-width: 1180px) {
  .row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "product when" "login login" "agent actions"; row-gap: 10px; }
  .row-product { grid-area: product; }
  .when { grid-area: when; text-align: right; }
  .row-login { grid-area: login; }
  .row-agent, .row-given { grid-area: agent; }
  .row-actions { grid-area: actions; }
}
@media (max-width: 520px) {
  .pair, .card-strip { grid-template-columns: minmax(0, 1fr); }
  .accounts, .agents-grid { grid-template-columns: minmax(0, 1fr); }
  .ready-foot { grid-template-columns: minmax(0, 1fr); }
  .ready-foot .link-btn, .ready-foot .holder { justify-self: start; }
  .row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "product" "login" "when" "agent" "actions"; }
  .when { text-align: left; }
  .row-actions { justify-content: flex-start; }
  .search { width: 100%; }
  .tools { width: 100%; }
}

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