/* tempomail — дизайн-система: минимализм, один акцент, тёмная тема авто */

:root {
    --bg: #f6f7f9;
    --bg-soft: #eef0f4;
    --surface: #ffffff;
    --surface-2: #fbfcfd;
    --line: #e4e7ec;
    --line-strong: #d3d8e0;
    --ink: #0d1117;
    --ink-2: #3d4653;
    --muted: #6b7686;
    --accent: #3b5bfd;
    --accent-ink: #ffffff;
    --accent-soft: #eaeefe;
    --ok: #12805c;
    --warn: #b4530a;
    --danger: #c02b2b;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(13, 17, 23, .04), 0 8px 24px -12px rgba(13, 17, 23, .12);
    --shadow-lg: 0 2px 4px rgba(13, 17, 23, .04), 0 24px 48px -24px rgba(13, 17, 23, .28);
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0a0c10;
        --bg-soft: #101319;
        --surface: #12151c;
        --surface-2: #161a22;
        --line: #232935;
        --line-strong: #2f3744;
        --ink: #e8ecf2;
        --ink-2: #c2cad6;
        --muted: #8b95a7;
        --accent: #6d8bff;
        --accent-ink: #0a0c10;
        --accent-soft: #1b2135;
        --ok: #3ddc97;
        --warn: #f0b27a;
        --danger: #ff7a7a;
        --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 32px -16px rgba(0, 0, 0, .7);
        --shadow-lg: 0 2px 6px rgba(0, 0, 0, .5), 0 32px 64px -32px rgba(0, 0, 0, .9);
    }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font: 16px/1.6 var(--sans);
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* ---------- шапка ---------- */
.top {
    position: sticky; top: 0; z-index: 30;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(140%) blur(12px);
    border-bottom: 1px solid var(--line);
}
.top-in { display: flex; align-items: center; gap: 14px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 650; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand span small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin-top: -2px; }
.top nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.top nav a {
    color: var(--ink-2); font-size: 14.5px; padding: 8px 11px; border-radius: 9px;
}
.top nav a:hover { background: var(--bg-soft); color: var(--ink); text-decoration: none; }
.top nav a.active { color: var(--ink); background: var(--bg-soft); }

/* ---------- типографика ---------- */
h1 { font-size: clamp(28px, 4.4vw, 42px); line-height: 1.12; letter-spacing: -.028em; margin: 0 0 14px; font-weight: 700; }
h2 { font-size: clamp(20px, 2.6vw, 26px); line-height: 1.25; letter-spacing: -.02em; margin: 40px 0 14px; font-weight: 660; }
h3 { font-size: 17px; margin: 20px 0 8px; font-weight: 640; }
.lead { font-size: clamp(16px, 1.6vw, 18.5px); color: var(--muted); margin: 0 0 22px; max-width: 62ch; }
.muted { color: var(--muted); font-size: 14px; }
.mono { font-family: var(--mono); }

