:root {
    --bg: #f4f7fb;
    --bg-soft: #ffffff;
    --text: #101626;
    --muted: #5f6b85;
    --border: rgba(16, 22, 38, 0.12);
    --card: rgba(255, 255, 255, 0.8);
    --shadow: 0 20px 60px rgba(16, 22, 38, 0.08);
    --accent: #2563eb;
    --accent-2: #38bdf8;
    --icon-color: #0f172a;
    --danger: #ef4444;
    --ok: #22c55e;
}

html[data-theme='dark'] {
    --bg: #070b14;
    --bg-soft: #0d1425;
    --text: #ecf2ff;
    --muted: #9cb0d4;
    --border: rgba(148, 163, 184, 0.18);
    --card: rgba(14, 22, 40, 0.72);
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    --accent: #3b82f6;
    --accent-2: #38bdf8;
    --icon-color: #60a5fa;
    --danger: #fb7185;
    --ok: #34d399;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: Inter, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100%;
}

body {
    position: relative;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select {
    font: inherit;
}

.bg-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    width: 340px;
    height: 340px;
    border-radius: 999px;
    filter: blur(24px);
    opacity: 0.22;
    animation: float 12s ease-in-out infinite;
}

.orb-1 {
    top: -80px;
    left: -80px;
    background: var(--accent);
}

.orb-2 {
    top: 20%;
    right: -110px;
    background: #8b5cf6;
    animation-delay: -3s;
}

.orb-3 {
    bottom: -120px;
    left: 28%;
    background: var(--accent-2);
    animation-delay: -6s;
}

@keyframes float {
    0%, 100% { transform: translate3d(0,0,0) scale(1); }
    50% { transform: translate3d(0,-18px,0) scale(1.04); }
}

.glass {
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    border-radius: 20px;
}

.topbar {
    position: sticky;
    top: 16px;
    z-index: 30;
    margin: 16px auto 0;
    width: min(1200px, calc(100% - 24px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--muted);
}

.nav-links a:hover {
    color: var(--text);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    color: var(--muted);
    background: var(--bg-soft);
}

.lang-switch span {
    font-size: 12px;
    white-space: nowrap;
}

.lang-switch select {
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    border-radius: 10px;
    padding: 6px 8px;
    min-width: 110px;
}

@media (max-width: 980px) {
    .lang-switch span { display: none; }
    .lang-switch select { min-width: 84px; }
}

.icon-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--icon-color);
    cursor: pointer;
    transition: transform .2s ease, border-color .2s ease;
}

.icon-btn:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
}

.icon-btn .icon {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 18px;
    transition: opacity .25s ease, transform .25s ease;
}

html[data-theme='dark'] .icon-btn .icon-sun {
    opacity: 0;
    transform: rotate(40deg) scale(.8);
}

html[data-theme='dark'] .icon-btn .icon-moon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

html[data-theme='light'] .icon-btn .icon-sun {
    opacity: 1;
    transform: rotate(0) scale(1);
}

html[data-theme='light'] .icon-btn .icon-moon {
    opacity: 0;
    transform: rotate(-40deg) scale(.8);
}

.btn {
    border: none;
    border-radius: 14px;
    padding: 11px 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    color: white;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 10px 26px rgba(59, 130, 246, 0.28);
}

.btn-soft {
    color: var(--text);
    background: transparent;
    border: 1px solid var(--border);
}

.btn-full {
    width: 100%;
}

.page-wrap {
    min-width: 0;
    position: relative;
    z-index: 1;
    width: min(1200px, calc(100% - 24px));
    margin: 18px auto 28px;
    display: grid;
    gap: 18px;
}

.hero {
    padding: 22px;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 18px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 7px 12px;
    color: var(--muted);
    margin-bottom: 10px;
    width: fit-content;
    background: rgba(255,255,255,.04);
}

.badge-ok {
    color: #fff;
    background: linear-gradient(135deg, rgba(34,197,94,.9), rgba(16,185,129,.9));
    border-color: transparent;
}

