[data-theme="matrix"] {
    --primary: #00ff00;
    --secondary: #00ffff;
    --danger: #ff3333;
    --bg: #0a0a0a;
    --glow: 0 0 10px rgba(0, 255, 0, 0.4);
    --canvas-color: #00ff00;
}
[data-theme="amber"] {
    --primary: #ffb000;
    --secondary: #ffdd66;
    --danger: #ff4400;
    --glow: 0 0 10px rgba(255, 176, 0, 0.4);
    --canvas-color: #ffb000;
}
[data-theme="ice"] {
    --primary: #6ec8ff;
    --secondary: #a8e6ff;
    --danger: #ff6688;
    --glow: 0 0 10px rgba(110, 200, 255, 0.4);
    --canvas-color: #6ec8ff;
}

html {
    --border-dim: color-mix(in srgb, var(--primary) 22%, transparent);
    --border-faint: color-mix(in srgb, var(--primary) 12%, transparent);
    --fill-soft: color-mix(in srgb, var(--primary) 6%, transparent);
    --fill-hover: color-mix(in srgb, var(--primary) 9%, transparent);
    --fill-strong: color-mix(in srgb, var(--primary) 12%, transparent);
}

* { box-sizing: border-box; }
body {
    font-family: 'JetBrains Mono', monospace;
    background: #000;
    color: var(--primary);
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
}
body.mode-login {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
body.mode-app { padding: 12px; }

#web-canvas { position: fixed; inset: 0; z-index: 1; opacity: 0.55; pointer-events: none; }
.crt-overlay {
    position: fixed; inset: 0; z-index: 999; pointer-events: none;
    background: linear-gradient(rgba(18,16,16,0) 50%, rgba(0,0,0,0.25) 50%),
        linear-gradient(90deg, rgba(255,0,0,0.05), rgba(0,255,0,0.02), rgba(0,0,255,0.05));
    background-size: 100% 2px, 3px 100%;
}

.boot-screen {
    position: fixed; inset: 0; z-index: 500; background: #000;
    display: flex; align-items: center; justify-content: center;
}
.boot-screen.hidden { display: none; }
.boot-inner {
    width: min(520px, 90vw); font-size: 0.75em; line-height: 1.6;
    border: 1px solid var(--primary); padding: 24px;
    box-shadow: var(--glow);
}
.boot-line { opacity: 0; animation: bootIn 0.2s forwards; }
@keyframes bootIn { to { opacity: 1; } }

.container {
    background: rgba(10,10,10,0.95);
    border: 1px solid var(--primary);
    border-radius: 4px;
    box-shadow: var(--glow), inset 0 0 20px rgba(0,255,0,0.06);
    padding: 32px;
    width: 100%;
    max-width: 520px;
    position: relative;
    z-index: 20;
}
.accent { color: var(--secondary); }
h1, h2 { text-transform: uppercase; letter-spacing: 2px; text-shadow: var(--glow); margin-top: 0; }
h1 { font-size: 1.4em; border-bottom: 1px solid var(--primary); padding-bottom: 12px; }
.ip-warn { font-size: 0.8em; color: var(--danger); }
.ip-meta { font-size: 0.7em; opacity: 0.7; }
.hint { font-size: 0.7em; opacity: 0.8; }
.hint code { color: var(--secondary); }

.login-form { text-align: left; }
.login-label { display: block; margin-bottom: 10px; font-size: 0.8em; }
.login-form input[type="password"] {
    width: 100%; background: #000; border: 1px solid var(--primary);
    color: var(--primary); padding: 14px; text-align: center;
    font-family: inherit; margin-bottom: 16px; outline: none; box-sizing: border-box;
}
.login-form input[type="password"]:focus {
    border-color: var(--secondary); box-shadow: 0 0 15px rgba(0, 255, 0, 0.25);
}
.login-form button { width: 100%; }

.error-message {
    color: var(--danger); border: 1px solid var(--danger);
    padding: 12px; margin-bottom: 16px; background: rgba(255,0,0,0.08); font-size: 0.85em;
}
.msg-success { color: var(--primary) !important; border-color: var(--primary) !important; background: rgba(0,255,0,0.08) !important; }

.cli-login, .cli-panel { text-align: left; }
.cli-output {
    height: 140px; overflow-y: auto; font-size: 0.78em;
    border: 1px solid rgba(0,255,0,0.2); padding: 8px; margin-bottom: 8px;
    background: rgba(0,0,0,0.5);
}
.cli-output .line { margin: 2px 0; }
.cli-output .line.err { color: var(--danger); }
.cli-output .line.ok { color: var(--secondary); }
.cli-input-row { display: flex; align-items: center; gap: 8px; }
.prompt { color: var(--secondary); white-space: nowrap; }
.cli-input-row input {
    flex: 1; background: #000; border: 1px solid var(--primary);
    color: var(--primary); padding: 8px; font-family: inherit; outline: none;
}
.cli-input-row input:focus { border-color: var(--secondary); box-shadow: 0 0 12px rgba(0,255,255,0.2); }

.otp-step input[type="password"] {
    width: 100%; background: #000; border: 1px solid var(--primary);
    color: var(--primary); padding: 12px; text-align: center; font-family: inherit; margin-bottom: 12px;
}
button, .btn-sm {
    background: var(--primary); color: #000; border: none;
    padding: 10px 18px; font-family: inherit; font-weight: bold; cursor: pointer;
    text-transform: uppercase; font-size: 0.75em; transition: 0.2s;
}
button:hover, .btn-sm:hover { filter: brightness(1.2); box-shadow: 0 0 16px rgba(255,255,255,0.3); }
.btn-sm { padding: 6px 12px; }
.btn-danger { background: var(--danger) !important; color: #fff !important; }
.inline-form { display: inline; }

body.mode-login:has(.security-lockdown) {
    padding: 0;
    align-items: stretch;
}

.security-lockdown {
    position: fixed; inset: 0; z-index: 500;
    display: flex; justify-content: center; align-items: center;
    background: #0a0000;
    animation: lockdownPulse 2.5s ease-in-out infinite;
    text-align: center;
    padding: 24px;
    overflow: hidden;
}
.lockdown-scanlines {
    position: absolute; inset: 0; pointer-events: none; opacity: 0.35;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255, 0, 0, 0.08) 2px,
        rgba(255, 0, 0, 0.08) 4px
    );
    animation: scanlineDrift 8s linear infinite;
}
.lockdown-inner {
    position: relative; z-index: 1;
    max-width: 560px; width: 100%;
    border: 2px solid var(--danger);
    padding: 36px 28px;
    background: rgba(0, 0, 0, 0.92);
    box-shadow: 0 0 40px rgba(255, 40, 40, 0.45), inset 0 0 60px rgba(255, 0, 0, 0.06);
    animation: glitchEffect 0.35s infinite alternate;
}
.lockdown-stamp {
    font-size: 0.65em; letter-spacing: 0.35em; color: #ff4444;
    border: 1px solid #ff4444; display: inline-block; padding: 4px 12px;
    margin-bottom: 20px; opacity: 0.9;
}
.lockdown-icon {
    font-size: 3.2em; color: var(--danger);
    margin-bottom: 12px;
    text-shadow: 0 0 24px rgba(255, 50, 50, 0.8);
    animation: pulse 1.2s ease-in-out infinite;
}
.lockdown-title {
    color: #ff2222; font-size: 1.35em; margin: 0 0 16px;
    letter-spacing: 0.12em; line-height: 1.35;
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.6);
}
.lockdown-lead {
    font-size: 0.82em; color: #ffaaaa; margin: 0 0 20px; line-height: 1.5;
}
.lockdown-facts {
    list-style: none; padding: 0; margin: 0 0 28px;
    font-size: 0.78em; text-align: left; color: #ff8888;
    border-left: 3px solid var(--danger);
    padding-left: 16px;
}
.lockdown-facts li { margin: 10px 0; line-height: 1.45; }
.lockdown-facts strong { color: #fff; }
.lockdown-incident {
    font-family: inherit; letter-spacing: 0.15em;
    color: var(--secondary) !important;
}
.lockdown-timer-block {
    margin: 0 0 24px; padding: 16px;
    border: 1px dashed rgba(255, 80, 80, 0.5);
    background: rgba(255, 0, 0, 0.06);
}
.lockdown-timer-label {
    display: block; font-size: 0.72em; color: #ff6666;
    text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px;
}
.lockdown-timer-digits {
    font-size: 2.8em; font-weight: bold; color: #fff;
    line-height: 1;
}
.lockdown-timer-digits #lockoutTimer {
    color: var(--danger);
    text-shadow: 0 0 16px rgba(255, 0, 0, 0.9);
}
.lockdown-timer-unit { font-size: 0.35em; color: #ff8888; margin-left: 4px; }
.lockdown-phone {
    font-size: 0.85em; color: var(--secondary); margin: 0 0 16px;
}
.lockdown-legal {
    font-size: 0.65em; opacity: 0.55; margin: 0; line-height: 1.5; color: #aa6666;
}

.danger-text { color: var(--danger); }

.unlock-animation {
    position: fixed; inset: 0; background: #000; z-index: 200;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.scan-bar { width: 300px; height: 2px; background: #333; position: relative; overflow: hidden; margin: 16px 0; }
.scan-line { position: absolute; width: 50px; height: 100%; background: var(--primary); animation: scan 1.5s infinite; }
.grant-title { opacity: 0; color: var(--secondary); transition: opacity 0.5s; }
.grant-title.visible { opacity: 1; }

.app-shell {
    position: relative; z-index: 20; flex-direction: column;
    max-width: 1200px; margin: 0 auto; width: 100%;
    background: rgba(10,10,10,0.92); border: 1px solid var(--primary);
    padding: 16px; box-shadow: var(--glow);
}
.app-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.app-header h2 { font-size: 1em; color: var(--secondary); border: none; margin: 0; }
.header-actions { display: flex; gap: 8px; align-items: center; }
#themeSelect {
    background: #000; color: var(--primary); border: 1px solid var(--primary);
    font-family: inherit; padding: 6px;
}

.session-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
    margin: 12px 0; font-size: 0.8em;
}
.session-progress-wrap {
    flex: 1; min-width: 120px; height: 8px; background: #222; border: 1px solid var(--primary);
}
.session-progress {
    height: 100%; width: 100%; background: var(--primary);
    transition: width 1s linear, background 0.3s;
}
.session-progress.warn { background: #cccc00; }
.session-progress.panic { background: var(--danger); animation: pulse 0.5s infinite; }

.path-navigation { font-size: 0.8em; color: var(--secondary); margin-bottom: 8px; }
.path-navigation a { color: var(--primary); text-decoration: none; font-weight: bold; }

.workspace { display: grid; grid-template-columns: 1fr 280px; gap: 16px; }
.workspace-files-only { grid-template-columns: 1fr; }
@media (max-width: 900px) { .workspace { grid-template-columns: 1fr; } }

.file-toolbar {
    display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 0.8em;
}
.file-toolbar-label { color: var(--secondary); }
.view-switch {
    display: inline-flex; border: 1px solid var(--primary); border-radius: 3px; overflow: hidden;
}
.view-btn {
    background: transparent; color: var(--primary); border: none; padding: 6px 12px;
    cursor: pointer; font-size: 0.9em; line-height: 1;
}
.view-btn:hover { background: var(--fill-strong); }
.view-btn.active { background: var(--primary); color: #000; }

.file-list-header {
    display: none;
    grid-template-columns: 36px 1fr 72px minmax(140px, auto);
    gap: 8px; align-items: center;
    padding: 6px 10px; font-size: 0.7em;
    color: var(--primary);
    opacity: 0.85;
    border: 1px solid var(--border-dim);
    border-bottom: none;
    background: var(--fill-soft);
}
.file-browser.mode-list .file-list-header { display: grid; }

.file-grid {
    max-height: 420px; overflow-y: auto;
}
.file-browser.mode-list .file-grid.view-list {
    border: 1px solid var(--border-dim);
    border-top: none;
}

/* —— Вид: список (по умолчанию) —— */
.file-grid.view-list {
    display: flex; flex-direction: column; gap: 0;
}
.file-grid.view-list .file-card {
    flex-direction: row; align-items: center; min-height: 0;
    border: none; border-bottom: 1px solid var(--border-faint);
    border-radius: 0;
}
.file-grid.view-list .file-card:last-child { border-bottom: none; }
.file-grid.view-list .file-card:hover {
    background: var(--fill-hover); transform: none;
}
.file-grid.view-list .card-body {
    flex: 1; display: grid;
    grid-template-columns: 36px 1fr 72px;
    align-items: center; gap: 8px; padding: 8px 10px;
}
.file-grid.view-list .card-icon { margin: 0; font-size: 1.1em; text-align: center; }
.file-grid.view-list .card-name { margin: 0; word-break: break-word; }
.file-grid.view-list .card-meta {
    font-size: 0.75em; opacity: 0.75; text-align: right;
}
.file-grid.view-list .card-snippet,
.file-grid.view-list .card-hint,
.file-grid.view-list .card-badge { display: none !important; }
.file-grid.view-list .card-actions {
    flex-shrink: 0; margin: 0; padding: 6px 10px;
    border: none; border-left: 1px solid var(--border-faint);
    background: transparent; flex-wrap: nowrap;
}
.file-grid.view-list .file-card.is-up .card-body {
    grid-template-columns: 36px 1fr;
}
.file-grid.view-list .file-card.is-up .card-meta { display: none; }

/* —— Вид: плитки —— */
.file-grid.view-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px; padding: 10px; border: 1px solid var(--border-dim);
}
.file-grid.view-grid .file-card {
    border: 1px solid var(--border-dim); border-radius: 0;
    flex-direction: column; min-height: 120px;
}
.file-grid.view-grid .file-card:hover {
    border-color: var(--primary); transform: translateY(-1px);
}
.file-grid.view-grid .card-body { display: block; padding: 12px 12px 4px; }
.file-grid.view-grid .card-hint {
    display: block; font-size: 0.65em; opacity: 0.55; margin-top: 6px; color: var(--secondary);
}
.file-grid.view-grid .card-actions {
    border-top: 1px solid var(--border-faint); background: rgba(0,0,0,0.35);
}

.file-card {
    transition: 0.2s; cursor: pointer; position: relative;
    display: flex;
}
.file-card.is-up { border-style: dashed; }
.file-card.is-dir .card-icon { color: var(--secondary); }
.card-icon { font-size: 1.5em; margin-bottom: 6px; }
.card-name { font-size: 0.85em; word-break: break-all; font-weight: bold; }
.card-badge {
    position: absolute; top: 8px; right: 8px; font-size: 0.6em;
    background: var(--danger); color: #fff; padding: 2px 6px;
}
.card-meta { font-size: 0.65em; opacity: 0.7; }
.card-snippet { font-size: 0.65em; opacity: 0.6; margin-top: 4px; height: 2.4em; overflow: hidden; }
.card-actions {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.card-actions button, .card-actions a {
    font-size: 0.6em; padding: 4px 8px; background: transparent;
    border: 1px solid var(--primary); color: var(--primary); text-decoration: none;
}
.card-actions button:hover, .card-actions a:hover { background: var(--primary); color: #000; }

/* QR: доступ открыт (общий или по ссылке) */
.card-qr.is-active {
    position: relative;
    background: var(--primary) !important;
    color: #000 !important;
    border-color: var(--primary) !important;
    font-weight: 700;
    letter-spacing: 0.04em;
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--primary) 70%, #fff),
        0 0 14px color-mix(in srgb, var(--primary) 75%, transparent),
        0 0 28px color-mix(in srgb, var(--primary) 45%, transparent),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    animation: qr-btn-open-glow 2s ease-in-out infinite;
}
.card-qr.is-active::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--secondary);
    box-shadow: 0 0 8px var(--secondary);
}
.card-qr.is-active:hover {
    background: var(--primary) !important;
    color: #000 !important;
    filter: brightness(1.12);
}
@keyframes qr-btn-open-glow {
    0%, 100% {
        box-shadow:
            0 0 0 1px color-mix(in srgb, var(--primary) 70%, #fff),
            0 0 12px color-mix(in srgb, var(--primary) 65%, transparent),
            0 0 22px color-mix(in srgb, var(--primary) 38%, transparent),
            inset 0 1px 0 rgba(255, 255, 255, 0.25);
    }
    50% {
        box-shadow:
            0 0 0 1px color-mix(in srgb, var(--primary) 85%, #fff),
            0 0 20px color-mix(in srgb, var(--primary) 90%, transparent),
            0 0 36px color-mix(in srgb, var(--primary) 55%, transparent),
            inset 0 1px 0 rgba(255, 255, 255, 0.35);
    }
}

.login-public-link {
    margin-top: 20px; text-align: center; font-size: 0.8em;
}
.login-public-link a {
    color: var(--secondary); text-decoration: none;
    border-bottom: 1px dotted var(--secondary);
}
.login-public-link a:hover { color: var(--primary); border-color: var(--primary); }

.guest-error-panel { text-align: center; max-width: 560px; }
.guest-error-icon {
    font-size: 2.8em;
    color: var(--danger);
    margin: 8px 0 20px;
    text-shadow: 0 0 12px rgba(255, 51, 51, 0.35);
}
.guest-error-message { text-align: left; line-height: 1.5; }
.guest-error-hint {
    font-size: 0.8em;
    opacity: 0.85;
    line-height: 1.45;
    margin: 0 0 20px;
    text-align: left;
}
.guest-error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 16px;
}
.guest-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.75em;
    font-family: inherit;
    text-decoration: none;
    border: 1px solid var(--primary);
    color: var(--primary);
    background: transparent;
    transition: 0.2s;
}
.guest-btn:hover {
    background: var(--primary);
    color: #000;
}
.guest-btn-secondary {
    border-color: var(--secondary);
    color: var(--secondary);
}
.guest-btn-secondary:hover {
    background: var(--secondary);
    color: #000;
}
.guest-error-phone {
    font-size: 0.8em;
    margin: 12px 0 8px;
    opacity: 0.9;
}
.guest-error-meta { margin-top: 8px; }

