/* TTF developer pages: the components of the developer landing, sign-in, dashboard and admin pages in the STUDIO theme
   (tokens in shared/studio.css, loaded first; docs/dapps.md "Developer portal theme (studio)"). No Hub stylesheet is loaded on
   these pages, so this file also styles the classes the Hub's builders (dapps/shared/term.js: .t-pnl, .t-ph, .t-tabs, .t-seg,
   .t-kpis, .t-tag ...) and DEV (shared/dev.js: .btn, .t-btn, .input, .banner, .toast, .modal ...) put in the markup. Class
   names stay as the scripts write them; only the look is this file's.
   Rules of the look: cards radius --r-card, controls --r-ctl, pills only for status tags and the period switch, soft shadows,
   one accent, mono only for code / keys / addresses / ids, 44 px touch targets on touch screens. No inline styles anywhere:
   sizes set from script go through the CSSOM (--w of the meters). */

/* ---------------------------------------------------------------------------------------------------------- helpers */
.sr,
.d-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.d-offscreen { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .9em; letter-spacing: 0; }
.mut { color: var(--muted); }
.up { color: var(--pass); }
.down { color: var(--fail); }
.wn { color: var(--warn); }
.lbl { font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--text-2); }
.h2 { font-size: 17px; font-weight: 650; line-height: 1.3; letter-spacing: -.01em; }
.d-auth-pending [data-auth] { visibility: hidden; }

/* ----------------------------------------------------------------------------------------------------------- layout */
.shell { width: 100%; max-width: var(--s-max); margin: 0 auto; padding: 0 var(--s-gutter); }
#app.t-page { padding-top: 24px; padding-bottom: 40px; }
#app.t-page > * + * { margin-top: 20px; }
#app.t-page > :empty { display: none; }
.d-tab { margin-top: 20px; }
.d-tab > * + * { margin-top: 20px; }
.d-narrow { max-width: 480px; margin: 0 auto; }
.d-narrow > * + * { margin-top: 16px; }
.d-body { padding: 18px 20px; }
.d-body > * + * { margin-top: 14px; }
.d-sec + .d-sec { margin-top: 14px; }
.d-rows > * + * { margin-top: 10px; }
.d-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.t-two { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }

/* ---------------------------------------------------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(12px); backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .shell { display: flex; align-items: center; gap: 10px; min-height: var(--s-top); }
.brand { display: inline-flex; align-items: center; gap: 10px; flex: none; color: var(--text); font-size: 14px; font-weight: 700; letter-spacing: .03em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { display: block; width: 28px; height: 28px; border-radius: 8px; flex: none; box-shadow: var(--shadow-1); }
.crumb { display: inline-flex; align-items: center; min-width: 0; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb::before { content: ""; flex: none; width: 1px; height: 18px; margin: 0 12px 0 2px; background: var(--line-strong); }
.crumb b { font-weight: 600; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.topbar .d-sp { flex: 1 1 auto; }
.topbar .crumb { flex: 1 1 0; }                  /* takes the free space (and ellipsizes): the buttons sit on the right */
.topbar .d-who { flex: 0 1 auto; min-width: 0; max-width: 34vw; padding: 4px 10px 4px 8px; display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-pill); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .d-who:empty { display: none; }
.topbar .d-who::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--pass); }
.topbar .t-btn { flex: none; }
/* theme button: a small half-filled disc before the word (CSS only) */
#theme-btn { gap: 7px; }
#theme-btn::before { content: ""; flex: none; width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
/* the Size control of large screens (dev.js initSize; shown above 1600 px of viewport only) */
.size-btn { display: none; }
@media (min-width: 1601px) {
  .size-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; flex: none; padding: 0 6px 0 12px; border: 1px solid var(--line-strong);
    border-radius: var(--r-ctl); background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
  .size-btn:hover { color: var(--text); border-color: var(--muted); }
  .size-btn:focus-within { box-shadow: var(--ring); border-color: var(--accent); }
}
.size-sel { border: 0; background: transparent; color: var(--text); font-size: 13px; font-weight: 600; padding: 4px 2px; cursor: pointer; }
.size-sel:focus-visible { box-shadow: none; }

/* ----------------------------------------------------------------------------------------------------------- page head */
.d-head { padding: 4px 0 0; }
.d-head h1 { font-size: 26px; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 6px; }
.d-head p { color: var(--muted); font-size: 15px; max-width: 72ch; }
.d-head p.mono { font-size: 12.5px; }
.d-kicker { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; padding: 3px 10px; font-size: 12.5px; font-weight: 600; line-height: 1.4;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--r-pill); }
.d-headlinks { margin-top: 14px; }
.d-lead { color: var(--text-2); font-size: 15px; }

/* ----------------------------------------------------------------------------------------------------------- buttons */
.btn,
.t-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: none;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: var(--r-ctl);
  font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap; cursor: pointer; user-select: none;
  box-shadow: var(--shadow-1); transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn { min-height: 40px; padding: 8px 16px; font-size: 14.5px; }
