/* ========================================================
   LIGHT MODERN PORTAL
   ======================================================== */
:root {
    --primary: #0b67d1;
    --primary-dark: #084f9f;
    --ok: #059669;
    --danger: #dc2626;
    --text: #0f172a;
    --muted: #64748b;
    --line: #dbe7f3;
    --soft: #f5f9ff;
    --warning-bg: #fff7da;
    --warning: #8a5b00;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background:
        radial-gradient(circle at 12% 10%, rgba(14, 103, 209, .16), transparent 32%),
        radial-gradient(circle at 92% 4%, rgba(16, 185, 129, .14), transparent 26%),
        linear-gradient(135deg, #eef6ff 0%, #f8fbff 48%, #eef7f5 100%);
    color: var(--text);
    overflow-x: hidden;
}

.page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 14px;
}

.card {
    width: 100%;
    max-width: 470px;
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(219,231,243,.92);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .14);
    animation: cardIn .45s cubic-bezier(.21,1,.35,1) both;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(18px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.card.wide { max-width: 860px; }

.hero-photo {
    height: 154px;
    background:
        linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(0,0,0,.22) 100%),
        url('vokzal.jpg') center 52% / cover no-repeat;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 20px 24px 0;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 15px;
    color: var(--text);
}
.brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0b67d1, #18a058);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 8px 20px rgba(11,103,209,.23);
}
.brand-icon svg { width: 19px; height: 19px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; }
.langs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.lang {
    color: #64748b;
    border: 1px solid #d8e4f1;
    padding: 6px 10px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    background: #fff;
}
.lang.active { color: #fff; background: var(--primary); border-color: var(--primary); }

h1 {
    font-size: 28px;
    font-weight: 850;
    line-height: 1.15;
    letter-spacing: -.03em;
    color: var(--text);
    margin: 24px 24px 10px;
}
h2 { font-size: 17px; font-weight: 750; color: var(--text); margin: 18px 24px 10px; }
.muted { color: var(--muted); font-size: 15px; line-height: 1.6; margin-left: 24px; margin-right: 24px; }

.form { display: grid; gap: 10px; margin: 22px 24px 0; }
.form label { font-weight: 750; font-size: 13px; color: #334155; }
.form input,
.form select {
    width: 100%;
    background: #f8fbff;
    border: 1px solid #d9e5f2;
    border-radius: 16px;
    padding: 15px 16px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text);
    outline: none;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
.form input::placeholder { color: #94a3b8; }
.form input:focus,
.form select:focus {
    border-color: rgba(11,103,209,.75);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(11,103,209,.12);
}
.form select option { background: #fff; color: var(--text); }
.form.install input[type="checkbox"] { width: auto; margin-right: 8px; }
#code { text-align: center; font-size: 30px; font-weight: 800; letter-spacing: .28em; padding: 16px; }

button,
.btn-link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    border: 0;
    background: linear-gradient(135deg, #0b67d1 0%, #18a058 100%);
    color: #fff;
    border-radius: 16px;
    padding: 15px 22px;
    font-size: 15px;
    font-weight: 800;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 12px 30px rgba(11,103,209,.25);
    transition: transform .15s, box-shadow .15s, filter .15s;
}
button:hover,
.btn-link:hover { transform: translateY(-1px); filter: brightness(1.05); box-shadow: 0 16px 36px rgba(11,103,209,.30); }
.btn-link { margin: 18px 24px 0; width: calc(100% - 48px); }
.btn-link.secondary { background: #eef6ff; color: var(--primary); border: 1px solid #d8e7ff; box-shadow: none; }

.alert { border-radius: 16px; padding: 13px 15px; margin: 14px 24px; line-height: 1.5; font-size: 14px; }
.alert-warning { background: #fff7da; color: #8a5b00; border: 1px solid #ffe7a6; }
.alert-danger { background: #ffecec; color: #b91c1c; border: 1px solid #ffcaca; }
.alert-ok { background: #e9fbf2; color: #047857; border: 1px solid #bfead5; }

.debug { margin: 18px 24px 0; padding: 12px; background: #f8fbff; border: 1px dashed #c9d9ea; border-radius: 12px; color: #64748b; font-size: 12px; overflow-wrap: anywhere; }
code { background: #eef4fb; padding: 2px 6px; border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: #0f172a; }
.footer { margin: 22px 24px 24px; color: #94a3b8; font-size: 12px; text-align: center; }
.check-table { width: calc(100% - 48px); margin: 15px 24px 0; border-collapse: collapse; }
.check-table td { border-bottom: 1px solid #e8eef6; padding: 10px 8px; vertical-align: top; color: #334155; }
.ok { color: #059669; font-weight: 800; }
.bad { color: #dc2626; font-weight: 800; }
.diag { width: calc(100% - 48px); margin:16px 24px 0; border-collapse:collapse; }
.diag th,.diag td { border-bottom:1px solid #e8eef6; padding:10px; text-align:left; color:#334155; }
.diag code { word-break:break-all; }

@media (max-width: 480px) {
    .page { padding: 0; align-items: stretch; }
    .card { min-height: 100vh; border-radius: 0; border: 0; }
    .hero-photo { height: 150px; }
    h1 { font-size: 24px; }
    .topbar { padding: 18px 18px 0; }
    h1, h2, .muted { margin-left: 18px; margin-right: 18px; }
    .form { margin-left: 18px; margin-right: 18px; }
    .alert { margin-left: 18px; margin-right: 18px; }
    .btn-link { margin-left: 18px; margin-right: 18px; width: calc(100% - 36px); }
    .footer { margin-left: 18px; margin-right: 18px; }
}

/* ========================================================
   DASHBOARD — light theme, completely separate
   ======================================================== */
body.dash {
    background: #f0f4f9;
    color: var(--text);
}
body.dash::before,
body.dash::after { display: none; }

/* reset portal styles for dashboard context */
body.dash h1  { color: var(--text); }
body.dash h2  { color: var(--text); }
body.dash .muted { color: var(--muted); }
body.dash code { background: #f1f5fa; color: var(--text); }

body.dash button {
    background: var(--primary);
    box-shadow: none;
    transform: none;
    border-radius: 10px;
    padding: 9px 18px;
    font-size: 14px;
    width: auto;
}
body.dash button::after { display: none; }
body.dash button:hover  { filter: brightness(1.1); transform: none; box-shadow: none; }

.dash-wrap   { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }
.dash-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.dash-title  { font-size: 22px; font-weight: 800; color: var(--text); }

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.stat-num  { font-size: 28px; font-weight: 800; color: var(--primary); line-height: 1; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

.dash-filters { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; margin-bottom: 20px; display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.dash-filters label { font-size: 12px; font-weight: 700; color: var(--muted); display: block; margin-bottom: 4px; }
.dash-filters input,
.dash-filters select { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 14px; background: #fff; color: var(--text); outline: none; }
.dash-filters input:focus,
.dash-filters select:focus { border-color: var(--primary); }
.dash-filters button { background: var(--primary); color: #fff; }
.dash-filters .btn-export { background: #e9f8ef; color: var(--ok); }

.dash-table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dash-table th { background: #f8fafc; font-weight: 700; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.dash-table td { padding: 11px 14px; border-bottom: 1px solid #f0f4f9; vertical-align: middle; color: var(--text); }
.dash-table tr:last-child td { border-bottom: 0; }
.dash-table tr:hover td { background: #f8fafc; }

.badge           { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 700; }
.badge-verified  { background: #e9f8ef; color: var(--ok); }
.badge-pending   { background: #fff5d8; color: #8a5b00; }
.badge-expired   { background: #f0f4f9; color: var(--muted); }
.badge-failed    { background: #ffe8e8; color: var(--danger); }

.dash-pagination { display: flex; gap: 8px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.dash-pagination a,
.dash-pagination span { border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-size: 13px; text-decoration: none; color: var(--text); background: #fff; }
.dash-pagination a:hover { background: #eef4ff; border-color: var(--primary); color: var(--primary); }
.dash-pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

.mono { font-family: monospace; font-size: 12px; }

@media (max-width: 700px) {
    .dash-table th:nth-child(4), .dash-table td:nth-child(4),
    .dash-table th:nth-child(5), .dash-table td:nth-child(5) { display: none; }
}
