/* «Тишина» (owner's choice 10.10.2026): calm minimal. One Cyrillic grotesque (Onest 400/500/600), hierarchy by size
   and colour only, no card boxes — sections and contacts are separated by thin lines, one deep teal accent, a soft
   yellow marker for manual edits. Light and dark follow the system theme. Fonts are self-hosted (static/fonts). */
@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/static/fonts/onest-cyrillic.woff2?v=11") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/static/fonts/onest-latin.woff2?v=11") 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; }

/* Design tokens: 4px spacing scale. Text pairs keep WCAG AA (>= 4.5:1) on --bg and --surface in both themes. */
:root { color-scheme: light dark; accent-color: var(--accent); }  /* native controls follow the system theme */
:root {
  --bg: #F4F5F5; --surface: #FFFFFF; --soft: #EAEDEE; --line: #E0E3E5; --line-strong: #858D94;
  --fg: #15191C; --muted: #5F6870; --faint: #8F979D; --accent: #1D6A73; --accent-hover: #14525A; --accent-ink: #FFFFFF;
  --accent-soft: #E1EEEF; --mark: #F7EDC2; --bar: #5B969D;
  --ok: #2F6E45; --ok-bg: #E2EFE6; --info: #1D6A73; --info-bg: #E1EEEF; --bad: #B03A22; --bad-bg: #FAECE7;
  --warn: #7A5A0B; --warn-bg: #F7EDC2; --grey: #5F6870; --grey-bg: #E6E9EA; --prep: #5F6870; --prep-bg: #EAEDEE;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --radius: 12px; --head-h: 64px; --wrap-wide: 1440px;
  --shadow: 0 0 0 1px rgba(21, 25, 28, .06), 0 18px 40px -24px rgba(21, 25, 28, .35);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101315; --surface: #171B1E; --soft: #1D2226; --line: #252B2F; --line-strong: #6A747B;
    --fg: #E6E9EB; --muted: #9AA3AA; --faint: #69737A; --accent: #73BEC6; --accent-hover: #97D1D7; --accent-ink: #0B2124;
    --accent-soft: #16292B; --mark: #3F3920; --bar: #3A7F87;
    --ok: #82C597; --ok-bg: #15281C; --info: #73BEC6; --info-bg: #16292B; --bad: #F08B73; --bad-bg: #2E1B16;
    --warn: #E2C36A; --warn-bg: #3F3920; --grey: #9AA3AA; --grey-bg: #22282C; --prep: #9AA3AA; --prep-bg: #1D2226;
    --shadow: 0 0 0 1px rgba(0, 0, 0, .4), 0 18px 40px -24px rgba(0, 0, 0, .7);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg); line-height: 1.5; font-size: 15px; font-weight: 400; font-family: var(--font);
  min-height: 100vh; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font-family: inherit; }
h1 { font-size: 32px; font-weight: 600; line-height: 1.1; letter-spacing: -0.025em; margin: 0 0 var(--s4); }
h2 { font-size: 19px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; margin: 0 0 var(--s2); }
h3 { font-weight: 600; }
p { margin: 0 0 var(--s4); }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.meta, .hint, .version { font-size: 13px; line-height: 1.45; color: var(--muted); }
.hint { margin: var(--s1) 0 0; }

/* the header and the tab bar: nav.css */
.upload-btn { display: inline-flex; cursor: pointer; white-space: nowrap; }
.upload-btn input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }

main { width: 100%; margin: 0 auto; padding: var(--s5) var(--s4); flex: 1; }
main.page { max-width: var(--wrap-wide); padding: var(--s4) var(--s4) var(--s5); }  /* one frame and one left edge with the header */
main.auth { max-width: 420px; margin-top: 48px; }
footer { text-align: center; padding: var(--s4); margin-top: var(--s4); }
.version { letter-spacing: 0.08em; font-size: 12px; }
.brand-foot { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }

/* buttons: pills. Primary — the teal fill; secondary — a thin outline in the text colour; danger — red outline */
.btn, .btn-secondary, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); text-align: center;
  min-height: 40px; padding: 8px 18px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-size: 15px; font-weight: 500; line-height: 1.2; text-decoration: none; cursor: pointer; width: 100%;
  transition: background .15s, border-color .15s, color .15s;
}
.btn { background: var(--accent); color: var(--accent-ink); }
.btn:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn-secondary { background: transparent; color: var(--fg); border-color: var(--fg); }
.btn-secondary:hover { color: var(--accent); border-color: var(--accent); }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn-secondary[aria-current="page"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
button[aria-disabled="true"], button:disabled { opacity: 0.5; cursor: not-allowed; }
.actions, .toolbar { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4); }
.actions form, .toolbar form { margin: 0; }