.t-btn { min-height: 34px; padding: 6px 12px; font-size: 13.5px; }
.btn:hover,
.t-btn:hover { background: var(--surface-3); border-color: var(--muted); text-decoration: none; }
.btn:active,
.t-btn:active { transform: translateY(1px); }
.btn.primary,
.t-btn.acc { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover,
.t-btn.acc:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger,
.t-btn.danger { color: var(--fail); border-color: var(--fail-line); background: var(--surface); }
.btn.danger:hover,
.t-btn.danger:hover { background: var(--fail-soft); border-color: var(--fail); }
.btn.danger:focus-visible,
.t-btn.danger:focus-visible { box-shadow: var(--ring-danger); }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 13.5px; }
.btn.wide { width: 100%; }
.t-btn.id { font-family: var(--mono); font-weight: 500; font-size: 12.5px; }
.btn[disabled],
.t-btn[disabled],
.btn[aria-busy="true"],
.t-btn[aria-busy="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn[aria-busy="true"],
.t-btn[aria-busy="true"] { cursor: progress; }
.d-link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.d-link:hover { color: var(--accent-hover); }
.d-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.d-actions .grow { flex: 1 1 auto; }

/* ------------------------------------------------------------------------------------------------------------- forms */
.d-field { display: grid; gap: 6px; min-width: 0; }
.input,
.select,
.d-field textarea {
  min-height: 42px; width: 100%; padding: 9px 12px; background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r-ctl); font-size: 15px; line-height: 1.35;
  transition: border-color .15s, box-shadow .15s;
}
.select { width: auto; max-width: 100%; padding-right: 30px; cursor: pointer; }
.d-field .select { width: 100%; }
.input::placeholder,
.d-field textarea::placeholder { color: var(--muted); opacity: .85; }
.input:hover,
.select:hover,
.d-field textarea:hover { border-color: var(--muted); }
.input:focus,
.select:focus,
.d-field textarea:focus { border-color: var(--accent); box-shadow: var(--ring); outline: 0; }
.d-field textarea { min-height: 110px; font: 400 13.5px/1.5 var(--mono); resize: vertical; }
.input.code { font: 600 20px/1.2 var(--mono); letter-spacing: .35em; text-align: center; padding-left: calc(12px + .35em); }
.d-hint { font-size: 13px; line-height: 1.45; color: var(--muted); }
.d-check { display: flex; align-items: center; gap: 10px; font-size: 14.5px; color: var(--text); cursor: pointer; }
.d-check input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--accent); cursor: pointer; }
.d-inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.d-inline .d-field { flex: 1 1 200px; min-width: 0; }
.d-or { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 500; color: var(--muted); }
.d-or::before,
.d-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.d-fs { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 8px; }
.d-fs legend { padding: 0; margin-bottom: 8px; }
.d-choice { display: grid; gap: 8px; }
.d-choice label { display: flex; gap: 10px; align-items: center; padding: 10px 12px; font-size: 14.5px; border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--surface); cursor: pointer; transition: border-color .15s, background-color .15s; }
.d-choice label:hover { border-color: var(--line-strong); background: var(--surface-2); }
.d-choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.d-choice input { accent-color: var(--accent); margin: 0; width: 17px; height: 17px; flex: none; }
/* Telegram sign-in (shared/tg.js): the button and the waiting state (the person types the code the bot sent) */
.d-tg > * + *,
.d-tgblock > * + * { margin-top: 12px; }

/* details / summary: "Options", "For developers", the add forms */
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 10px 2px 2px; border: solid var(--muted); border-width: 0 2px 2px 0;
  transform: rotate(-45deg); transition: transform .15s; vertical-align: middle; }
details[open] > summary::before { transform: rotate(45deg); margin-bottom: 4px; }
details > summary:hover { color: var(--text); }
details > summary:hover::before { border-color: var(--text); }
.d-sum { display: block; padding: 12px 20px; border-top: 1px solid var(--line); border-radius: 0; }
.d-sum:focus-visible { box-shadow: inset var(--ring); }
.d-body details > summary.lbl { display: inline-block; padding: 4px 0; border-radius: var(--r-ctl); }
.d-body > .d-adv > .d-sum,
.d-rows > .d-adv > .d-sum { padding: 6px 0; border-top: 0; }
.d-body > .d-adv > .d-body,
.d-rows > .d-adv > .d-body { padding: 10px 0 0; }

/* -------------------------------------------------------------------------------------------------- messages, callouts */
.d-msg:empty { display: none; }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 14px 12px 44px; position: relative; border-radius: 10px;
  border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--text); font-size: 14.5px; line-height: 1.5; }
.banner::before { content: "i"; position: absolute; left: 14px; top: 13px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font: 700 12px/1 var(--font); background: var(--accent); color: var(--on-accent); }
.banner > span { flex: 1 1 240px; min-width: 0; }
.banner.ok { border-color: var(--pass-line); background: var(--pass-soft); }
.banner.ok::before { content: "\2713"; background: var(--pass); color: var(--surface); }
.banner.warn { border-color: var(--warn-line); background: var(--warn-soft); }
.banner.warn::before { content: "!"; background: var(--warn); color: var(--surface); }
.banner.error { border-color: var(--fail-line); background: var(--fail-soft); }
.banner.error::before { content: "!"; background: var(--fail); color: var(--surface); }
.banner .t-btn,
.banner .btn { margin-left: auto; }
.d-banner { margin: 0; }
.t-pnl > .banner,
.t-pnl > .d-msg > .banner { margin: 14px 20px; }
.d-confirm { border: 1px solid var(--accent-line); border-radius: 10px; padding: 16px; background: var(--accent-soft); }
.d-confirm dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0 0; }
.d-confirm dt { font-size: 13px; font-weight: 500; color: var(--muted); }
.d-confirm dd { margin: 0; font-size: 14.5px; font-weight: 500; overflow-wrap: anywhere; }
.d-say { margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--r-ctl);
  background: var(--surface-2); font-size: 14.5px; line-height: 1.55; color: var(--text); overflow-wrap: anywhere; }