.public-files-panel { max-width: min(920px, 96vw); width: 100%; }
.public-file-browser { margin-top: 12px; text-align: left; }
.public-path-nav {
    margin: 12px 0;
    font-size: 0.75em;
    word-break: break-all;
}
.public-path-nav a { color: var(--secondary); text-decoration: none; }
.public-path-nav a:hover { color: var(--primary); }
.public-back { font-size: 0.8em; margin: 0 0 16px; }
.public-back a { color: var(--secondary); text-decoration: none; }
.public-back a:hover { color: var(--primary); }
.public-empty { font-size: 0.85em; opacity: 0.75; }

.public-flat-list {
    list-style: none; margin: 0; padding: 0;
    border: 1px solid var(--border-faint);
    max-height: 60vh; overflow-y: auto;
}
.public-flat-item {
    display: grid;
    grid-template-columns: 1fr auto 36px;
    gap: 10px; align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-faint);
    font-size: 0.8em;
}
.public-flat-item:last-child { border-bottom: none; }
.public-file-label {
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
}
.public-file-size { opacity: 0.65; white-space: nowrap; font-size: 0.9em; }
.public-file-dl {
    color: var(--primary); text-align: center;
    border: 1px solid var(--border-dim); padding: 6px 8px;
    text-decoration: none;
}
.public-file-dl:hover { background: var(--primary); color: #000; }

/* —— QR / доступ: модальное окно —— */
.qr-modal-overlay {
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
}
.qr-modal-overlay .qr-modal {
    width: min(520px, 94vw);
    max-height: 90vh;
    border: 1px solid var(--border-dim);
    border-radius: 4px;
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--secondary) 25%, transparent),
        0 24px 48px rgba(0, 0, 0, 0.65),
        var(--glow);
    overflow: hidden;
    animation: qrModalIn 0.28s ease-out;
}
@keyframes qrModalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.qr-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 14px;
    border-bottom: 1px solid var(--border-faint);
    background: linear-gradient(180deg, var(--fill-soft) 0%, transparent 100%);
}
.qr-modal-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.65em;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--secondary);
    opacity: 0.9;
}
.qr-modal-title {
    margin: 6px 0 0;
    font-size: 0.82em;
    font-weight: 700;
    line-height: 1.35;
    word-break: break-word;
    color: var(--primary);
}
.qr-modal-close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-dim);
    color: var(--danger);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.qr-modal-close:hover {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    border-color: var(--danger);
}