.badge-danger {
    color: #fff;
    background: linear-gradient(135deg, rgba(239,68,68,.95), rgba(244,63,94,.95));
    border-color: transparent;
}

.hero h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 44px);
    line-height: 1.05;
}

.hero p {
    color: var(--muted);
    font-size: 15px;
    margin: 12px 0 0;
    max-width: 640px;
}

.hero-actions {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.hero-cards {
    display: grid;
    gap: 10px;
    align-content: start;
}

.stat-card {
    padding: 14px;
    display: grid;
    gap: 6px;
}

.stat-card span {
    color: var(--muted);
    font-size: 13px;
}

.stat-card strong {
    font-size: 14px;
}

.section {
    display: grid;
    gap: 12px;
}

.section-head h1,
.section-head h2,
.section-head h3 {
    margin: 0;
}

.section-head p {
    margin: 4px 0 0;
    color: var(--muted);
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.video-card {
    padding: 8px;
    border-radius: 18px;
    overflow: hidden;
}

.video-card iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border: 0;
    border-radius: 14px;
    display: block;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.product-card {
    padding: 14px;
    display: grid;
    gap: 14px;
}

.lift {
    transition: transform .22s ease, border-color .22s ease;
}

.lift:hover {
    transform: translateY(-4px);
    border-color: rgba(59, 130, 246, 0.42);
}

.product-top {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
}

.product-icon {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(59,130,246,.16);
    color: var(--icon-color);
    font-size: 18px;
}

.product-card h3 {
    margin: 0;
    font-size: 16px;
}

.product-card p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.price {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.product-actions {
    margin-top: auto;
}

.footer {
    position: relative;
    z-index: 1;
    width: min(1200px, calc(100% - 24px));
    margin: 0 auto 18px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
}

.footer-links {
    display: flex;
    gap: 14px;
}

.footer-links a:hover {
    color: var(--text);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.5);
    display: grid;
    place-items: center;
    padding: 16px;
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    width: min(520px, 100%);
    max-height: calc(100dvh - 32px);
    overflow: auto;
    padding: 18px;
    position: relative;
    transform: translateY(14px) scale(.98);
    opacity: 0;
    transition: transform .22s ease, opacity .22s ease;
}

.modal-overlay.open .modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal-xl {
    width: min(960px, 100%);
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 20px;
}

.auth-modal {
    width: min(460px, 100%);
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.auth-tab {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    border-radius: 12px;
    padding: 10px 12px;
    cursor: pointer;
    font-weight: 600;
}

.auth-tab.active {
    background: rgba(59,130,246,.14);
    border-color: rgba(59,130,246,.35);
    color: var(--icon-color);
}

.auth-panels {
    position: relative;
}

.auth-panel {
    display: none;
    gap: 10px;
}

.auth-panel.active {
    display: grid;
    animation: fadeUp .2s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
}

input, select {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text);
    padding: 12px 12px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

input:focus, select:focus {
    border-color: rgba(59,130,246,.55);
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}

#toastHost {
    position: fixed;
    top: 82px;
    right: 12px;
    z-index: 80;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100% - 24px));
}

.toast {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card);
    box-shadow: var(--shadow);
    color: var(--text);
    animation: toastIn .2s ease;
}

.toast.ok {
    border-color: rgba(52,211,153,.36);
}