.d-note { margin: 0; padding: 12px 20px 16px; font-size: 13px; color: var(--muted); }
.d-empty { margin: 14px 20px; padding: 22px 16px; text-align: center; font-size: 14px; color: var(--muted); background: var(--surface-2);
  border: 1px dashed var(--line-strong); border-radius: 10px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translateX(-50%); z-index: 70; max-width: calc(100vw - 32px);
  padding: 11px 18px; border-radius: 10px; background: var(--toast-bg); color: var(--toast-text); font-size: 14px; font-weight: 600; box-shadow: var(--shadow-3);
  animation: d-toast-in .18s ease-out; }
@keyframes d-toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* code, keys, secrets, payment details */
.d-pre { margin: 0; padding: 10px 12px; max-width: 460px; max-height: 180px; overflow: auto; background: var(--code-bg); border: 1px solid var(--line);
  border-radius: var(--r-ctl); font: 400 12.5px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.d-url { margin: 0; overflow-wrap: anywhere; word-break: break-all; }
.d-secret { border: 1px solid var(--accent-line); border-radius: var(--r-card); background: var(--accent-soft); padding: 18px 20px; box-shadow: var(--shadow-1); }
.d-secret > * + * { margin-top: 12px; }
.d-secret .warn { margin: 0; font-size: 15px; font-weight: 650; color: var(--text); }
.d-secret .mut { margin: 0; }
.d-secret .lbl { margin-bottom: 6px; }
.d-secret code,
.d-pay code { display: block; padding: 11px 14px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-ctl);
  font: 500 13.5px/1.5 var(--mono); color: var(--text); overflow-wrap: anywhere; word-break: break-all; user-select: all; }
.d-secret .d-actions { margin-top: 10px; }
.d-secret .d-adv > .d-sum { padding: 2px 0; border-top: 0; }
.d-pay { border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px 20px; display: grid; gap: 12px; background: var(--surface-2); }
.d-pay .d-big { font: 700 22px/1.25 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.d-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.d-count.over { color: var(--fail); font-weight: 600; }

/* ------------------------------------------------------------------------------------------------------ panels (cards) */
.t-pnl { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-1); min-width: 0; overflow: hidden; }
.t-pnl + .t-pnl { margin-top: 20px; }
.t-ph { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 56px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.t-ph h2 { font-size: 16px; font-weight: 650; line-height: 1.3; letter-spacing: -.005em; margin: 0; }
.t-ph .meta { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.t-ph .t-btn { margin-left: 0; }
.t-ph .meta + .t-btn { margin-left: 4px; }
.t-ph h2 + .t-btn { margin-left: auto; }
.t-ph a { color: inherit; }
.t-pnl > .d-more,
.d-more { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.t-pnl > .d-actions { padding: 14px 20px; }
.d-wiz { border-color: var(--accent-line); box-shadow: var(--shadow-2); }
.d-wiz > .t-ph { background: linear-gradient(180deg, var(--accent-soft), transparent); }

/* stat cards (.t-kpis > div: .lbl, .v, .d) */
.t-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.t-kpis > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-1); padding: 16px 18px; min-width: 0; }
.t-kpis .lbl { font-size: 13px; font-weight: 500; color: var(--muted); }
.t-kpis .v { margin-top: 6px; font-size: 24px; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-kpis .v.sm { font-size: 16px; }
.t-kpis .d { margin-top: 4px; font-size: 13px; color: var(--muted); }
.t-kpis .d.wn { color: var(--warn); font-weight: 600; }
.t-kpis .d.down { color: var(--fail); font-weight: 600; }
.t-kpis .d.up { color: var(--pass); }

/* key / value list */
.d-kv { display: grid; grid-template-columns: max-content 1fr; margin: 0; }
.d-kv > dt,
.d-kv > dd { padding: 11px 20px; border-bottom: 1px solid var(--line); margin: 0; min-width: 0; }
.d-kv > dt { font-size: 14px; color: var(--muted); }
.d-kv > dd { font-size: 14.5px; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.d-kv > dt:nth-last-of-type(1),
.d-kv > dd:last-child { border-bottom: 0; }

/* status tags (T.tag kind: ok | bad | wn | n) */
.t-tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 600; line-height: 1.5;
  white-space: nowrap; border: 1px solid transparent; }
.t-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.t-tag.ok { color: var(--pass); background: var(--pass-soft); border-color: var(--pass-line); }
.t-tag.bad { color: var(--fail); background: var(--fail-soft); border-color: var(--fail-line); }
.t-tag.wn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-line); }
.t-tag.n { color: var(--text-2); background: var(--surface-3); border-color: var(--line); }
.t-tag.n::before { background: var(--muted); }
.t-ch { display: inline-block; padding: 1px 6px; border-radius: 6px; font: 600 11.5px/1.5 var(--mono); color: var(--text-2); background: var(--surface-3); }
.t-sq { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.t-sq.ok { background: var(--pass); }
.t-sq.wn { background: var(--warn); }
.t-sq.bad { background: var(--fail); }

/* ---------------------------------------------------------------------------------------------------- tabs, segments */
.t-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 4px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow-1); }
.t-tabs::-webkit-scrollbar { display: none; }
.t-tabs button { flex: none; min-height: 38px; padding: 8px 14px; border: 0; border-radius: var(--r-ctl); background: none; color: var(--muted);
  font-size: 14.5px; font-weight: 550; white-space: nowrap; transition: background-color .15s, color .15s; }