.qr-modal-body {
    padding: 14px 16px 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.qr-panel {
    border: 1px solid var(--border-faint);
    background: color-mix(in srgb, var(--bg) 40%, #000);
    padding: 10px;
}
.qr-panel-options { padding: 8px; }

.qr-option {
    display: block;
    margin: 0;
    cursor: pointer;
}
.qr-option + .qr-option,
.qr-link-block .qr-option { margin-top: 6px; }
.qr-option-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.qr-option-box {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 12px 12px 10px;
    border: 1px solid transparent;
    transition: border-color 0.15s, background 0.15s;
}
.qr-option:hover .qr-option-box {
    background: var(--fill-hover);
    border-color: var(--border-faint);
}
.qr-option-input:focus-visible + .qr-option-box {
    outline: 1px solid var(--secondary);
    outline-offset: 2px;
}
.qr-option-input:checked + .qr-option-box {
    background: var(--fill-strong);
    border-color: color-mix(in srgb, var(--primary) 35%, transparent);
    box-shadow: inset 0 0 24px var(--fill-soft);
}
.qr-option-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95em;
    color: var(--secondary);
    border: 1px solid var(--border-faint);
    background: rgba(0, 0, 0, 0.4);
}
.qr-option-input:checked + .qr-option-box .qr-option-icon {
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 40%, transparent);
    box-shadow: var(--glow);
}
.qr-option-title {
    display: block;
    font-size: 0.8em;
    font-weight: 700;
    color: var(--primary);
}
.qr-option-desc {
    display: block;
    margin-top: 3px;
    font-size: 0.68em;
    line-height: 1.4;
    color: color-mix(in srgb, var(--primary) 55%, transparent);
}
.qr-toggle {
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-dim);
    position: relative;
    transition: background 0.2s, border-color 0.2s;
}
.qr-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--primary) 40%, #444);
    transition: transform 0.2s, background 0.2s;
}
.qr-option-input:checked + .qr-option-box .qr-toggle {
    background: color-mix(in srgb, var(--primary) 25%, transparent);
    border-color: var(--primary);
}
.qr-option-input:checked + .qr-option-box .qr-toggle::after {
    transform: translateX(18px);
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
}

