:root {
    color-scheme: dark;
    --bg: #090b13;
    --bg-2: #10131f;
    --surface: rgba(18, 22, 35, .82);
    --surface-strong: rgba(25, 30, 48, .96);
    --surface-soft: rgba(255, 255, 255, .055);
    --border: rgba(255, 255, 255, .12);
    --text: #f6f7fb;
    --muted: #a6adc8;
    --muted-2: #747d9d;
    --primary: #8b5cf6;
    --primary-2: #06b6d4;
    --primary-3: #f43f5e;
    --danger: #fb7185;
    --success: #34d399;
    --warning: #fbbf24;
    --shadow: 0 24px 80px rgba(0,0,0,.42);
    --radius: 24px;
    --radius-sm: 14px;
    --gradient: linear-gradient(135deg, var(--primary), var(--primary-2));
    --glow: 0 0 48px rgba(139,92,246,.28);
}

[data-theme="light"] {
    color-scheme: light;
    --bg: #f4f7fb;
    --bg-2: #eef2ff;
    --surface: rgba(255,255,255,.86);
    --surface-strong: rgba(255,255,255,.96);
    --surface-soft: rgba(15, 23, 42, .055);
    --border: rgba(15, 23, 42, .12);
    --text: #101426;
    --muted: #586174;
    --muted-2: #7a849a;
    --primary: #6d28d9;
    --primary-2: #0891b2;
    --primary-3: #e11d48;
    --danger: #dc2626;
    --success: #059669;
    --warning: #d97706;
    --shadow: 0 22px 70px rgba(72, 80, 110, .16);
    --glow: 0 0 42px rgba(109,40,217,.16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(139,92,246,.28), transparent 34rem),
        radial-gradient(circle at top right, rgba(6,182,212,.22), transparent 30rem),
        radial-gradient(circle at bottom, rgba(244,63,94,.13), transparent 36rem),
        linear-gradient(160deg, var(--bg), var(--bg-2));
    color: var(--text);
    line-height: 1.55;
}

a { color: inherit; }
button, input, textarea, select { font: inherit; }

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.026) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.8), transparent 72%);
}

.page-shell {
    position: relative;
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 18px 0 42px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    font-weight: 900;
    letter-spacing: -.04em;
    font-size: 1.16rem;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--gradient);
    color: white;
    box-shadow: var(--glow);
}

.nav-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.theme-toggle,
.btn,
button.btn,
a.btn {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 14px;
    text-decoration: none;
    font-weight: 750;
    box-shadow: 0 8px 24px rgba(0,0,0,.10);
    transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.theme-toggle:hover,
.btn:hover { transform: translateY(-2px); border-color: rgba(139,92,246,.45); box-shadow: var(--glow); }
.btn:active { transform: translateY(0) scale(.985); }
.btn-primary { background: var(--gradient); color: white; border-color: transparent; }
.btn-danger { background: rgba(244,63,94,.14); color: var(--danger); border-color: rgba(244,63,94,.28); }
.btn-success { background: rgba(52,211,153,.14); color: var(--success); border-color: rgba(52,211,153,.28); }
.btn-soft { background: var(--surface-soft); }
.btn-small { min-height: 34px; padding: 7px 12px; font-size: .9rem; }

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
    gap: 26px;
    align-items: stretch;
}

.hero-copy,
.card,
.panel {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--surface), rgba(255,255,255,.035));
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.hero-copy {
    padding: clamp(28px, 4vw, 48px);
    overflow: hidden;
}

.hero-copy::after,
.card::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255,255,255,.16), transparent 28%, transparent 70%, rgba(255,255,255,.06));
    opacity: .7;
}

.kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(139,92,246,.14);
    border: 1px solid rgba(139,92,246,.24);
    color: var(--muted);
    font-size: .92rem;
    font-weight: 720;
    margin-bottom: 18px;
}

h1, h2, h3 { margin: 0; letter-spacing: -.045em; line-height: 1.04; }
h1 { font-size: clamp(2.55rem, 7vw, 5.85rem); max-width: 820px; }
h2 { font-size: clamp(1.55rem, 3vw, 2.35rem); }
h3 { font-size: 1.2rem; }
.gradient-text { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--muted); font-size: clamp(1rem, 2vw, 1.18rem); max-width: 720px; margin: 18px 0 0; }
.muted { color: var(--muted); }
.tiny { color: var(--muted-2); font-size: .86rem; }