.t-tabs button:hover { color: var(--text); background: var(--surface-3); }
.t-tabs button[aria-selected="true"] { color: var(--accent); background: var(--accent-soft); font-weight: 650; }
.t-tabs button:focus-visible { box-shadow: inset var(--ring); }
/* the sign-in page's two tabs: one segmented control the width of the column */
.d-narrow .t-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg-alt); box-shadow: none; }
.d-narrow .t-tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.t-pnl > .t-tabs { margin: 16px 20px 0; border-color: transparent; }
/* a panel's message row that holds nothing yet takes no space */
.t-pnl > .d-body:has(> .d-msg:only-child:empty) { display: none; }
.t-seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--r-pill); }
.t-seg button { min-height: 30px; padding: 4px 12px; border: 0; border-radius: var(--r-pill); background: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.t-seg button:hover { color: var(--text); }
.t-seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* dashboard: the whole window (owner 2026-11-28, "not using my full window width"): the 1280 px column of the landing and
   sign-in pages left a dead strip each side of the sidebar + content; a cap only far beyond normal screens (above 1600 px of
   viewport shared/skin.js zooms, 2560 px lays out at ~2275). The admin page does the same in admin/admin.css (.adm-shell). */
[data-page="dev-app"] .shell { max-width: 2400px; }

/* dashboard / admin: tabs as a left sidebar on desktop, a sticky scroller under the top bar on phones and tablets */
[data-page="dev-app"] #view > .t-tabs,
[data-page="dev-admin"] #view > .t-tabs { position: sticky; top: calc(var(--s-top) + 8px); z-index: 10; margin-top: 20px; }
@media (min-width: 1000px) {
  [data-page="dev-app"] #view,
  [data-page="dev-admin"] #view { display: grid; grid-template-columns: 216px minmax(0, 1fr); column-gap: 28px; align-items: start; }
  [data-page="dev-app"] #view > *,
  [data-page="dev-admin"] #view > * { grid-column: 1 / -1; }
  [data-page="dev-app"] #view > .t-tabs,
  [data-page="dev-admin"] #view > .t-tabs { grid-column: 1; flex-direction: column; gap: 2px; padding: 6px; top: calc(var(--s-top) + 20px); }
  [data-page="dev-app"] #view > .t-tabs button,
  [data-page="dev-admin"] #view > .t-tabs button { width: 100%; text-align: left; min-height: 40px; padding: 9px 12px; }
  [data-page="dev-app"] #view > .d-tab,
  [data-page="dev-admin"] #view > .d-tab { grid-column: 2; margin-top: 20px; }
  [data-page="dev-app"] #view > .d-secret,
  [data-page="dev-admin"] #view > .d-secret { grid-column: 2; }
}

/* ------------------------------------------------------------------------------------------------------------- tables */
.t-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.t-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.t-tbl th { text-align: left; padding: 10px 16px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line);
  white-space: nowrap; }
