/* ===========================================================
   QRsiv.ru — stylesheet (mobile-first, responsive)
   =========================================================== */
:root {
    --indigo: #6366f1;
    --indigo-d: #4f46e5;
    --ink: #0f172a;
    --ink-2: #1e293b;
    --slate: #64748b;
    --line: #e2e8f0;
    --bg: #f8fafc;
    --white: #ffffff;
    --green: #16a34a;
    --red: #dc2626;
    --radius: 16px;
    --shadow: 0 10px 30px rgba(15, 23, 42, .08);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, .15);
    --ya: #fc3f1d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--indigo-d); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.2; }

.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 18px; }
.container.narrow { max-width: 760px; }
.muted { color: var(--slate); }
.small { font-size: 13px; }
.center { text-align: center; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
    font-weight: 600; font-size: 15px; cursor: pointer; transition: all .15s ease;
    background: var(--white); color: var(--ink); line-height: 1; text-align: center;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--indigo); color: #fff; box-shadow: 0 6px 16px rgba(99,102,241,.3); }
.btn-primary:hover { background: var(--indigo-d); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: #f1f5f9; }
.btn-danger { background: #fef2f2; color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-yandex { background: #000; color: #fff; }
.btn-yandex:hover { background: #222; }
.btn-yandex .ya-logo { background: var(--ya); color: #fff; width: 22px; height: 22px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 14px 26px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn.disabled { opacity: .45; pointer-events: none; }

/* ---------- Brand ---------- */
.brand { font-size: 24px; font-weight: 800; color: var(--ink); letter-spacing: -.5px; }
.brand span { color: var(--indigo); }
.brand:hover { text-decoration: none; }
.brand-center { display: block; text-align: center; margin-bottom: 8px; }

/* ---------- Public header/footer ---------- */
.site-header { background: rgba(255,255,255,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.nav { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a { color: var(--ink-2); font-weight: 500; }
@media (max-width: 720px) { .nav-links a:not(.btn) { display: none; } }

.site-footer { background: var(--ink); color: #cbd5e1; margin-top: 60px; padding: 44px 0 24px; }
.site-footer .brand { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 30px; }
.footer-grid h4 { color: #fff; margin-bottom: 12px; font-size: 15px; }
.footer-grid a { display: block; color: #94a3b8; margin-bottom: 8px; }
.copyright { margin-top: 30px; padding-top: 18px; border-top: 1px solid #1e293b; font-size: 13px; }
@media (max-width: 680px) { .footer-grid { grid-template-columns: 1fr; gap: 24px; } }

/* ---------- Hero ---------- */
.hero { padding: 70px 0 50px; background: radial-gradient(1200px 500px at 80% -10%, #eef2ff 0%, transparent 60%), var(--bg); }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.pill { display: inline-block; background: #eef2ff; color: var(--indigo-d); padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; margin-bottom: 18px; }
.hero h1 { font-size: 50px; letter-spacing: -1.5px; margin-bottom: 18px; }
.lead { font-size: 19px; color: var(--slate); margin-bottom: 26px; max-width: 540px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.hero-visual { display: flex; justify-content: center; }
.qr-stage { position: relative; display: inline-block; }
.hero-qr { width: min(420px, 88vw); aspect-ratio: 1; margin: 0 auto; perspective: 1600px; }
.hero-qr img, .hero-qr canvas { display: block; }
.qr3d { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; --spread: 0px; will-change: transform; }
.qr3d .mod {
    position: absolute;
    background: #0f172a;
    border-radius: 1.5px;
    transform: translateZ(calc(var(--spread) * var(--d)));
    will-change: transform;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .22);
}
.qr-badge { position: absolute; top: 6px; right: 6px; z-index: 2; background: var(--indigo); color: #fff; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; box-shadow: var(--shadow); }
@media (max-width: 880px) {
    .hero-grid { grid-template-columns: 1fr; text-align: center; }
    .hero h1 { font-size: 34px; }
    .lead { margin-left: auto; margin-right: auto; }
    .hero-cta { justify-content: center; }
}

/* ---------- Sections ---------- */
.section { padding: 60px 0; }
.section-alt { background: #fff; }
.section-title { text-align: center; font-size: 32px; margin-bottom: 40px; letter-spacing: -.5px; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 22px; transition: all .2s ease; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card-ico { font-size: 34px; margin-bottom: 12px; }
.card-ico.big { font-size: 58px; }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--slate); font-size: 15px; }
@media (max-width: 900px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .cards { grid-template-columns: 1fr; } .section-title { font-size: 26px; } }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; margin-bottom: 40px; }
.step { text-align: center; }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 50%; background: var(--indigo); color: #fff; font-weight: 800; font-size: 20px; margin-bottom: 12px; }
.step h3 { font-size: 17px; margin-bottom: 6px; }
.step p { color: var(--slate); font-size: 14px; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr 1fr; } }

/* ---------- Auth ---------- */
.auth-wrap { min-height: calc(100vh - 66px); display: flex; align-items: center; justify-content: center; padding: 40px 18px; }
.auth-card { background: #fff; width: 100%; max-width: 440px; padding: 36px 30px; border-radius: 22px; box-shadow: var(--shadow-lg); text-align: center; }
.auth-card h1 { font-size: 26px; margin: 10px 0 6px; }
.consent { display: flex; gap: 10px; text-align: left; background: #f8fafc; border: 1px solid var(--line); padding: 14px; border-radius: 12px; margin: 22px 0 16px; font-size: 14px; }
.consent input { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; }
.consent.shake { animation: shake .4s; border-color: var(--red); }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }
.auth-note { margin-top: 16px; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; font-size: 14px; text-align: left; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---------- Documents ---------- */
.doc h1 { font-size: 30px; margin-bottom: 6px; }
.doc h2 { font-size: 20px; margin: 26px 0 10px; }
.doc p, .doc li { color: var(--ink-2); }
.doc ul { padding-left: 22px; margin: 10px 0; }
.doc .back { margin-top: 30px; }

/* ---------- Centered pages (404/inactive/text) ---------- */
.center-page { min-height: 70vh; display: flex; align-items: center; }
.big-code { font-size: 90px; color: var(--indigo); }
.text-target { background: #fff; padding: 40px; border-radius: var(--radius); box-shadow: var(--shadow); }
.text-target h1 { margin-bottom: 16px; }
.text-body { font-size: 17px; color: var(--ink-2); }
.powered { margin-top: 26px; }

/* ===========================================================
   APP (cabinet + admin)
   =========================================================== */
.theme-app { background: var(--bg); }
.app-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 60; }
.app-header-inner { display: flex; align-items: center; gap: 14px; height: 60px; padding: 0 18px; max-width: 1400px; margin: 0 auto; }
.hamburger { display: none; background: none; border: none; font-size: 22px; cursor: pointer; }
.app-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.avatar.sm { width: 28px; height: 28px; }
.avatar.lg { width: 84px; height: 84px; }
.u-name { font-weight: 600; font-size: 14px; }
@media (max-width: 600px) { .u-name { display: none; } }

.app-shell { display: flex; max-width: 1400px; margin: 0 auto; min-height: calc(100vh - 60px); }
.sidebar { width: 250px; background: #fff; border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a { padding: 11px 14px; border-radius: 10px; color: var(--ink-2); font-weight: 500; font-size: 15px; }
.sidebar nav a:hover { background: #f1f5f9; text-decoration: none; }
.sidebar nav a.active { background: #eef2ff; color: var(--indigo-d); font-weight: 700; }
.sidebar-sep { font-size: 12px; text-transform: uppercase; color: var(--slate); margin: 16px 8px 6px; letter-spacing: .5px; }
.sidebar-foot { margin-top: auto; padding: 12px 14px; font-size: 14px; }
.app-main { flex: 1; padding: 28px; min-width: 0; }
@media (max-width: 860px) {
    .sidebar { position: fixed; left: -260px; top: 60px; bottom: 0; transition: left .25s ease; z-index: 70; box-shadow: var(--shadow-lg); }
    body.sidebar-open .sidebar { left: 0; }
    .hamburger { display: block; }
    .app-main { padding: 18px; }
}

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; }
.sub-h { margin: 28px 0 14px; font-size: 20px; }

/* ---------- Folder groups ---------- */
.folder-group { margin-bottom: 26px; }
.folder-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.folder-name { font-size: 16px; font-weight: 700; color: var(--ink); }
.folder-count { font-size: 12px; font-weight: 700; color: var(--slate); background: #f1f5f9; border-radius: 999px; padding: 2px 9px; }

/* ---------- QR list (cabinet) — one card per row ---------- */
.qr-grid { display: flex; flex-direction: column; gap: 14px; }
.qr-tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); display: flex; align-items: center; gap: 18px; padding: 14px 18px; transition: all .2s; }
.qr-tile:hover { box-shadow: var(--shadow); }
.qr-tile-img { width: 96px; min-width: 96px; height: 96px; display: flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.qr-tile-img img, .qr-tile-img canvas { width: 78px !important; height: 78px !important; }
.qr-tile-info { flex: 1; min-width: 0; }
.qr-tile-top { display: flex; align-items: center; gap: 10px; }
.qr-tile-top h3 { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-short { font-family: monospace; font-size: 13px; display: inline-block; margin-top: 6px; word-break: break-all; }
.qr-tile-meta { display: flex; gap: 22px; font-size: 14px; color: var(--slate); white-space: nowrap; }
.qr-tile-actions { flex-shrink: 0; }
@media (max-width: 640px) {
    .qr-tile { flex-wrap: wrap; gap: 12px 14px; }
    .qr-tile-info { flex-basis: calc(100% - 114px); }
    .qr-tile-meta { gap: 18px; width: 100%; justify-content: flex-start; }
    .qr-tile-actions { width: 100%; }
    .qr-tile-actions .btn { width: 100%; }
}

/* badges */
.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge-url { background: #eff6ff; color: #1d4ed8; }
.badge-text { background: #fefce8; color: #a16207; }
.badge-minisite { background: #f0fdf4; color: #15803d; }
.badge-admin { background: #eef2ff; color: var(--indigo-d); }
.badge-danger { background: #fef2f2; color: var(--red); }

/* empty state */
.empty { text-align: center; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 60px 20px; }
.empty h2 { margin: 10px 0 8px; }
.empty p { margin-bottom: 20px; }

/* ---------- Forms ---------- */
.form-layout { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
@media (max-width: 900px) { .form-layout { grid-template-columns: 1fr; } }
.card-block { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field input[type=text], .field input[type=url], .field textarea, .field select, .search-bar input {
    width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; font-family: inherit; background: #fff;
}
.field select { cursor: pointer; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%2364748b' d='M6 8 0 0h12z'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.field input[type=color] { width: 100%; height: 44px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.field input[type=file] { width: 100%; font-size: 14px; }

.slug-input { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.slug-input:focus-within { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.slug-prefix { display: flex; align-items: center; padding: 0 12px; background: #f1f5f9; color: var(--slate); font-family: monospace; font-size: 13px; white-space: nowrap; border-right: 1px solid var(--line); }
.slug-input input[type=text] { border: none !important; border-radius: 0 !important; box-shadow: none !important; flex: 1; min-width: 0; }
.field small { display: block; margin-top: 6px; font-size: 12.5px; line-height: 1.4; }
@media (max-width: 480px) { .slug-prefix { font-size: 11px; padding: 0 8px; } }

.type-switch { display: flex; gap: 10px; flex-wrap: wrap; }
.type-opt { flex: 1; min-width: 120px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; cursor: pointer; font-weight: 600; font-size: 14px; transition: all .15s; }
.type-opt input { display: none; }
.type-opt.sel { border-color: var(--indigo); background: #eef2ff; color: var(--indigo-d); }
.type-pane { display: none; padding-top: 6px; }
.subsection { font-weight: 700; margin: 20px 0 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.color-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .color-row { grid-template-columns: 1fr; } }
.link-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; margin-bottom: 8px; }
.link-row input { padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 14px; }
@media (max-width: 560px) { .link-row { grid-template-columns: 1fr 1fr auto; } }
.form-actions { margin-top: 22px; }

/* QR side panel */
.qr-side { text-align: center; position: sticky; top: 80px; }
.qr-side h3 { margin-bottom: 14px; }
.qr-preview { display: flex; justify-content: center; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; }
.qr-short-link { display: block; font-family: monospace; font-size: 13px; word-break: break-all; margin-bottom: 14px; }
.side-actions { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; flex-wrap: wrap; }
.side-stats { display: flex; gap: 10px; margin: 14px 0; }
.side-stats div { flex: 1; background: #f8fafc; border-radius: 10px; padding: 10px; }
.side-stats strong { display: block; font-size: 18px; }
.side-stats span { font-size: 12px; color: var(--slate); }
.inline-form { margin-top: 8px; }

/* ---------- Admin ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-align: center; }
.stat strong { display: block; font-size: 30px; color: var(--indigo-d); }
.stat span { font-size: 13px; color: var(--slate); }
@media (max-width: 620px) { .stat-row { grid-template-columns: 1fr 1fr; } }

.search-bar { display: flex; gap: 8px; margin-bottom: 18px; max-width: 420px; }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.data-table th, .data-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
.data-table th { background: #f8fafc; font-size: 12px; text-transform: uppercase; color: var(--slate); letter-spacing: .4px; }
.data-table tr:last-child td { border-bottom: none; }
.cell-user { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-profile { display: flex; gap: 20px; align-items: flex-start; }
.user-profile h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
@media (max-width: 520px) { .user-profile { flex-direction: column; } }

/* ---------- Modal (rules) ---------- */
body.modal-locked { overflow: hidden; }
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.6); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 100; }
.modal { background: #fff; border-radius: 20px; max-width: 520px; width: 100%; padding: 30px; box-shadow: var(--shadow-lg); max-height: 92vh; overflow-y: auto; }
.modal h2 { margin-bottom: 6px; }
.modal-body { margin: 18px 0; }
.modal-body ul { padding-left: 20px; margin-bottom: 16px; }
.modal-body li { margin-bottom: 8px; color: var(--ink-2); font-size: 14px; }
.modal-decline { display: block; text-align: center; margin-top: 14px; }

/* ---------- Blog ---------- */
.blog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 900px) { .blog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .blog-grid { grid-template-columns: 1fr; } }
.blog-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: all .2s; color: inherit; }
.blog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); text-decoration: none; }
.blog-card-cover { height: 170px; background-size: cover; background-position: center; background-color: #eef2ff; }
.blog-card-cover--empty { display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 800; color: var(--ink); }
.blog-card-cover--empty span { color: var(--indigo); }
.blog-card-body { padding: 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.blog-card-body h2 { font-size: 19px; }
.blog-card-body p { font-size: 14px; flex: 1; }
.blog-date { font-size: 12px; color: var(--slate); }

.article-title { font-size: 34px; margin: 18px 0 6px; letter-spacing: -.5px; }
.article-cover { width: 100%; border-radius: var(--radius); margin: 18px 0; }
.article-body { font-size: 17px; line-height: 1.75; color: var(--ink-2); }
.article-body h2 { font-size: 24px; margin: 26px 0 10px; }
.article-body h3 { font-size: 20px; margin: 22px 0 8px; }
.article-body p { margin-bottom: 16px; }
.article-body ul, .article-body ol { margin: 0 0 16px 22px; }
.article-body li { margin-bottom: 6px; }
.article-body img { max-width: 100%; border-radius: 12px; margin: 10px 0; }
.article-body a { color: var(--indigo-d); text-decoration: underline; }
.article-body blockquote { border-left: 3px solid var(--indigo); padding-left: 16px; color: var(--slate); margin: 0 0 16px; }

textarea.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 13px; line-height: 1.5; }
