:root {
    --bg: #f3f5f8;
    --card: #ffffff;
    --ink: #172033;
    --muted: #5d697a;
    --line: #e4e8ee;
    --red: #cc232a;
    --red-dark: #a61c22;
    --ok: #1d6b45;
    --warn: #8a5a12;
    --bad: #8d2e2e;
    color: var(--ink);
    background: var(--bg);
    font-family: Manrope, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; }
img { max-width: 100%; }

.wrap {
    width: min(1120px, calc(100% - 40px));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}

.header-bar {
    display: flex;
    align-items: center;
    gap: 28px;
    min-height: 60px;
}

.brand { margin-right: auto; }
.brand img { display: block; height: 44px; width: auto; }

.menu { display: flex; gap: 22px; }
.menu a { text-decoration: none; font-weight: 600; color: var(--ink); }
.menu a:hover { color: var(--red); }

.langs {
    display: flex;
    padding: 4px;
    background: #eef1f5;
    border-radius: 999px;
}
.langs a {
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 14px;
    color: var(--muted);
}
.langs a.is-on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(23, 32, 51, 0.12); }

.hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(700px 280px at 100% 0, rgba(204, 35, 42, 0.08), transparent 70%),
        #fff;
    border-bottom: 1px solid var(--line);
}

.hero-copy { position: relative; z-index: 1; }

.hero-grid {
    position: relative;
    z-index: 1;
    display: block;
    max-width: 760px;
    padding: 16px 0 8px;
}

.hero-copy h1, .page-title {
    margin: 0 0 12px;
    font-size: clamp(26px, 3vw, 36px);
    line-height: 1.12;
    letter-spacing: -0.03em;
}

.lead { margin: 16px 0 0; max-width: 34rem; color: var(--muted); font-size: 18px; }

.facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 22px 0 0;
    padding: 0;
    list-style: none;
}
.facts li {
    padding: 8px 12px;
    background: #f4f6f9;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
}

.panel, .card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 18px 50px rgba(23, 32, 51, 0.08);
}