.t-tbl td { padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.t-tbl tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.t-tbl tbody tr:hover td { background: var(--surface-3); }
.t-tbl tr:last-child td { border-bottom: 0; }
.t-tbl th:first-child,
.t-tbl td:first-child { padding-left: 20px; }
.t-tbl th:last-child,
.t-tbl td:last-child { padding-right: 20px; }
.t-tbl th.r,
.t-tbl td.r { text-align: right; }
.t-tbl td.num { font-variant-numeric: tabular-nums; }
.t-tbl td.wrap { white-space: normal; overflow-wrap: anywhere; min-width: 180px; }
.t-tbl a { color: var(--accent); }
.t-tbl td .t-btn { min-height: 30px; padding: 4px 10px; font-size: 13px; box-shadow: none; }
.t-tbl td .t-btn + .t-btn { margin-left: 6px; }
.t-tbl tr.sel td { background: var(--accent-soft); }
.t-tbl tr.click { cursor: pointer; }
.d-cell-acts { display: inline-flex; gap: 6px; white-space: nowrap; }
.t-tbl td .d-cell-acts .t-btn + .t-btn { margin-left: 0; }

/* ------------------------------------------------------------------------------------------------------------- chart */
.d-chart { padding: 18px 20px; }
.d-chart-cv { display: block; width: 100%; height: 180px; }
.d-chart-tip { min-height: 20px; margin-top: 8px; font-size: 13px; color: var(--text-2); }
.d-chart-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.d-chart-bar .meta { margin-left: auto; font-size: 13px; color: var(--muted); }

/* -------------------------------------------------------------------------------------------------------------- modal */
.scrim { position: fixed; inset: 0; z-index: 50; background: var(--scrim); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: d-fade .15s ease-out; }
.modal { position: fixed; z-index: 51; left: 50%; top: 50%; transform: translate(-50%, -50%); max-height: 90vh; overflow: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-3); padding: 20px; animation: d-fade .15s ease-out; }
.d-modal { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; width: min(calc(100vw - 24px), 500px); }
.d-modal .d-actions > .t-btn,
.d-modal .d-actions > .btn { max-width: 100%; white-space: normal; }          /* a long label wraps, the sheet never scrolls sideways */
.d-modal-h { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.d-modal > * + * { margin-top: 0; }
.d-modal .d-body { padding: 0; }
.d-modal p { color: var(--text-2); }
@keyframes d-fade { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------------------------------------------- meters, plan limits */
.d-meter { height: 8px; margin-top: 8px; border-radius: var(--r-pill); background: var(--bg-alt); overflow: hidden; }
.d-meter > i { display: block; height: 100%; width: var(--w, 0%); border-radius: var(--r-pill); background: var(--accent); transition: width .3s ease; }
.d-meter.near > i { background: var(--warn); }
.d-meter.over > i { background: var(--fail); }
.d-limits { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1px; background: var(--line); }
.d-limit { background: var(--surface); padding: 16px 20px; min-width: 0; }
.d-limit-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.d-limit-h .lbl { font-weight: 500; color: var(--muted); }
.d-limit-h .num { font-size: 14.5px; font-weight: 650; white-space: nowrap; }
.d-limit .d-meter { margin-top: 10px; }
.d-limit .d-hint { display: block; margin-top: 8px; font-size: 12.5px; }
.d-limit.near .d-hint { color: var(--warn); }
.d-limit.over .d-hint { color: var(--fail); }

/* --------------------------------------------------------------------------------------------- guided alerts (hooks.js) */
.d-presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.t-pnl > .d-presets { padding: 18px 20px; }
.d-preset { background: var(--surface); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; border: 1px solid var(--line);
  border-radius: var(--r-card); transition: border-color .15s, box-shadow .15s, transform .15s; }
.d-preset:hover { border-color: var(--accent-line); box-shadow: var(--shadow-2); }
.d-preset h3 { font-size: 15.5px; font-weight: 650; line-height: 1.35; margin: 0; }
.d-preset p { margin: 0; font-size: 14px; color: var(--text-2); }
.d-preset > p:first-of-type { flex: 1 1 auto; }
.d-preset .btn,
.d-preset .t-btn { align-self: flex-start; }
.d-preset.locked { background: var(--surface-2); }
.d-preset.locked:hover { border-color: var(--line); box-shadow: none; }
.d-preset.locked h3,
.d-preset.locked p { color: var(--muted); }
.d-stepper { display: flex; gap: 6px; margin: 0; padding: 14px 20px; list-style: none; border-bottom: 1px solid var(--line); counter-reset: none; }
.d-stepper li { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); position: relative; }
.d-stepper li + li::before { content: ""; flex: 0 1 28px; min-width: 8px; height: 2px; border-radius: 2px; background: var(--line-strong); }
.d-stepper li b { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-strong);
  background: var(--surface); font-size: 13px; font-weight: 700; color: var(--muted); }
