:root {
    --bg: #0b0f17;
    --bg-soft: #0f172a;
    --panel: #1f2937;
    --panel-2: #2a3444;
    --panel-glass: rgba(30, 41, 59, .88);
    --line: rgba(255, 255, 255, .08);
    --text: #e5e7eb;
    --muted: #94a3b8;
    --blue: #2563eb;
    --cyan: #0ea5e9;
    --green: #22c55e;
    --amber: #f59e0b;
    --red: #ef4444;
    --radius: 20px;
    --shadow: 0 24px 60px rgba(0, 0, 0, .36), inset 0 1px 0 rgba(255, 255, 255, .06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 8% 8%, rgba(37, 99, 235, .15), transparent 30%),
        radial-gradient(circle at 90% 18%, rgba(14, 165, 233, .10), transparent 26%),
        var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    min-height: 100vh;
}
a { color: inherit; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; }

.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: 270px;
    padding: 22px 16px;
    background: linear-gradient(180deg, rgba(11, 15, 23, .98), rgba(18, 24, 38, .97));
    border-right: 1px solid var(--line);
    box-shadow: 12px 0 40px rgba(0, 0, 0, .30);
    overflow-y: auto;
    transition: transform .25s ease;
}
.brand-block { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    object-fit: contain;
    padding: 5px;
    background: rgba(255,255,255,.06);
    border: 1px solid var(--line);
}
.brand-copy { min-width: 0; }
.brand-title { display: block; color: #fff; font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-subtitle { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.admin-brand {
    justify-content: center;
    min-height: 112px;
    padding: 6px 4px 24px;
}
.admin-brand .brand-logo {
    width: 215px;
    height: 92px;
    max-width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    object-fit: contain;
}
.nav-label { margin: 16px 11px 8px; color: #64748b; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.app-nav { display: grid; gap: 5px; }
.app-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 44px;
    padding: 10px 13px;
    color: #cbd5e1;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 650;
    transition: .2s ease;
}
.app-nav a::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: #475569; box-shadow: 0 0 0 4px rgba(71,85,105,.12); }
.app-nav a:hover { color: #fff; background: rgba(255,255,255,.05); transform: translateX(3px); }
.app-nav a.active { color: #fff; background: linear-gradient(135deg, rgba(37,99,235,.90), rgba(14,165,233,.75)); border-color: rgba(147,197,253,.25); box-shadow: 0 12px 26px rgba(37,99,235,.28); }
.app-nav a.active::before { background: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.16); }
.app-sidebar-footer { margin-top: 24px; padding: 14px 10px 0; border-top: 1px solid var(--line); color: #64748b; font-size: 11px; }

.app-main { width: calc(100% - 270px); margin-left: 270px; min-height: 100vh; }
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 78px;
    padding: 14px 30px;
    background: rgba(11, 15, 23, .78);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
}
.page-heading h1 { margin: 0; color: #fff; font-size: 22px; letter-spacing: -.02em; }
.page-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.mobile-menu { display: none; }
.app-content { padding: 28px 30px 46px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: grid; gap: 18px; }

.glass-card {
    background: linear-gradient(145deg, rgba(42, 52, 68, .88), rgba(31, 41, 55, .90));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.panel { padding: 22px; }
.panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.panel-title { margin: 0; color: #fff; font-size: 16px; }
.panel-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.metric-card { position: relative; min-height: 142px; padding: 21px; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; width: 120px; height: 120px; border-radius: 50%; right: -42px; top: -45px; background: rgba(37,99,235,.18); }
.metric-label { color: #a8b4c7; font-size: 12px; font-weight: 700; }
.metric-value { margin: 13px 0 5px; color: #fff; font-size: 31px; font-weight: 850; letter-spacing: -.04em; }
.metric-note { color: var(--muted); font-size: 11px; }
.metric-accent { width: 34px; height: 4px; margin-top: 14px; border-radius: 999px; background: linear-gradient(90deg, var(--blue), var(--cyan)); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 41px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #fff;
    text-decoration: none;
    font-weight: 750;
    font-size: 12px;
    cursor: pointer;
    transition: .2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: linear-gradient(135deg, var(--blue), var(--cyan)); box-shadow: 0 12px 28px rgba(37,99,235,.30); }
.btn-secondary { background: rgba(255,255,255,.06); border-color: var(--line); color: #dbeafe; }
.btn-success { background: linear-gradient(135deg, #16a34a, #22c55e); }
.btn-danger { background: rgba(239,68,68,.14); border-color: rgba(239,68,68,.25); color: #fecaca; }
.btn-warning { background: rgba(245,158,11,.14); border-color: rgba(245,158,11,.25); color: #fde68a; }
.btn-small { min-height: 34px; padding: 7px 11px; font-size: 11px; border-radius: 10px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.form-group { display: grid; gap: 7px; }
.form-group.full { grid-column: 1 / -1; }
label { color: #bfdbfe; font-size: 12px; font-weight: 700; }
input, select, textarea {
    width: 100%;
    color: var(--text);
    background: rgba(15,23,42,.72);
    border: 1px solid rgba(148,163,184,.15);
    border-radius: 12px;
    outline: none;
    padding: 12px 13px;
    transition: border .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { border-color: rgba(59,130,246,.75); box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
select option { color: #111827; background: #fff; }
textarea { resize: vertical; min-height: 110px; line-height: 1.55; }
.code-editor { min-height: 300px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; tab-size: 2; }
.help { color: var(--muted); font-size: 11px; line-height: 1.5; }

.table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--line); }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th { padding: 13px 15px; color: #93c5fd; background: rgba(15,23,42,.62); text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .09em; }
.data-table td { padding: 14px 15px; color: #dbe3ef; border-top: 1px solid var(--line); font-size: 12px; vertical-align: top; }
.data-table tr:hover td { background: rgba(255,255,255,.025); }
.table-title { color: #fff; font-weight: 750; }
.table-note { max-width: 360px; color: var(--muted); line-height: 1.45; }
.table-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.url-pill { display: inline-block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 10px; border-radius: 999px; color: #bfdbfe; background: rgba(37,99,235,.13); text-decoration: none; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-live, .badge-active, .badge-success { color: #86efac; background: rgba(34,197,94,.12); }
.badge-pending { color: #fde68a; background: rgba(245,158,11,.12); }
.badge-removed, .badge-archived, .badge-blocked, .badge-failed { color: #fca5a5; background: rgba(239,68,68,.12); }
.badge-info { color: #93c5fd; background: rgba(37,99,235,.13); }

.alert { margin-bottom: 18px; padding: 13px 15px; border-radius: 13px; border: 1px solid transparent; font-size: 12px; }
.alert-success { color: #bbf7d0; background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.20); }
.alert-error { color: #fecaca; background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.20); }
.empty-state { padding: 36px 20px; color: var(--muted); text-align: center; }

.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 18px; }
.filter-bar .form-group { min-width: 150px; flex: 1; }
.filter-bar .search-wide { min-width: 240px; flex: 2; }

.bar-chart { display: flex; align-items: end; gap: 12px; height: 190px; padding-top: 16px; }
.bar-item { display: flex; flex: 1; height: 100%; min-width: 28px; flex-direction: column; justify-content: end; align-items: center; gap: 8px; }
.bar-value { color: #cbd5e1; font-size: 10px; }
.bar-track { display: flex; align-items: end; width: 100%; height: 145px; border-radius: 9px 9px 3px 3px; background: rgba(15,23,42,.52); overflow: hidden; }
.bar-fill { width: 100%; min-height: 4px; border-radius: 9px 9px 3px 3px; background: linear-gradient(180deg, var(--cyan), var(--blue)); box-shadow: 0 0 20px rgba(37,99,235,.30); }
.bar-label { color: var(--muted); font-size: 9px; white-space: nowrap; }

.quick-list { display: grid; gap: 10px; }
.quick-item { display: flex; justify-content: space-between; gap: 16px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(15,23,42,.40); }
.quick-item-title { color: #fff; font-size: 12px; font-weight: 750; }
.quick-item-meta { margin-top: 4px; color: var(--muted); font-size: 10px; }

.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.auth-card { width: 100%; max-width: 440px; padding: 34px; }
.auth-logo { display: block; width: 76px; height: 76px; object-fit: contain; margin: 0 auto 18px; }
.auth-title { margin: 0; text-align: center; color: #fff; font-size: 25px; }
.auth-copy { margin: 8px 0 25px; text-align: center; color: var(--muted); font-size: 12px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; font-size: 11px; }
.auth-links a { color: #93c5fd; text-decoration: none; }

.public-body { background: #0b0f17; }
.public-container { width: min(1160px, calc(100% - 40px)); margin-inline: auto; }
.public-header { position: sticky; top: 0; z-index: 30; background: rgba(11,15,23,.84); border-bottom: 1px solid var(--line); backdrop-filter: blur(18px); }
.public-nav { display: flex; min-height: 78px; align-items: center; justify-content: space-between; gap: 24px; }
.public-brand { display: flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; font-weight: 850; }
.public-brand img { width: 46px; height: 46px; object-fit: contain; }
.public-links { display: flex; align-items: center; gap: 20px; }
.public-links a { color: #b9c4d4; text-decoration: none; font-size: 12px; font-weight: 700; }
.public-links a:hover { color: #fff; }
.public-hero { min-height: 590px; display: grid; place-items: center; padding: 90px 0; text-align: center; position: relative; overflow: hidden; }
.public-hero::before { content: ""; position: absolute; width: 620px; height: 620px; border-radius: 50%; background: radial-gradient(circle, rgba(37,99,235,.22), transparent 65%); pointer-events: none; }
.public-hero-content { position: relative; max-width: 820px; }
.eyebrow { display: inline-flex; padding: 7px 12px; border: 1px solid rgba(96,165,250,.24); border-radius: 999px; color: #93c5fd; background: rgba(37,99,235,.10); font-size: 10px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.public-hero h1 { margin: 22px 0 18px; color: #fff; font-size: clamp(42px, 7vw, 76px); line-height: 1.02; letter-spacing: -.055em; }
.public-hero p { max-width: 650px; margin: 0 auto 30px; color: #a9b6c8; font-size: 16px; line-height: 1.75; }
.public-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.feature-section { padding: 70px 0 100px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature-card { padding: 28px; }
.feature-number { color: #60a5fa; font-size: 11px; font-weight: 850; letter-spacing: .12em; }
.feature-card h3 { color: #fff; margin: 18px 0 10px; }
.feature-card p { color: var(--muted); margin: 0; font-size: 13px; line-height: 1.65; }
.public-footer { padding: 54px 0 25px; border-top: 1px solid var(--line); background: #080b11; }
.footer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; }
.footer-column h4 { margin: 0 0 16px; color: #fff; font-size: 13px; }
.footer-column a { display: block; margin: 9px 0; color: #8290a3; text-decoration: none; font-size: 12px; }
.footer-column a:hover { color: #fff; }
.footer-bottom { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); color: #64748b; font-size: 11px; text-align: center; }

@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 820px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.open { transform: translateX(0); }
    .app-main { width: 100%; margin-left: 0; }
    .mobile-menu { display: inline-flex; }
    .app-topbar { padding: 13px 18px; }
    .app-content { padding: 20px 16px 38px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .public-links .nav-item { display: none; }
    .feature-grid, .footer-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
    .grid-4 { grid-template-columns: 1fr; }
    .top-actions .btn-secondary { display: none; }
    .feature-grid, .footer-grid { grid-template-columns: 1fr; }
    .public-container { width: min(100% - 26px, 1160px); }
    .public-hero { min-height: 530px; padding: 70px 0; }
    .public-hero p { font-size: 14px; }
    .auth-card { padding: 25px 20px; }
    .admin-brand .brand-logo { width: 200px; height: 82px; }
}