.toast.error {
    border-color: rgba(251,113,133,.36);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.reveal {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .45s ease, transform .45s ease;
}

.reveal.show {
    opacity: 1;
    transform: translateY(0);
}

.profile-grid {
    display: grid;
    grid-template-columns: 1.3fr .7fr;
    gap: 12px;
}

.panel {
    padding: 16px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.panel-head h2,
.panel h3,
.panel h1 {
    margin: 0;
}

.kv-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.kv {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px;
    display: grid;
    gap: 4px;
    background: rgba(255,255,255,.02);
}

.kv span {
    color: var(--muted);
    font-size: 12px;
}

.kv strong {
    font-size: 14px;
    overflow-wrap: anywhere;
}

.row-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stack-form {
    display: grid;
    gap: 10px;
}

.table-wrap {
    overflow: auto;
    border-radius: 18px;
}

.table-wrap table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.table-wrap th,
.table-wrap td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
    font-size: 14px;
}

.table-wrap thead th {
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
    background: rgba(255,255,255,.02);
    position: sticky;
    top: 0;
}

.table-wrap tbody tr:hover {
    background: rgba(59,130,246,.05);
}

.table-input {
    min-width: 120px;
    padding: 8px 10px;
    border-radius: 10px;
}

.empty-state {
    border: 1px dashed var(--border);
    border-radius: 16px;
    padding: 18px;
    color: var(--muted);
    text-align: center;
}

.hidden {
    display: none !important;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.stat-mini {
    padding: 12px;
    display: grid;
    gap: 4px;
}

.stat-mini span {
    color: var(--muted);
    font-size: 12px;
}

.stat-mini strong {
    font-size: 18px;
}

.chart-card {
    padding: 12px;
}

.chart-card canvas {
    width: 100% !important;
    height: 320px !important;
}

.promo-list-wrap {
    padding: 12px;
    margin-bottom: 12px;
}

.promo-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.promo-chip {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--muted);
}

.muted {
    color: var(--muted);
    margin-top: 8px;
    font-size: 13px;
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.inline-check input {
    width: auto;
}

.result-box {
    margin-top: 10px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 10px;
    display: grid;
    gap: 6px;
    color: var(--muted);
    max-height: 200px;
    overflow: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.center-text {
    text-align: center;
    display: grid;
    gap: 10px;
    justify-items: center;
}

.center-text h1 {
    font-size: 56px;
    margin: 0;
}

.prose p {
    color: var(--muted);
    line-height: 1.55;
}

@media (max-width: 980px) {
    .hero,
    .profile-grid,
    .admin-grid {
        grid-template-columns: 1fr;
    }
    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .stats-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .topbar {
        top: 8px;
    }
}

@media (max-width: 720px) {
    .nav-links {
        display: none;
    }
    .video-grid,
    .product-grid,
    .kv-grid,
    .stats-row {
        grid-template-columns: 1fr;
    }
    .footer {
        flex-direction: column;
        align-items: flex-start;
    }
    .topbar {
        flex-wrap: wrap;
    }
}


.brand, .brand > span, .hero-copy, .hero, .panel, .product-card, .section-head, .topbar-actions { min-width: 0; }
.topbar-actions .btn { white-space: nowrap; }
.table-wrap { -webkit-overflow-scrolling: touch; }
@media (max-width: 980px) {
    .topbar { align-items: flex-start; }
    .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
    .topbar-actions .btn { padding-inline: 12px; }
    .hero { padding: 18px; }
}
@media (max-width: 720px) {
    .topbar { gap: 10px; padding: 10px; }
    .brand { width: 100%; }
    .topbar-actions { width: 100%; gap: 8px; display: grid; grid-template-columns: 1fr 44px; align-items: stretch; }
    .topbar-actions .lang-switch { grid-column: 1 / -1; width: 100%; }
    .topbar-actions .btn { width: 100%; }
    .topbar-actions #logoutBtn { grid-column: 1 / 2; }
    .topbar-actions #themeToggle { grid-column: 2 / 3; justify-self: end; }
    .hero h1 { line-height: 1.12; }
    .hero-actions .btn { width: 100%; }
    .row-actions .btn { width: 100%; }
    .price { font-size: 24px; }
    .panel { padding: 14px; }
    .modal-overlay { padding: 10px; }
    .modal { padding: 14px; border-radius: 16px; }
    .table-wrap table { min-width: 640px; }
}

.notice-banner {
    margin: 12px 0 16px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(110,170,255,.25);
    background: rgba(80,120,255,.08);
    display: grid;
    gap: 4px;
}
.notice-banner strong {
    font-size: 14px;
}
.notice-banner span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}
.kv-grid-compact .kv {
    min-height: 70px;
}