.d-stepper li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-stepper li.on { color: var(--text); font-weight: 600; }
.d-stepper li.on b { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.d-stepper li.done { color: var(--text-2); }
.d-stepper li.done b { border-color: var(--pass); background: var(--pass-soft); color: var(--pass); }
.d-stepper li.done + li::before { background: var(--pass); }
.d-cards > * + * { border-top: 1px solid var(--line); }
.d-rule { padding: 16px 20px; display: grid; gap: 10px; min-width: 0; }
.d-rule.off .d-say { border-left-color: var(--line-strong); color: var(--text-2); }
.d-rule-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.d-rule-h b { font-size: 15px; font-weight: 650; }

/* ------------------------------------------------------------------------------- chat destinations (app/chat.js) */
/* the three ways to get alerts, and the choices of a wizard step */
.d-picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.d-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; padding: 14px 16px; text-align: left; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-card); cursor: pointer; transition: border-color .15s, background-color .15s, box-shadow .15s; }
.d-pick b { font-size: 15.5px; font-weight: 650; line-height: 1.35; }
.d-pick span { font-size: 13.5px; line-height: 1.45; color: var(--text-2); }
.d-pick:hover { border-color: var(--accent); box-shadow: var(--shadow-2); }
.d-pick[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.d-pick[disabled] { opacity: .6; cursor: not-allowed; box-shadow: none; border-color: var(--line); }
.d-quick { display: grid; gap: 8px; padding: 14px 16px; border: 1px solid var(--accent-line); border-radius: 10px; background: var(--accent-soft); }
.d-quick h3 { margin: 0; font-size: 15.5px; font-weight: 650; }
.d-quick p { margin: 0; font-size: 14px; color: var(--text-2); }

/* a destination row */
.d-dest .t-ph h2 { flex: 0 1 auto; min-width: 0; overflow-wrap: anywhere; }
.d-dest-ic { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-size: 13px; font-weight: 700;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); }
.d-where { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.d-dest-fix { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 14px; border: 1px solid var(--warn-line); border-radius: 10px;
  background: var(--warn-soft); }
.d-dest-fix p { flex: 1 1 220px; min-width: 0; margin: 0; font-size: 14.5px; }
.d-dest-why { margin: 0; font-size: 14px; color: var(--text-2); }
.d-body > .d-dest-why { margin-top: 10px; }
.d-settings { border-top: 1px solid var(--line); }
.d-dest .d-adv > .d-more { border-top: 0; }
.d-log { margin: 0; padding: 0; list-style: none; }
.d-log li { display: grid; gap: 2px; padding: 10px 20px; border-top: 1px solid var(--line); font-size: 14px; overflow-wrap: anywhere; }

/* the wizards */
.d-wiz .d-wiz { border-color: var(--line); box-shadow: none; }
.d-step-h { margin: 0; font-size: 17px; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.d-step-h:focus { outline: 0; box-shadow: none; }
.d-live { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface-2); font-size: 14.5px; font-weight: 600;
  overflow-wrap: anywhere; }
.d-live:empty { margin: 0; padding: 0; border: 0; }
.d-clock { font-variant-numeric: tabular-nums; }
.d-wiz .d-body > * + .d-say,
.d-wiz .d-rows > * + .d-say { margin-top: 14px; }
.d-fs { min-width: 0; margin: 0; padding: 0; border: 0; }
.d-body > * + .d-fs,
.d-rows > * + .d-fs { margin-top: 18px; }
.d-fs > legend { padding: 0 0 8px; }
.d-fs > .d-hint { margin-top: 8px; }
.d-opt { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.d-opt p { margin: 0; font-size: 14px; color: var(--text-2); }
.d-code { max-width: 100%; margin: 0; padding: 10px 12px; background: var(--code-bg); border: 1px solid var(--line-strong); border-radius: var(--r-ctl);
  font: 400 13.5px/1.55 var(--mono); color: var(--text); overflow-wrap: anywhere; }
code.d-code { display: block; user-select: all; }
.d-guilds { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.d-rows > .d-guilds { margin-top: 8px; }
.d-guild { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.d-guild-n { flex: 1 1 140px; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.d-channels { display: grid; gap: 6px; max-height: 340px; overflow-y: auto; padding: 2px; }
.d-channels h4 { margin: 8px 0 0; }
.d-row-pick { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; width: 100%; padding: 10px 12px; text-align: left; font: inherit; font-size: 14.5px;
  color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); cursor: pointer; overflow-wrap: anywhere; }
.d-row-pick:hover { border-color: var(--muted); }
.d-row-pick[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.d-why { display: grid; gap: 6px; margin: 0; padding-left: 20px; font-size: 14px; color: var(--text-2); }
.d-why:empty { display: none; }
.d-bad { color: var(--fail); }

/* chips: alert types, looks, examples */
.d-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.d-chips:empty { display: none; }
.d-chips > .d-check { padding: 6px 14px 6px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); }
.d-chips > .d-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.d-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 5px 14px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-pill); cursor: pointer; }
.d-chip:hover { border-color: var(--muted); color: var(--text); }
.d-chip[aria-pressed="true"],
.d-chip[aria-selected="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.d-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* the message designer: editor, then preview (side by side from 900 px) */
.d-designer { overflow: visible; }
.d-designer .t-ph .meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.d-design { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 0 20px 20px; }
.d-edit,
.d-side { min-width: 0; }
.d-edit > * + *,
.d-side > * + * { margin-top: 12px; }
.d-text { display: block; width: 100%; min-height: 220px; resize: vertical; }
.d-text:focus { border-color: var(--accent); box-shadow: var(--ring); outline: 0; }
.d-text[readonly] { color: var(--text-2); background: var(--surface-2); border-color: var(--line); }
.d-sizes { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.d-sizes + .d-meter { margin-top: 6px; }
.d-invalid { display: grid; gap: 10px; margin: 0; padding: 12px 14px; list-style: none; font-size: 14px; border: 1px solid var(--fail-line); border-radius: 10px;
  background: var(--fail-soft); overflow-wrap: anywhere; }
.d-invalid li { display: grid; gap: 4px; justify-items: start; }
.d-dcnote { display: grid; gap: 8px; justify-items: start; padding: 10px 12px; border: 1px solid var(--warn-line); border-radius: 10px; background: var(--warn-soft); }
.d-dcnote p { margin: 0; }

/* the preview: a Telegram bubble or a Discord message */
.d-prev { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.d-prev .d-empty { margin: 0; border: 0; }
.d-tgview { padding: 14px; background: var(--tg-bg); color: var(--tg-text); }
.d-bubble { padding: 8px 12px 10px; background: var(--tg-bubble); color: var(--tg-text); border-radius: 12px 12px 12px 4px; box-shadow: var(--shadow-1); }
.d-from { display: block; margin-bottom: 2px; font-size: 13.5px; color: var(--tg-link); }
.d-msgtext { font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.d-msgtext code,
.d-msgtext pre { font-family: var(--mono); font-size: .9em; background: color-mix(in srgb, currentColor 10%, transparent); border-radius: 4px; }
.d-msgtext code { padding: 0 3px; }
.d-msgtext pre { margin: 4px 0; padding: 6px 8px; white-space: pre-wrap; }
.d-plink { color: var(--tg-link); text-decoration: none; cursor: default; }
.d-plink:hover { text-decoration: underline; }
.d-kb { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.d-kb span { flex: 1 1 110px; padding: 7px 10px; text-align: center; font-size: 13.5px; font-weight: 600; border-radius: var(--r-ctl);
  background: color-mix(in srgb, currentColor 12%, transparent); }
.d-dc { padding: 14px; background: var(--dc-bg); color: var(--dc-text); }
.d-dc-who { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 14px; }
.d-dc-app { padding: 0 5px; font-size: 10.5px; font-weight: 700; line-height: 1.6; border-radius: 4px; background: #5865f2; color: #fff; }
.d-dc .d-plink { color: var(--tg-link); }
.d-embed { padding: 10px 12px; border-left: 4px solid var(--emb, var(--line-strong)); border-radius: 4px;
  background: color-mix(in srgb, var(--dc-text) 6%, var(--dc-bg)); }
.d-embed-t { display: block; margin-bottom: 4px; overflow-wrap: anywhere; }
.d-embed-f { margin-top: 8px; font-size: 12px; opacity: .8; }
.d-quote { padding-left: 10px; border-left: 3px solid color-mix(in srgb, currentColor 35%, transparent); }
.d-small { font-size: 12px; opacity: .8; }
.d-spoiler { padding: 0 2px; border-radius: 3px; background: color-mix(in srgb, currentColor 16%, transparent); }

/* sheets: insert value, history */
.d-valrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 2px 12px; width: 100%; padding: 10px 12px; text-align: left;
  font: inherit; font-size: 14.5px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); cursor: pointer; }
.d-valrow:hover { border-color: var(--accent); background: var(--accent-soft); }
.d-valrow code { grid-column: 2; grid-row: 1; font: 400 12px/1.5 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.d-ex { grid-column: 1; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.d-ex:empty { display: none; }
.d-ver { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }

@media (min-width: 900px) {
  .d-design { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .d-side { position: sticky; top: calc(var(--s-top) + 16px); align-self: start; }
}
@media (max-width: 600px) {
  .d-design { padding: 0 16px 16px; }
  .modal.d-sheet { left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: 85vh; transform: none; border-radius: 14px 14px 0 0;
    padding-bottom: calc(20px + var(--safe-bottom)); }
}
@media (pointer: coarse) {
  .d-chip,
  .d-row-pick,
  .d-valrow { min-height: 44px; }
  .d-text { font-size: 16px; }
}

/* ------------------------------------------------------------------------------------------------------------- footer */
.foot { display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: space-between; margin-top: 32px; padding: 18px 0 8px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------------------------------------------------- responsive */
@media (max-width: 999px) {
  .t-two { grid-template-columns: minmax(0, 1fr); }
  .t-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* the authenticator (app/totp.js): a code field with its Paste button, the secret as text, the recovery codes */
.d-totp-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.d-totp-row .d-totp-in { flex: 1 1 auto; min-width: 0; font-size: 16px; letter-spacing: 0.12em; }
.d-totp-key { display: flex; align-items: center; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.d-totp-key code { overflow-wrap: anywhere; word-break: break-all; user-select: all; }
.d-totp-codes { margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; white-space: pre; overflow-x: auto; user-select: all; }
.dev-qr-wrap { display: flex; justify-content: center; margin: 12px 0; }
.dev-qr-wrap .ttf-qr { max-width: 100%; height: auto; border: 6px solid #fff; border-radius: 3px; box-sizing: content-box; }
@media (max-width: 600px) {
  :root { --s-top: 56px; }
  #app.t-page { padding-top: 18px; }
  #app.t-page > * + *,
  .d-tab > * + * { margin-top: 16px; }
  .d-head h1 { font-size: 22px; }
  .d-body { padding: 16px; }
  .t-ph { padding: 12px 16px; }
  .t-pnl > .t-tabs { margin: 14px 16px 0; }
  .d-kv > dt,
  .d-kv > dd { padding: 10px 16px; }
  .t-tbl th:first-child,
  .t-tbl td:first-child { padding-left: 16px; }
  .t-tbl th:last-child,
  .t-tbl td:last-child { padding-right: 16px; }
  .t-tbl th,
  .t-tbl td { padding-left: 10px; padding-right: 10px; }
  .t-kpis { gap: 10px; }
  .t-kpis > div { padding: 12px 14px; }
  .t-kpis .v { font-size: 20px; }
  .d-limit,
  .d-rule { padding: 14px 16px; }
  .d-empty { margin: 12px 16px; }
  .d-note { padding: 10px 16px 14px; }
  .d-more { padding: 12px 16px; }
  .d-chart { padding: 14px 16px; }
  .d-stepper { padding: 12px 16px; }
  .d-secret,
  .d-pay { padding: 16px; }
  .t-pnl > .banner,
  .t-pnl > .d-msg > .banner { margin: 12px 16px; }
}
@media (max-width: 480px) {
  .topbar .shell { gap: 8px; }
  .topbar .crumb { display: none; }
  .topbar .brand span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .topbar .d-who { display: none; }
  .topbar .brand { margin-right: auto; }
  .d-grid2 { grid-template-columns: 1fr; }
  .d-stepper li:not(.on) { flex: none; }
  .d-stepper li:not(.on) span { display: none; }
  .d-wiz .t-ph .meta { display: none; }
  .d-wiz .t-ph .t-btn { margin-left: auto; }
  /* up to six dots: short joints, so the name of the current step stays readable */
  .d-wiz .d-stepper,
  .d-wiz .d-stepper li { gap: 4px; }
  .d-wiz .d-stepper li + li::before { flex-basis: 8px; min-width: 4px; }
  .banner { padding-left: 40px; }
  .banner::before { left: 12px; }
  .banner .t-btn,
  .banner .btn { margin-left: 0; }
}
@media (pointer: coarse) {
  .btn,
  .btn.sm,
  .t-btn { min-height: 44px; }
  .t-tbl td .t-btn { min-height: 40px; }
  .input,
  .select,
  .d-field textarea { min-height: 44px; font-size: 16px; }
  .t-tabs button { min-height: 44px; }
  .t-seg button { min-height: 38px; }
  .d-check { min-height: 44px; }
}

/* ------------------------------------------------------------------------------- trending alert filters (app/trending.js) */
/* the owner's approved mockup (2026-11-30): start points, chains, the filter groups with per-chain tabs, the live preview.
   One column up to 999 px (360 px phones: everything wraps, 44 px touch targets), the preview beside the form from 1000 px. */
.tf { display: grid; gap: 16px; min-width: 0; }
.tf-main, .tf-side { display: grid; gap: 14px; min-width: 0; align-content: start; }
.tf-part, .tf-card { display: grid; gap: 10px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.tf-part h3, .tf-card h3 { margin: 0; font-size: 15.5px; font-weight: 650; }
.tf-presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tf-preset { display: flex; flex-direction: column; gap: 2px; min-height: 44px; padding: 10px 12px; text-align: left; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-ctl); cursor: pointer; }
.tf-preset b { font-size: 14.5px; font-weight: 650; }
.tf-preset span { font-size: 13px; color: var(--muted); line-height: 1.4; }
.tf-preset.on, .tf-preset:hover { border-color: var(--accent); background: var(--accent-soft); }
.tf-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.tf-pick { min-height: 40px; }
.tf-pick.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.tf-tabs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.tf-add { border-style: dashed; color: var(--accent); }
.tf-note { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 10px 12px;
  font-size: 13.5px; color: var(--text-2); background: var(--surface-2); border-radius: var(--r-ctl); }
.tf-group { border-top: 1px solid var(--line); }
.tf-group-h { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 8px 2px; font: inherit; color: var(--text);
  text-align: left; background: none; border: 0; cursor: pointer; }
.tf-gnote { flex: 1 1 auto; font-size: 13px; color: var(--muted); text-align: right; }
.tf-sign { width: 14px; font-size: 18px; color: var(--muted); text-align: center; }
.tf-count, .tf-tag.own { padding: 1px 9px; font-size: 12.5px; font-weight: 650; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: var(--r-pill); }
.tf-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 4px 0 14px; }
.tf-row { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-ctl); }
.tf-row.own { background: var(--accent-soft); border-color: var(--accent-line); }
.tf-row-h { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; min-height: 22px; }
.tf-row-h .lbl { flex: 1 1 auto; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.tf-tag { font-size: 12px; font-weight: 600; color: var(--muted); }
.tf-inputs { display: flex; gap: 8px; min-width: 0; }
.tf-inputs .input { flex: 1 1 0; min-width: 0; width: 100%; }
.tf-row .input.bad, .tf-part .input.bad { border-color: var(--fail); }
.tf-bad { color: var(--fail); }
.tf-word { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.tf-switch { display: flex; align-items: center; gap: 10px; align-self: flex-start; min-height: 44px; padding: 0 12px 0 8px; font: inherit; font-size: 14px;
  font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-pill); cursor: pointer; }
.tf-switch.on { color: var(--text); border-color: var(--accent); }
.tf-track { display: flex; align-items: center; justify-content: flex-start; width: 34px; height: 20px; padding: 0 2px; box-sizing: border-box;
  background: var(--line-strong); border-radius: var(--r-pill); }
.tf-switch.on .tf-track { justify-content: flex-end; background: var(--accent); }
.tf-knob { width: 16px; height: 16px; background: var(--surface); border-radius: 50%; }
.tf-match { margin: 0; padding: 3px 12px; justify-self: start; font-size: 13px; font-weight: 650; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-pill); }
.tf-match.pass { color: var(--pass); background: var(--pass-soft); border-color: var(--pass-line); }
.tf-list { display: grid; margin: 0; padding: 0; list-style: none; }
.tf-tok { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.tf-rank { width: 28px; flex: none; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tf-tok-b { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.tf-tok-b .mut, .tf-tok .mut { color: var(--muted); font-size: 12.5px; }
.tf-res { flex: 0 1 auto; max-width: 48%; font-size: 12.5px; font-weight: 600; line-height: 1.35; text-align: right; color: var(--muted); overflow-wrap: anywhere; }
.tf-tok.pass .tf-res { color: var(--pass); }
.tf-tok.warn .tf-res { color: var(--warn); }
.tf-tg { padding: 12px; background: var(--tg-bg); border-radius: var(--r-ctl); }
.tf-bubble, .tf-tg p { margin: 0; padding: 10px 12px; font-size: 14px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; color: var(--tg-text);
  background: var(--tg-bubble); border-radius: var(--r-card); }
@media (min-width: 1000px) {
  .tf { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); align-items: start; }
  .tf-side { position: sticky; top: 16px; }
}
@media (max-width: 480px) {
  .tf-part, .tf-card { padding: 12px; }
  .tf-rows { grid-template-columns: minmax(0, 1fr); }
  .tf-gnote { display: none; }
}