.tabs { display: flex; gap: 6px; margin: 0 0 16px; padding: 4px; background: #f3f5f8; border-radius: 12px; }
.tabs button {
    flex: 1;
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background-color: #f3f5f8;
    border-radius: 10px;
    padding: 10px 8px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    color: var(--muted);
}
.tabs button.is-on { background-color: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(23, 32, 51, 0.12); }
.pane[hidden] { display: none; }

.panel h2, .card h2, .band h2 { margin: 0 0 16px; font-size: 22px; letter-spacing: -0.02em; }

.field { position: relative; display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field span, .hint, .meta dt, .contact-box span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

input[type="text"], input[type="password"], input[type="file"], input:not([type]) {
    width: 100%;
    border: 1px solid #d5dbe3;
    background: #fff;
    color: var(--ink);
    border-radius: 12px;
    padding: 13px 14px;
    font: inherit;
    font-size: 16px;
}
textarea {
    width: 100%;
    border: 1px solid #d5dbe3;
    background: #fff;
    color: var(--ink);
    border-radius: 12px;
    padding: 13px 14px;
    font: inherit;
    font-size: 16px;
    resize: vertical;
}
input:focus, textarea:focus { outline: 2px solid rgba(204, 35, 42, 0.25); border-color: var(--red); }
.text-row { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 14px 0 2px; min-width: 0; }
.text-row legend { padding: 0; font-weight: 700; font-size: 15px; }
.text-row .field { margin-bottom: 10px; }
#texts-form > .button { margin-top: 8px; }

.panel .button, .card .button.ghost { width: 100%; text-align: center; }
.panel .button { margin-bottom: 4px; }

.button {
    appearance: none;
    border: 0;
    background: var(--red);
    color: #fff;
    border-radius: 12px;
    padding: 13px 18px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.button:hover { background: var(--red-dark); }
.button.ghost {
    background: #fff;
    color: var(--ink);
    border: 1px solid #d5dbe3;
}
.button.ghost:hover { border-color: var(--red); color: var(--red); }

.grid {
    display: grid;
    grid-template-columns: 0.7fr 1.1fr 0.7fr;
    gap: 10px;
}
.street { grid-column: 1 / -1; }

.suggest {
    position: fixed;
    z-index: 40;
    margin: 0;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 14px 32px rgba(23, 32, 51, 0.16);
    max-height: 240px;
    overflow: auto;
}
.suggest button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    border-radius: 8px;
    padding: 9px 10px;
    font: inherit;
    cursor: pointer;
}
.suggest button:hover,
.suggest button.is-on { background: #f3f5f8; }

.or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.or::before, .or::after { content: ""; height: 1px; background: var(--line); flex: 1; }

.notices:empty { display: none; }
.notices { padding-top: 24px; }
.banner { border-radius: 14px; padding: 12px 14px; margin: 0 0 12px; }
.banner.bad { background: #fdeceb; color: var(--bad); }
.banner.ok { background: #e7f6ee; color: var(--ok); }
.banner.warn { background: #fff4df; color: var(--warn); }

.job { display: grid; gap: 12px; margin-top: 16px; }
.job[hidden] { display: none; }
.job-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.job-track { height: 10px; overflow: hidden; background: #eef1f5; border-radius: 999px; }
.job-track span { display: block; height: 100%; width: 0; background: var(--red); border-radius: inherit; transition: width .2s ease; }
.button:disabled { opacity: 0.55; cursor: progress; }
#live-notice { margin-top: 12px; }

.pdf-files { list-style: none; margin: 8px 0 0; padding: 0; }
.pdf-files li {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
    border-bottom: 1px solid var(--line);
}
.pdf-files li:last-child { border-bottom: 0; }
.pdf-name { font-weight: 700; white-space: nowrap; }
.pdf-meta { flex: 1; min-width: 0; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdf-files form { margin: 0; }
.pill {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e7f6ee;
    color: var(--ok);
    font-size: 12px;
    font-weight: 700;
    vertical-align: 1px;
}
.pill.off { background: #f3f5f8; color: var(--muted); }

.result { margin-bottom: 8px; }
.meta {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr 0.6fr;
    gap: 12px;
    margin: 0 0 16px;
}
.meta div { padding-top: 8px; border-top: 1px solid var(--line); }
.meta dd { margin: 2px 0 0; font-size: 20px; font-weight: 700; }
.admin-stats { grid-template-columns: 1.1fr 1fr; }
.stat-have { color: var(--ok); }
.stat-need { color: var(--bad); }
.stat-need.is-ok { color: var(--ok); }
.stat-sep { color: var(--muted); padding: 0 0.2em; font-weight: 600; }
.stat-when { margin-left: 10px; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.actions { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; }
.actions .button { width: auto; }
.print-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid #d5dbe3;
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
}
.print-btn:hover { border-color: var(--red); color: var(--red); }
.print-btn svg { width: 22px; height: 22px; }
@media print {
    header, footer, .hero, .notices, .actions, .meta { display: none !important; }
    body, main, .card, #receipt, .band, .wrap { background: #fff !important; box-shadow: none !important; border: 0 !important; padding: 0 !important; margin: 0 !important; }
    .slip, .slip-canvas { border: 0 !important; width: 100% !important; max-width: none !important; }
}

.slip {
    width: 100%;
    height: 78vh;
    min-height: 520px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
    width: 100%;
    text-align: left;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
    cursor: pointer;
}
.choice:hover { border-color: var(--red); }

.band { padding: 28px 0; }
#receipt { scroll-margin-top: 76px; padding-top: 8px; }
.slip-tools { display: flex; gap: 8px; margin: 0 0 8px; }
.slip-view {
    overflow: auto;
    height: 72vh;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #eef1f5;
    -webkit-overflow-scrolling: touch;
}
.slip-canvas { display: block; width: auto; max-width: none; height: auto; border: 0; background: #fff; }
.slip[hidden], .slip-canvas[hidden], .slip-view[hidden] { display: none !important; }
.band .wrap { position: relative; z-index: 1; }
.band h2 { font-size: 32px; letter-spacing: -0.03em; }

.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
.cards article {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
    min-height: 180px;
}
.cards span {
    display: inline-flex;
    color: var(--red);
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.08em;
}
.cards h3 { margin: 10px 0 8px; font-size: 18px; }
.cards p { margin: 0; color: var(--muted); font-size: 14px; }

.contacts { padding-top: 8px; }
.contact-grid {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr 0.8fr;
    gap: 14px;
    align-items: stretch;
}
.who { margin: 0 0 6px; font-size: 20px; font-weight: 700; }
.contact-grid p { margin: 0; color: var(--muted); }
.contact-box {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}
.contact-box a, .contact-box strong { font-size: 20px; font-weight: 800; text-decoration: none; letter-spacing: -0.02em; }

.site-footer {
    background: #fff;
    border-top: 1px solid var(--line);
    padding: 28px 0;
}
.footer-bar {
    display: grid;
    grid-template-columns: 1.4fr 1fr auto;
    gap: 18px;
    align-items: center;
}
.footer-bar p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.footer-bar a { text-decoration: none; font-weight: 700; }
.admin-link { color: var(--muted); font-size: 14px; font-weight: 600; }

.page { padding: 12px 0 28px; }
.page .card { padding: 14px 16px; }
.files-title { margin: 14px 0 4px; font-size: 18px; }
.upload-title { margin: 0 0 10px; font-size: 18px; font-weight: 800; }
.upload-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.upload-row .button { width: auto; }
.picked { color: var(--muted); font-size: 14px; min-width: 8em; }
.file-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.admin-stats { margin-bottom: 8px; }
table { width: 100%; border-collapse: collapse; margin: 12px 0 18px; }
th, td { text-align: left; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.text { background: none; border: 0; color: var(--red); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.inline { display: inline; }
.plain { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.missing-clip { max-height: 3.4em; overflow: hidden; position: relative; }
.missing-clip::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1.6em;
    background: linear-gradient(transparent, var(--card));
}
.missing-clip.is-open { max-height: none; }
.missing-clip.is-open::after { display: none; }
.missing .text { margin-top: 6px; }

@media (max-width: 900px) {
    .header-bar { flex-wrap: wrap; min-height: 0; gap: 8px 16px; padding: 8px 0; }
    .menu { display: flex; width: 100%; gap: 16px; }
    .hero-grid, .cards, .contact-grid, .footer-bar, .meta { grid-template-columns: 1fr; }
    .hero-grid { padding: 12px 0 8px; }
    .brand img { height: 40px; }
}