.card { padding: clamp(22px, 3vw, 32px); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.card-title p { margin: 6px 0 0; color: var(--muted); }

.form-grid { display: grid; gap: 14px; }
.input-row { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 12px; }
label { display: grid; gap: 8px; color: var(--muted); font-weight: 700; font-size: .92rem; }
input[type="text"], input[type="password"], input[type="url"], input[type="file"], textarea, select {
    width: 100%;
    min-height: 48px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
    outline: none;
    padding: 12px 14px;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
input:focus, textarea:focus, select:focus { border-color: rgba(139,92,246,.65); box-shadow: 0 0 0 4px rgba(139,92,246,.14); }
input::placeholder { color: var(--muted-2); }
.hp-field { position:absolute; left:-9999px; top:auto; width:1px; height:1px; overflow:hidden; }

.alert { border-radius: 18px; padding: 14px 16px; border: 1px solid var(--border); margin: 16px 0; }
.alert-error { background: rgba(244,63,94,.12); color: var(--danger); border-color: rgba(244,63,94,.26); }
.alert-success { background: rgba(52,211,153,.12); color: var(--success); border-color: rgba(52,211,153,.26); }
.alert-info { background: rgba(6,182,212,.10); color: var(--text); border-color: rgba(6,182,212,.22); }

.result-box { display: grid; gap: 14px; margin-top: 20px; }
.copy-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.copy-line input { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.qr-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px; border: 1px solid var(--border); background: var(--surface-soft); border-radius: 20px; }
.qr-wrap img, .qr-img { width: 140px; height: 140px; border-radius: 18px; background: #fff; padding: 10px; object-fit: contain; }

.stats-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
.stat-card { padding: 18px; border-radius: 20px; background: var(--surface-soft); border: 1px solid var(--border); }
.stat-card strong { display: block; font-size: clamp(1.65rem, 4vw, 2.45rem); letter-spacing: -.05em; }
.stat-card span { color: var(--muted); font-weight: 700; }

.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 26px; }
.feature { padding: 20px; border-radius: 22px; background: var(--surface-soft); border: 1px solid var(--border); }
.feature-icon { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: rgba(139,92,246,.15); margin-bottom: 12px; }
.feature h3 { margin-bottom: 8px; }
.feature p { color: var(--muted); margin: 0; }

.section { margin-top: 26px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 20px; background: var(--surface-strong); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; background: var(--surface-soft); }
td { color: var(--text); }
tr:last-child td { border-bottom: 0; }
.url-cell { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-pill { display: inline-flex; align-items: center; gap: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; padding: 7px 10px; border-radius: 999px; background: rgba(139,92,246,.12); border: 1px solid rgba(139,92,246,.2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.pagination { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.pagination a, .pagination span { min-width: 38px; min-height: 38px; border-radius: 999px; display: inline-grid; place-items: center; text-decoration: none; border: 1px solid var(--border); background: var(--surface-soft); color: var(--text); font-weight: 750; padding: 0 12px; }
.pagination .active { background: var(--gradient); color: white; border-color: transparent; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(460px, 100%); }
.login-logo { display:flex; justify-content:center; margin-bottom:16px; }

details.import-details { margin-top: 16px; }
details.import-details summary { cursor: pointer; list-style: none; }
details.import-details summary::-webkit-details-marker { display: none; }
.import-body { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }

.bar-list { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 56px; gap: 10px; align-items: center; }
.bar-track { height: 11px; border-radius: 999px; background: var(--surface-soft); overflow: hidden; border: 1px solid var(--border); }
.bar-fill { height: 100%; border-radius: inherit; background: var(--gradient); min-width: 2px; }

.footer { margin-top: 36px; color: var(--muted-2); text-align: center; font-size: .92rem; }

@media (max-width: 960px) {
    .hero { grid-template-columns: 1fr; }
    .feature-grid, .stats-strip, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
    .page-shell { width: min(100% - 22px, 1180px); padding-top: 18px; }
    .topbar { align-items: flex-start; }
    .brand span:last-child { display: none; }
    .nav-actions { gap: 8px; }
    .theme-toggle, .btn { min-height: 40px; padding: 9px 12px; }
    .hero-copy, .card { border-radius: 20px; padding: 22px; }
    .input-row, .copy-line, .grid-2, .feature-grid, .stats-strip, .grid-3 { grid-template-columns: 1fr; }
    .url-cell { max-width: 260px; }
    .bar-row { grid-template-columns: 90px minmax(0, 1fr) 44px; font-size: .9rem; }
}

/* Public homepage polish: one-column hero and user-focused landing layout */
.hero-public {
    grid-template-columns: 1fr;
    max-width: 900px;
    margin: 0 auto;
}

.hero-public .hero-copy {
    text-align: center;
    padding-top: clamp(26px, 4vw, 42px);
    padding-bottom: clamp(24px, 3.5vw, 38px);
}

.hero-public .kicker,
.hero-public .lead,
.hero-public .stats-strip {
    margin-left: auto;
    margin-right: auto;
}

.hero-public h1 {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    font-size: clamp(2.15rem, 5vw, 4.35rem);
}

.hero-public .lead {
    max-width: 680px;
}

.hero-public > .card {
    width: min(100%, 780px);
    justify-self: center;
}

.benefit-strip {
    max-width: 780px;
}

.benefit-strip .stat-card {
    text-align: left;
}

.benefit-strip .stat-card strong {
    font-size: clamp(1.35rem, 2.8vw, 2rem);
}

@media (max-width: 680px) {
    .hero-public .hero-copy {
        text-align: left;
    }
    .hero-public h1,
    .hero-public .lead,
    .hero-public .stats-strip {
        margin-left: 0;
        margin-right: 0;
    }
}


/* Compact public landing header */
.hero-public .stats-strip {
    margin-top: 18px;
}

.hero-public .stat-card {
    padding: 14px 16px;
    border-radius: 17px;
}

.hero-public .kicker {
    margin-bottom: 14px;
    padding: 7px 11px;
    font-size: .86rem;
}

.hero-public .lead {
    font-size: clamp(.98rem, 1.5vw, 1.08rem);
    margin-top: 14px;
}

@media (min-width: 681px) {
    .hero-public .card {
        padding: 24px 28px;
    }
}

/* 2026-07 stats/token fix: tighter public header and compact analytics hero */
.hero-public {
    max-width: 820px;
    gap: 18px;
}

.hero-public .hero-copy {
    padding: clamp(20px, 3vw, 30px);
}

.hero-public h1 {
    max-width: 760px;
    font-size: clamp(1.95rem, 4.2vw, 3.45rem);
}

.hero-public .lead {
    max-width: 620px;
}

.hero-public .benefit-strip {
    max-width: 720px;
    gap: 10px;
}

.hero-public .benefit-strip .stat-card {
    padding: 12px 14px;
    min-height: 82px;
}

.hero-copy--compact {
    padding: clamp(22px, 3vw, 34px);
}

.hero-copy--compact h1 {
    font-size: clamp(2.1rem, 5vw, 4.35rem);
}

@media (max-width: 760px) {
    .hero-public .benefit-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Final polish: analytics rows should never overlap with long labels/referrers */
.grid-3 .bar-row {
    grid-template-columns: minmax(0, 1fr) minmax(76px, 120px) max-content;
}
.bar-row > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bar-row > .code-pill {
    width: max-content;
    max-width: 100%;
}
.bar-row > b {
    min-width: 22px;
    text-align: right;
    white-space: nowrap;
}

.check-row {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-soft);
    color: var(--text);
}
.check-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.public-share-card {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
}
.public-share-title {
    align-items: flex-start;
}
.public-share-title p {
    max-width: 720px;
}
.share-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.share-button {
    position: relative;
    overflow: hidden;
    min-height: 72px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 20px;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 16px 42px rgba(0,0,0,.18);
    transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
}
.share-button::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,.28), transparent 42%, rgba(255,255,255,.12));
    opacity: .62;
    pointer-events: none;
}
.share-button:hover {
    transform: translateY(-3px);
    filter: saturate(1.08) brightness(1.05);
    box-shadow: var(--glow);
}
.share-button span,
.share-button b {
    position: relative;
    z-index: 1;
}
.share-button span {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: inline-grid;
    place-items: center;
    background: rgba(255,255,255,.18);
    font-size: 1rem;
}
.share-telegram { background: linear-gradient(135deg, #229ed9, #0f6fa7); }
.share-whatsapp { background: linear-gradient(135deg, #25d366, #128c4a); }
.share-vk { background: linear-gradient(135deg, #4c75a3, #2d5d95); }
.share-copy { background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.decoder-card {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(6,182,212,.12), rgba(139,92,246,.12));
    border: 1px solid rgba(139,92,246,.24);
}
.decoder-card strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 4px;
}
.decoder-card p {
    margin: 0;
    color: var(--muted);
}

@media (max-width: 760px) {
    .share-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .decoder-card {
        align-items: flex-start;
        flex-direction: column;
    }
    .decoder-card .btn {
        width: 100%;
    }
}

@media (max-width: 680px) {
    .grid-3 .bar-row {
        grid-template-columns: minmax(0, 1fr) minmax(64px, 96px) max-content;
        gap: 8px;
    }
    .share-button {
        min-height: 64px;
        border-radius: 18px;
    }
}