/* forms */
.field { margin-bottom: var(--s4); }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select, .linkbox input {
  width: 100%; min-height: 44px; padding: 10px var(--s3); font: inherit; color: var(--fg);
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.field [aria-invalid="true"] { border-color: var(--bad); }
.field-error, .copy-fail { font-size: 13px; color: var(--bad); margin: var(--s1) 0 0; }
fieldset.choice { border: 0; padding: 0; margin: 0 0 var(--s4); }
fieldset.choice legend { font-size: 13px; font-weight: 500; color: var(--muted); padding: 0; margin-bottom: var(--s2); }
fieldset.choice label { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 0; margin: 0; cursor: pointer; border-bottom: 1px solid var(--line); }
fieldset.choice input[type="radio"] { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); }
fieldset.choice .desc { display: block; font-size: 13px; line-height: 1.4; color: var(--muted); margin-left: 30px; }
.choice-hint { margin: 0 0 var(--s4); }
.len { font-size: 13px; line-height: 1.4; color: var(--muted); margin: var(--s1) 0 0; }

/* sections and lists: no boxes — a thin line above each section, rows separated by lines */
.card { background: transparent; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: var(--s5) 0; margin: 0; box-shadow: none; }
.row { padding: var(--s4) 0; border-bottom: 1px solid var(--line); }
.rows { list-style: none; margin: 0 0 var(--s5); padding: 0; border-top: 1px solid var(--line); }
.row .meta { margin: 0; }
.row p { margin-bottom: var(--s1); }
.row .actions, .row .toolbar { margin: var(--s2) 0 0; }
.badge, .badge-demo {
  display: inline-block; font-size: 12px; font-weight: 500; line-height: 20px; padding: 0 var(--s2); border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.badge.muted { background: var(--grey-bg); color: var(--grey); }
.badge.warn { background: var(--warn-bg); color: var(--warn); text-decoration: none; }
.badge-demo { text-transform: uppercase; letter-spacing: .08em; }
.linkbox { background: var(--accent-soft); border-radius: var(--radius); padding: var(--s4); margin-bottom: var(--s5); }
.linkbox input { margin-bottom: var(--s2); }
.empty { padding: var(--s6) 0; margin-bottom: var(--s5); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.empty h2 { font-size: 22px; font-weight: 500; }
.empty p { margin-bottom: var(--s4); color: var(--muted); max-width: 60ch; }
.empty .btn { width: auto; }
.notice, .error-summary { padding: var(--s3) var(--s4); margin-bottom: var(--s4); border-radius: var(--radius); }
.notice { background: var(--ok-bg); color: var(--ok); }
/* a next step to take (not a success): neutral text on soft teal */
.info-box { padding: var(--s3) var(--s4); margin-bottom: var(--s4); border-radius: var(--radius); background: var(--accent-soft); color: var(--fg); }
.error-summary { background: var(--bad-bg); color: var(--bad); }
.kv { margin: 0 0 var(--s4); border-top: 1px solid var(--line); }
.kv > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px var(--s4); padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

@media (min-width: 720px) {
  main { padding: var(--s6) var(--s5); }
  main.page { padding: var(--s5) var(--s6) var(--s6); }
  .btn, .btn-secondary, .btn-danger { width: auto; }
  .auth .btn { width: 100%; }
}
@media (min-width: 1100px) { main.page { padding-left: 48px; padding-right: 48px; } }

.link-btn { background: none; border: 0; padding: 0 2px; font: inherit; font-size: 14px; font-weight: 500; color: var(--accent); cursor: pointer; width: auto; min-height: 0; }
.link-btn:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
/* status: a short phrase, coloured by meaning (contacts.css places it) */
.pill { display: inline; padding: 0; font-size: 14px; font-weight: 500; line-height: 1.35; color: var(--fg); background: none; }
.pill.sent { color: var(--ok); }
.pill.failed { color: var(--bad); }
.pill.unknown, .pill.check { color: var(--warn); }
.pill.skip, .pill.off, .pill.prep { color: var(--muted); }
.pill.queue, .pill.ready { color: var(--fg); }
.tier-tag { display: inline-block; font-size: 12px; color: var(--muted); white-space: nowrap; }
.tier-tag::before { content: "· "; }
.tier-tag.mutual, .tier-tag.dialog { color: var(--ok); }
.tier-rule { display: block; font-size: 13px; }
.sig-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sig-table th, .sig-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.sig-table th { color: var(--muted); font-weight: 500; }
.sig-wrap { overflow-x: auto; }
.msg-edit { display: block; margin: 0; }
.icon-btn { width: 40px; height: 40px; padding: 0; border-radius: 10px; border: 0; background: none; font-size: 16px; line-height: 1; cursor: pointer; }

/* modals: a surface sheet with a soft shadow */
dialog.modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; margin: auto; padding: 0; border: 0; background: transparent; color: var(--fg); position: relative; }
dialog.modal::backdrop { background: rgba(16, 19, 21, .5); }
dialog.modal .card { margin: 0 0 var(--s3); background: var(--surface); border: 0; border-radius: 20px; box-shadow: var(--shadow); }
dialog.modal .card:last-of-type { margin-bottom: 0; }
.modal-close { position: absolute; top: var(--s2); right: var(--s2); width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 24px; font-weight: 300; line-height: 1; cursor: pointer; z-index: 1; }
.modal-close:hover { background: var(--soft); color: var(--fg); }

/* notices float bottom-right instead of pushing the page: a quiet dark slip (light on dark themes) */
.notice.toast { position: fixed; right: 16px; bottom: 16px; z-index: 60; max-width: min(360px, calc(100vw - 32px)); margin: 0; background: var(--fg); color: var(--bg); box-shadow: var(--shadow); transition: opacity .4s; }
.notice.toast.hide { opacity: 0; pointer-events: none; }
.notice.toast :focus-visible { outline-color: currentColor; }  /* the teal ring is too faint on the dark slip */
/* rows of facts: label left, value right, a line between (the rules on «Отправка») */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s6); margin: 0; }
.facts > div { padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 500; }
.facts .wide { grid-column: 1 / -1; }
.stepper { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.step-btn { width: 32px; height: 32px; min-height: 0; padding: 0; font: inherit; font-size: 17px; line-height: 1; color: var(--fg); background: transparent; border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer; }
.step-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.step-val { min-width: 2ch; text-align: center; font-weight: 600; }
.step-note { display: block; font-size: 12px; color: var(--muted); }
.head-why { font-size: 13px; line-height: 1.35; color: var(--muted); }
a.head-why { color: var(--accent); }
@media (max-width: 1100px) { a.head-why { display: inline-flex; align-items: center; min-height: 44px; } }
@media (max-width: 720px) { .facts { grid-template-columns: minmax(0, 1fr); } }

/* «Как это работает»: the help modal (opened from «?» in the header) */
dialog.modal-how { width: min(700px, 100%); }
.how p { margin: 0 0 var(--s2); }
.how-list { margin: 0 0 var(--s2); padding-left: 20px; }
.how-list li { margin: 0 0 var(--s1); }
/* the help is a stack of native <details> (one thin line each); the number sits on the left, the chevron on the right */
.how-lead { margin: 0 0 var(--s3); }
.how-acc { border-top: 1px solid var(--line); }
.how-sec { border-bottom: 1px solid var(--line); }
.how-sec > summary { display: flex; align-items: center; gap: var(--s3); min-height: 52px; padding: var(--s2) 0; font-size: 16px; font-weight: 500; cursor: pointer; list-style: none; }
.how-sec > summary::-webkit-details-marker { display: none; }
.how-sec > summary::after { content: ""; flex: none; margin-left: auto; width: 8px; height: 8px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform .15s ease; }
.how-sec[open] > summary::after { transform: rotate(-135deg); }
.how-sec > summary:focus-visible { outline-offset: -2px; border-radius: 6px; }
.how-st { min-width: 0; overflow-wrap: anywhere; }
.how-body { padding: 0 0 var(--s3) calc(26px + var(--s3)); }
.how-body p:last-child, .how-body ul:last-child { margin-bottom: 0; }
@media (max-width: 520px) { .how-body { padding-left: 0; } }
@media (prefers-reduced-motion: reduce) { .how-sec > summary::after { transition: none; } }
.how-n { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; }
.how-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: middle; }
.how-dot.ok { background: var(--ok); } .how-dot.bad { background: var(--bad); } .how-dot.warn { background: var(--warn); }
.how-tbl { max-width: 100%; overflow-x: auto; margin: 0 0 var(--s2); border-top: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
.how-tbl table { border-collapse: collapse; min-width: 100%; font-size: 13px; }
.how-tbl th, .how-tbl td { padding: 8px 10px 8px 0; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.how-tbl th { color: var(--muted); font-weight: 500; }
.how-req { color: var(--accent); font-weight: 600; margin-left: 2px; }
.how-dl { width: auto; }

/* phones (owner 04.10.2026): no iOS zoom on focus (inputs >= 16px), tap targets >= 44px, no squeezed names */
@media (max-width: 720px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea,
  table.contacts td.msg textarea { font-size: 16px; }
  h1 { font-size: 28px; }
}
/* phones and tablets: every control is at least 44px tall (owner audit 09.10.2026) */
@media (max-width: 1100px) {
  .btn, .btn-secondary, .btn-danger { min-height: 44px; }
  .link-btn { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; padding: 0 4px; }
  .step-btn { width: 44px; height: 44px; font-size: 20px; }
  .modal-close { width: 44px; height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
}
/* the cabinet's stored Telegram app keys (_tg_block.html: «Ключи Telegram … · Изменить») */
.tg-keys-set { margin: var(--s3) 0; }
.tg-keys-set > summary { cursor: pointer; min-height: 44px; padding: var(--s2) 0; overflow-wrap: anywhere; }
.tg-keys-edit { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.tg-keys-set > summary:hover .tg-keys-edit { color: var(--accent-hover); }
.tg-keys-set .tg-keys { margin-top: var(--s3); }