.qr-link-block { margin-top: 4px; }
.qr-limit-panel {
    margin: 4px 0 4px 48px;
    padding: 10px 12px;
    border-left: 2px solid var(--border-dim);
    background: rgba(0, 0, 0, 0.35);
    transition: opacity 0.2s;
}
.qr-limit-panel.is-muted {
    opacity: 0.38;
    pointer-events: none;
}
.qr-limit-select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.qr-limit-label {
    display: block;
    font-size: 0.65em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--secondary);
    margin-bottom: 8px;
}
.qr-limit-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.qr-limit-select {
    min-width: 108px;
    padding: 8px 28px 8px 10px;
    font-family: inherit;
    font-size: 0.75em;
    color: var(--primary);
    background: #000 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%2300ffff' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right 10px center;
    border: 1px solid var(--border-dim);
    appearance: none;
    cursor: pointer;
}
.qr-limit-select:focus { border-color: var(--secondary); outline: none; }
.qr-chip {
    display: inline-flex;
    align-items: center;
    margin: 0;
    cursor: pointer;
    font-size: 0.72em;
}
.qr-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.qr-chip span {
    padding: 7px 12px;
    border: 1px solid var(--border-dim);
    background: transparent;
    color: color-mix(in srgb, var(--primary) 70%, transparent);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.qr-chip input:checked + span {
    border-color: var(--primary);
    background: var(--fill-strong);
    color: var(--primary);
    box-shadow: var(--glow);
}

.qr-panel-share { padding: 14px; text-align: center; }
.qr-preview-wrap {
    padding: 16px;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.qr-preview-wrap.is-empty .qr-host { display: none; }
.qr-preview-wrap.is-empty::before {
    content: 'QR появится после сохранения ссылки';
    font-size: 0.7em;
    color: #666;
    max-width: 220px;
    line-height: 1.45;
}
.qr-modal .qr-host {
    min-height: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qr-modal .qr-host img { display: block; border-radius: 2px; }
.qr-status-line {
    margin: 12px 0 0;
    font-size: 0.72em;
    line-height: 1.45;
    color: color-mix(in srgb, var(--secondary) 85%, var(--primary));
    text-align: center;
}
.qr-url-row {
    display: flex;
    gap: 0;
    margin-top: 12px;
    border: 1px solid var(--border-dim);
    background: #000;
}
.qr-url-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--primary);
    font-family: inherit;
    font-size: 0.62em;
    padding: 10px 12px;
}
.qr-url-copy {
    flex-shrink: 0;
    width: 44px;
    border: none;
    border-left: 1px solid var(--border-dim);
    background: var(--fill-soft);
    color: var(--secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.qr-url-copy:hover {
    background: var(--primary);
    color: #000;
}

.qr-modal-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px 16px;
    border-top: 1px solid var(--border-faint);
    background: rgba(0, 0, 0, 0.5);
}
.qr-footer-status {
    margin: 0;
    min-height: 1em;
    font-size: 0.68em;
    text-align: center;
    color: color-mix(in srgb, var(--primary) 60%, transparent);
}
.qr-btn-primary {
    width: 100%;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 0.78em;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #000;
    background: var(--primary);
    border: 1px solid var(--primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: filter 0.15s, box-shadow 0.15s;
    box-shadow: var(--glow);
}
.qr-btn-primary:hover {
    filter: brightness(1.08);
    box-shadow: 0 0 20px color-mix(in srgb, var(--primary) 50%, transparent);
}

.share-modal .share-row {
    display: flex; align-items: flex-start; gap: 10px;
    margin: 12px 0; font-size: 0.8em; cursor: pointer;
}
.share-modal .share-row small { display: block; opacity: 0.65; font-size: 0.85em; }
.share-url-block { margin: 12px 0; }
.share-url-label { font-size: 0.7em; display: block; margin-bottom: 4px; }
.share-url-input {
    width: 100%; font-size: 0.65em; padding: 8px;
    background: #000; color: var(--primary); border: 1px solid var(--border-dim);
    margin-bottom: 8px;
}
.share-hint { font-size: 0.7em; opacity: 0.75; min-height: 1.2em; }

.cli-panel { border: 1px solid var(--secondary); display: flex; flex-direction: column; min-height: 280px; }
.cli-panel-head {
    padding: 8px; background: rgba(0,255,255,0.08);
    border-bottom: 1px solid var(--secondary); font-size: 0.75em;
}
.cli-panel .cli-output { flex: 1; height: auto; min-height: 180px; border: none; margin: 0; }

.upload-zone {
    margin-top: 12px; border: 2px dashed var(--secondary); padding: 20px;
    text-align: center; font-size: 0.8em; color: var(--secondary);
    transition: 0.2s;
}
.upload-zone.dragover { background: rgba(0,255,255,0.1); border-color: var(--primary); color: var(--primary); }

.event-log {
    margin-top: 12px; border-top: 1px solid var(--border-dim); padding-top: 8px;
}
.event-log-head { font-size: 0.75em; color: var(--secondary); margin-bottom: 6px; }
.event-log-hint { opacity: 0.55; font-size: 0.9em; }
.event-log-table { border: 1px solid var(--border-faint); }
.event-log-header,
.event-log-body .ev-row {
    display: grid;
    grid-template-columns: 130px 110px 1fr;
    gap: 8px; align-items: start;
    padding: 4px 8px;
}
.event-log-header {
    font-size: 0.68em; color: var(--primary); opacity: 0.85;
    background: var(--fill-soft);
    border-bottom: 1px solid var(--border-faint);
}
.event-log-body {
    max-height: 180px; overflow-y: auto; font-size: 0.65em;
    color: color-mix(in srgb, var(--primary) 75%, transparent);
}
.event-log-body .ev-row {
    border-bottom: 1px solid var(--border-faint);
}
.event-log-body .ev-row:last-child { border-bottom: none; }
.event-log-body .ev-row:hover { background: var(--fill-hover); }
.event-log-body .ev-col-ip { color: var(--secondary); word-break: break-all; }
.event-log-body .ev-col-action { word-break: break-word; }
.event-log-body .ev-empty { grid-column: 1 / -1; opacity: 0.6; padding: 8px; }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 1000;
    display: none; justify-content: center; align-items: center; padding: 16px;
}
.modal-overlay.visible { display: flex; }
.modal-content {
    background: #000; border: 1px solid var(--secondary);
    width: min(900px, 95vw); max-height: 85vh; display: flex; flex-direction: column;
    box-shadow: 0 0 30px rgba(0,255,255,0.15);
}
.modal-sm { width: min(420px, 95vw); }
.modal-header {
    padding: 12px; border-bottom: 1px solid var(--secondary);
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.modal-body { padding: 16px; overflow: auto; margin: 0; font-size: 0.85em; }
.modal-btn {
    background: transparent; border: 1px solid var(--secondary);
    color: var(--secondary); padding: 5px 12px; cursor: pointer; font-size: 0.75em;
}
.modal-btn-close { border-color: var(--danger); color: var(--danger); }
.search-input {
    margin: 12px; padding: 10px; background: #000; border: 1px solid var(--primary);
    color: var(--primary); font-family: inherit; width: calc(100% - 24px);
}
.search-results { list-style: none; padding: 0 12px 12px; margin: 0; max-height: 240px; overflow-y: auto; }
.search-results li { padding: 8px; border-bottom: 1px solid rgba(0,255,0,0.1); cursor: pointer; font-size: 0.8em; }
.search-results li:hover { background: rgba(0,255,0,0.08); }
.qr-host { min-height: 200px; display: flex; align-items: center; justify-content: center; padding: 12px; }
.qr-host img { display: block; margin: 0 auto; }
.qr-hint { font-size: 0.7em; opacity: 0.7; padding: 0 12px 8px; }
.qr-url { font-size: 0.6em; word-break: break-all; opacity: 0.5; padding: 0 12px 12px; text-align: center; }

.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(120px);
    background: rgba(0,0,0,0.95); border: 1px solid var(--primary); padding: 14px 24px;
    z-index: 800; transition: transform 0.3s; font-size: 0.85em;
}
.toast.visible { transform: translateX(-50%) translateY(0); }

.overlay-msg {
    position: fixed; inset: 0; z-index: 300; background: #000;
    display: none; flex-direction: column; justify-content: center; align-items: center;
    animation: glitchEffect 0.15s infinite alternate;
}
.overlay-msg.visible { display: flex; }
.overlay-msg h2 { color: var(--danger); font-size: 2em; }

/* —— Витрина скачивания по ссылке с лимитом (?t=…) —— */
body.mode-dl-landing {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 28px 16px 48px;
}
.dl-landing {
    position: relative;
    z-index: 20;
    width: min(680px, 100%);
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    animation: qrModalIn 0.35s ease-out;
}
.dl-landing-brand {
    text-align: center;
    padding: 18px 16px 14px;
    border: 1px solid var(--border-dim);
    background: linear-gradient(180deg, var(--fill-soft) 0%, rgba(0, 0, 0, 0.5) 100%);
    box-shadow: var(--glow);
}
.dl-landing-logo {
    font-size: 1.35em;
    font-weight: 700;
    letter-spacing: 0.06em;
}
.dl-landing-provider {
    margin: 10px 0 0;
    font-size: 0.78em;
    line-height: 1.45;
    color: color-mix(in srgb, var(--primary) 80%, transparent);
}
.dl-landing-org {
    margin: 6px 0 0;
    font-size: 0.72em;
    color: var(--secondary);
    letter-spacing: 0.04em;
}
.dl-landing-card {
    border: 1px solid var(--border-dim);
    background: color-mix(in srgb, var(--bg) 35%, #000);
    padding: 18px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.dl-landing-file {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 18px;
}
.dl-landing-file-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4em;
    color: var(--secondary);
    border: 1px solid var(--border-faint);
    background: rgba(0, 0, 0, 0.45);
    box-shadow: inset 0 0 20px var(--fill-soft);
}
.dl-landing-filename {
    margin: 0;
    font-size: 0.88em;
    line-height: 1.35;
    word-break: break-word;
    color: var(--primary);
}
.dl-landing-filesize {
    margin: 8px 0 0;
    font-size: 0.72em;
    opacity: 0.75;
}
.dl-landing-limits {
    padding: 14px;
    margin-bottom: 18px;
    border: 1px solid var(--border-faint);
    background: rgba(0, 0, 0, 0.4);
}
.dl-landing-limits-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.72em;
}
.dl-landing-limits-title {
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.dl-landing-limits-badge {
    padding: 4px 10px;
    border: 1px solid var(--primary);
    color: var(--primary);
    font-weight: 700;
    background: var(--fill-strong);
    box-shadow: var(--glow);
}
.dl-landing-meter {
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-faint);
    overflow: hidden;
}
.dl-landing-meter-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    box-shadow: 0 0 12px color-mix(in srgb, var(--primary) 60%, transparent);
    transition: width 0.35s ease;
}
.dl-landing-limits-hint {
    margin: 10px 0 0;
    font-size: 0.72em;
    line-height: 1.45;
    color: color-mix(in srgb, var(--primary) 70%, transparent);
}
.dl-landing-btn-dl {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 18px;
    font-family: inherit;
    font-size: 0.82em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    color: #000;
    background: var(--primary);
    border: 1px solid var(--primary);
    box-shadow: var(--glow);
    transition: filter 0.15s, transform 0.15s;
}
.dl-landing-btn-dl:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}
.dl-landing-dl-note {
    margin: 10px 0 0;
    font-size: 0.65em;
    text-align: center;
    opacity: 0.6;
}
.dl-landing-side {
    border: 1px solid var(--border-dim);
    padding: 16px;
    background: rgba(0, 0, 0, 0.55);
    text-align: center;
}
.dl-landing-side-title {
    margin: 0 0 12px;
    font-size: 0.72em;
    color: var(--secondary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.dl-landing-qr-wrap {
    padding: 14px;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
    display: inline-block;
}
.dl-landing-qr-host {
    min-height: 168px;
    min-width: 168px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dl-landing-qr-host img { display: block; }
.dl-landing-url-row { margin-top: 12px; text-align: left; }
.qr-url-copy.is-copied {
    background: var(--primary) !important;
    color: #000 !important;
}
.dl-landing-footer {
    text-align: center;
    font-size: 0.68em;
    opacity: 0.7;
    padding-top: 4px;
}
.dl-landing-phone { margin: 0 0 6px; color: var(--secondary); }
.dl-landing-meta { margin: 0; }

@media (min-width: 720px) {
    .dl-landing {
        grid-template-columns: 1fr 240px;
        grid-template-areas:
            "brand brand"
            "card side"
            "footer footer";
        gap: 16px 18px;
    }
    .dl-landing-brand { grid-area: brand; }
    .dl-landing-card { grid-area: card; }
    .dl-landing-side { grid-area: side; align-self: start; }
    .dl-landing-footer { grid-area: footer; }
}

@keyframes glitchEffect {
    0% { transform: translate(0); }
    50% { transform: translate(-2px, 1px); }
    100% { transform: translate(2px, -1px); }
}
@keyframes lockdownPulse {
    0%, 100% { background-color: #0a0000; }
    50% { background-color: #140202; }
}
@keyframes scanlineDrift {
    from { background-position: 0 0; }
    to { background-position: 0 120px; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scan { from { left: -50px; } to { left: 300px; } }
@keyframes pulse { 50% { opacity: 0.6; } }