/* ---------- карточки ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 22px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card.tight { padding: 0; overflow: hidden; }

/* ---------- кнопки ---------- */
.btn, button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font: inherit; font-weight: 560; font-size: 15.5px;
    padding: 12px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
    background: var(--accent); color: var(--accent-ink);
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: transform .08s ease, filter .15s ease, background .15s ease;
}
.btn:hover, button:hover { filter: brightness(1.06); text-decoration: none; }
.btn:active, button:active { transform: translateY(1px); }
.btn svg, button svg { width: 17px; height: 17px; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.quiet { background: transparent; color: var(--ink-2); border-color: transparent; }
.btn.quiet:hover { background: var(--bg-soft); }
.btn.small { padding: 8px 13px; font-size: 14px; border-radius: 9px; }
.btn.icon { padding: 9px; width: 38px; height: 38px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- формы ---------- */
.field { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hint { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
label.fld { font-size: 13px; color: var(--muted); display: block; margin-bottom: 6px; }
select, input[type=text], input[type=email] {
    font: inherit; color: var(--ink); background: var(--surface);
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    padding: 11px 13px; min-height: 44px; outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
select:focus, input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- адрес-чип ---------- */
.addr {
    font-family: var(--mono); font-size: clamp(17px, 2.4vw, 22px); font-weight: 600;
    letter-spacing: -.01em; word-break: break-all; line-height: 1.3;
}
.chip {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--accent-soft); color: var(--accent);
    border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 560;
}
.chip.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.chip.dead { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

/* ---------- список писем ---------- */
.msgs { list-style: none; margin: 0; padding: 0; }
.msgs li { border-bottom: 1px solid var(--line); }
.msgs li:last-child { border-bottom: 0; }
.msgs a {
    display: grid; grid-template-columns: 38px 1fr auto; gap: 13px; align-items: center;
    padding: 14px 18px; color: inherit;
}
.msgs a:hover { background: var(--surface-2); text-decoration: none; }
.ava {
    width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
    background: var(--bg-soft); color: var(--ink-2); font-weight: 650; font-size: 15px;
    border: 1px solid var(--line); text-transform: uppercase;
}
.msgs li.unread .ava { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.subj { font-weight: 600; color: var(--ink); display: block; overflow: hidden; text-overflow: ellipsis; }
.from { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; }
.when { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.msgs li.unread .subj::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 7px; vertical-align: 2px; }

/* ---------- скелетоны ---------- */
.skel { border-radius: 8px; background: linear-gradient(90deg, var(--bg-soft) 25%, var(--surface-2) 37%, var(--bg-soft) 63%); background-size: 400% 100%; animation: skel 1.4s ease infinite; }
@keyframes skel { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skel-line { height: 12px; margin: 7px 0; }

/* ---------- пустое состояние ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 84px; height: 84px; opacity: .55; margin-bottom: 10px; }

/* ---------- сетки ---------- */
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.feature svg { width: 22px; height: 22px; color: var(--accent); margin-bottom: 10px; }
.feature b { display: block; margin-bottom: 4px; font-weight: 620; }
.feature p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* ---------- hero ---------- */
.hero { padding: 44px 0 10px; }
.hero .kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted);
    border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 13px; margin-bottom: 18px; }
.hero-form { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: var(--shadow-lg); margin-top: 8px; }

/* ---------- полоса жизни ящика ---------- */
.life { height: 5px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; margin-top: 12px; }
.life i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 1s linear; }

/* ---------- письмо ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
pre.body { white-space: pre-wrap; word-break: break-word; font: 15px/1.65 var(--mono); margin: 0; }
iframe.html-body { width: 100%; min-height: 440px; border: 0; background: #fff; border-radius: 12px; }
ul.files { list-style: none; margin: 0; padding: 0; }
ul.files li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
ul.files li:last-child { border-bottom: 0; }
ul.files .fname { font-weight: 560; }
ul.files .fsize { color: var(--muted); font-size: 13px; }

/* ---------- подвал ---------- */
.foot { margin: 56px 0 28px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; display: flex; gap: 16px; flex-wrap: wrap; }
.foot a { color: var(--ink-2); }

/* ---------- мобильная нижняя панель ---------- */
.mbar {
    display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(14px); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.mbar a {
    min-width: 0; display: grid; place-items: center; gap: 3px; padding: 7px 2px;
    color: var(--muted); font-size: 10.5px; line-height: 1.15; border-radius: 10px;
    overflow: hidden;
}
.mbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mbar a.active { color: var(--accent); }
.mbar svg { width: 20px; height: 20px; }
/* длинные строки не должны распирать страницу по ширине */
code, kbd, samp { font-family: var(--mono); font-size: .93em; overflow-wrap: anywhere; word-break: break-word; }
pre { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; overflow-wrap: normal; }
.card > pre:not(.body) {
    background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px;
    padding: 12px 14px; margin: 0 0 12px;
}
body { overflow-x: hidden; }

@media (max-width: 720px) {
    .top nav { display: none; }
    .mbar { display: grid; }
    body { padding-bottom: 84px; }
    .hero { padding-top: 26px; }
    .hero h1 { font-size: clamp(24px, 7.2vw, 34px); letter-spacing: -.02em; }
    .container { padding: 0 16px; }
    .card { padding: 18px 16px; border-radius: 14px; }
    .hero-form { padding: 16px; border-radius: 16px; }
    .msgs a { grid-template-columns: 34px 1fr auto; gap: 10px; padding: 13px 14px; }
    .ava { width: 34px; height: 34px; border-radius: 10px; font-size: 14px; }
    pre.body, pre { font-size: 13px; }
    .foot { margin: 40px 0 12px; gap: 12px; }
}

/* ---------- прогресс навигации (Turbo) ---------- */
#nav-progress {
    position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 100;
    background: var(--accent); opacity: 0; transition: width .25s ease, opacity .3s ease;
}
#nav-progress.on { opacity: 1; }

/* ---------- анимации появления ---------- */
@media (prefers-reduced-motion: no-preference) {
    ::view-transition-old(root) { animation: fade-out .12s ease both; }
    ::view-transition-new(root) { animation: fade-in .18s ease both; }
    @keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
    @keyframes fade-out { to { opacity: 0; } }
    .msgs li { animation: rise .22s ease both; }
    @keyframes rise { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
}

/* ---------- FAQ / текст ---------- */
.faq h3 { margin-top: 18px; }
.faq p { margin: 4px 0 0; color: var(--muted); }
.prose p, .prose li { color: var(--ink-2); }


/* --- контентные блоки главной: списки шагов и таблицы --- */
.prose h2 + p, .prose h2 + .tbl-wrap { margin-top: 10px; }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 14px 0 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 520px; }
.tbl th, .tbl td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td:first-child { color: var(--ink); }
.tbl td { color: var(--ink-2); }

ol.steps { list-style: none; counter-reset: st; padding: 0; margin: 16px 0 0; display: grid; gap: 12px; }
ol.steps li { counter-increment: st; display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; color: var(--ink-2); }
ol.steps li::before {
    content: counter(st); width: 32px; height: 32px; border-radius: 10px;
    background: var(--bg-soft); color: var(--accent);
    display: grid; place-items: center; font-weight: 600; font-size: 14px;
}

ul.dots { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
ul.dots li { position: relative; padding-left: 22px; color: var(--ink-2); }
ul.dots li::before {
    content: ""; position: absolute; left: 4px; top: .62em;
    width: 7px; height: 7px; border-radius: 50%; background: var(--accent); opacity: .8;
}

/* ---------- мои ящики: строка со счётчиком ---------- */
.msgs li { display: flex; align-items: center; gap: 6px; padding-right: 10px; }
.msgs li > a { flex: 1 1 auto; min-width: 0; }
.msgs li > .chip { flex: 0 0 auto; font-size: 12px; padding: 4px 9px; white-space: nowrap; }
.msgs li > .chip.fresh { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.msgs li > .chip.fresh::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.msgs li > .btn.icon { flex: 0 0 auto; }
@media (max-width: 560px) {
    .msgs li > .chip { font-size: 11px; padding: 3px 8px; }
}
