:root {
    --navy-950: #070714;
    --navy-900: #0b0c2a;
    --navy-800: #141bcd;
    --navy-700: #2a32e6;
    --gold-500: #ea0517;
    --gold-400: #ff3344;
    --gold-300: #ff6b78;
    --ink: #1c2430;
    --muted: #5c6b7a;
    --line: #e4e9ef;
    --bg: #f3f5f8;
    --white: #ffffff;
    --sidebar-w: 268px;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(20, 27, 205, 0.08);
    --font: "Plus Jakarta Sans", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(28, 36, 48, .35) transparent;
}
*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: rgba(28, 36, 48, .32);
    border-radius: 99px;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(28, 36, 48, .5); }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
}

a { color: var(--navy-800); text-decoration: none; }
a:hover { color: var(--gold-500); }

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-950) 100%);
    color: #d7e2ee;
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    z-index: 40;
}

.brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.brand-logo {
    display: block;
    width: auto;
    max-width: 118px;
    height: auto;
}

.brand-link {
    color: inherit;
    text-decoration: none !important;
}
.brand-link:hover { color: inherit; }

.auth-art .brand,
.public-bar .brand {
    padding: 0;
    border: 0;
}
.auth-art .brand { margin-bottom: 28px; }
.auth-art .brand-logo { max-width: 260px; }
.public-bar .brand {
    flex-direction: row;
    align-items: center;
    gap: 12px;
}
.public-bar .brand-logo { max-width: 110px; }

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(180deg, var(--navy-800), var(--gold-500));
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    letter-spacing: -.04em;
}

.brand-name {
    font-weight: 700;
    color: #fff;
    font-size: 1.05rem;
    line-height: 1.1;
}

.brand-sub {
    font-size: .7rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #8aa0b5;
}

.nav-scroll {
    overflow-y: auto;
    padding: 14px 12px 24px;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .28) transparent;
}
.nav-scroll::-webkit-scrollbar { width: 5px; }
.nav-scroll::-webkit-scrollbar-track { background: transparent; }
.nav-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .28);
    border-radius: 99px;
}

.nav-label {
    font-size: .68rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #7b92a8;
    padding: 12px 12px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    color: #c5d4e3;
    font-size: .92rem;
    margin-bottom: 2px;
}

.nav-link i { width: 18px; text-align: center; opacity: .9; }

.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,.07);
    color: #fff;
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(234,5,23,.22), rgba(255,255,255,.04));
    box-shadow: inset 3px 0 0 var(--gold-500);
}

.nav-link.disabled {
    opacity: .42;
    pointer-events: none;
}

.nav-soon {
    margin-left: auto;
    font-size: .62rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #8aa0b5;
}

.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.search-wrap {
    flex: 1;
    max-width: 460px;
    position: relative;
}

.search-wrap input {
    width: 100%;
    border: 1px solid var(--line);
    background: #f8fafc;
    border-radius: 12px;
    padding: 10px 14px 10px 40px;
    font: inherit;
    outline: none;
}

.search-wrap input:focus {
    border-color: #b9c9da;
    background: #fff;
}

.search-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #8a9aab;
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: none;
    overflow: hidden;
    z-index: 50;
}

.search-results a {
    display: block;
    padding: 10px 14px;
    border-bottom: 1px solid #f1f4f8;
    color: inherit;
}

.search-results a:hover { background: #f7f9fc; }
.search-results .meta { color: var(--muted); font-size: .8rem; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.context-pill {
    background: #fff8e6;
    color: #8a6d12;
    border: 1px solid #ead59a;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: .8rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: 0;
    font: inherit;
    cursor: pointer;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--navy-800);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .85rem;
}

.content { padding: 24px; }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.page-head h1 {
    margin: 0 0 4px;
    font-size: 1.55rem;
    letter-spacing: -.03em;
}

.page-head p { margin: 0; color: var(--muted); }

.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-body { padding: 20px; }
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    font-weight: 700;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 18px 16px;
    box-shadow: var(--shadow);
}

.stat-label { color: var(--muted); font-size: .82rem; }
.stat-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.04em; margin-top: 4px; }
.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: #eef3f8;
    color: var(--navy-800);
    float: right;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: 10px;
    padding: 9px 14px;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    text-decoration: none !important;
}

.btn-primary { background: var(--navy-800); color: #fff !important; }
.btn-primary:hover { background: var(--navy-700); color: #fff !important; }
.btn-gold { background: var(--gold-500); color: #fff !important; }
.btn-gold:hover { background: #c10412; color: #fff !important; }
.btn-outline { background: #fff; color: var(--navy-800) !important; border: 1px solid var(--line); }
.btn-danger { background: #b42318; color: #fff !important; }
.btn-sm { padding: 6px 10px; font-size: .85rem; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: #f8fafc; }
.table tbody tr:hover { background: #fbfcfe; }

.badge-status {
    display: inline-block;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: .75rem;
    font-weight: 700;
}
.badge-status-success { background: #e8f7ef; color: #0f7a43; }
.badge-status-secondary { background: #eef1f4; color: #526070; }
.badge-status-warning { background: #fff4d6; color: #8a6d12; }
.badge-status-danger { background: #fdecec; color: #b42318; }
.badge-status-dark { background: #eceff3; color: #1c2430; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-weight: 650; margin-bottom: 6px; font-size: .9rem; }
.form-control, select.form-control, textarea.form-control {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
}
.form-control:focus { outline: 2px solid rgba(20,27,205,.18); border-color: var(--navy-700); }
.help { color: var(--muted); font-size: .8rem; margin-top: 4px; }

.alert {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-weight: 600;
}
.alert-success { background: #e8f7ef; color: #0f7a43; }
.alert-error { background: #fdecec; color: #b42318; }

.empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
}

.pagination { display: flex; gap: 6px; justify-content: flex-end; padding: 16px 20px; }
.pagination a, .pagination span {
    min-width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: inherit;
}
.pagination .current { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }

.profile-hero {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 22px;
}
.profile-hero img, .logo-fallback {
    width: 84px;
    height: 84px;
    object-fit: contain;
    border-radius: 16px;
    background: #f4f7fb;
    border: 1px solid var(--line);
}
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; }
.kv div:nth-child(odd) { color: var(--muted); }

.auth-body {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    background: var(--navy-950);
}

.auth-art {
    padding: 48px;
    color: #d7e2ee;
    background:
        radial-gradient(circle at 18% 18%, rgba(20,27,205,.38), transparent 34%),
        radial-gradient(circle at 82% 78%, rgba(234,5,23,.22), transparent 36%),
        linear-gradient(160deg, #0b0c2a, #070714);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.auth-art h2 {
    font-size: 2.3rem;
    color: #fff;
    letter-spacing: -.04em;
    max-width: 520px;
}

.auth-panel {
    background: #fff;
    display: grid;
    place-items: center;
    padding: 32px;
}

.auth-card { width: 100%; max-width: 420px; }
.auth-card-logo {
    display: none;
    width: 100%;
    max-width: 160px;
    height: auto;
    margin: 0 auto 18px;
}
.auth-card h1 { margin: 0 0 6px; letter-spacing: -.03em; }

.check-list { list-style: none; padding: 0; margin: 0 0 18px; }
.check-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    font-size: .92rem;
}
.ok { color: #0f7a43; font-weight: 700; }
.fail { color: #b42318; font-weight: 700; }

.dropdown {
    position: relative;
}
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    min-width: 180px;
    box-shadow: var(--shadow);
    overflow: hidden;
    z-index: 60;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    padding: 10px 14px;
    font: inherit;
    cursor: pointer;
    color: inherit;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: #f7f9fc; }

.perm-module { margin-bottom: 18px; }
.perm-module h3 { font-size: .95rem; margin: 0 0 10px; }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}
.tabs a {
    padding: 8px 12px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink);
    font-size: .88rem;
    font-weight: 650;
}
.tabs a.active, .tabs a:hover {
    background: var(--navy-800);
    border-color: var(--navy-800);
    color: #fff;
}

.filter-bar label {
    display: block;
    font-size: .75rem;
    color: var(--muted);
    margin-bottom: 4px;
}

.report-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
}
.report-bar-label {
    width: 150px;
    flex-shrink: 0;
    color: var(--muted);
    font-size: .88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.report-bar-track {
    flex: 1;
    height: 10px;
    background: #eef3f8;
    border-radius: 99px;
    overflow: hidden;
}
.report-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--navy-800), var(--gold-500));
    border-radius: 99px;
}
.report-bar-n {
    width: 42px;
    text-align: right;
    font-weight: 700;
}

.filter-bar {
    display: grid;
    grid-template-columns: 1.4fr repeat(4, 1fr) auto;
    gap: 8px;
}

.photo-frame {
    width: 120px;
    height: 160px;
    border-radius: 12px;
    border: 1px dashed var(--line);
    background: #f7f9fc;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--muted);
    font-size: .8rem;
}
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }

.avatar-photo {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    object-fit: cover;
    display: block;
}

.preview-stage {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}
.preview-frame {
    background: #d9e0e8;
    border-radius: 12px;
    padding: 12px;
    overflow: auto;
}
.preview-frame img {
    display: block;
    max-width: 100%;
    height: auto;
    box-shadow: 0 12px 40px rgba(15, 39, 68, .22);
    border-radius: 4px;
    background: #fff;
}
.tpl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.tpl-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    color: inherit;
    text-decoration: none !important;
}
.tpl-card:hover { border-color: #c5d0dc; }
.tpl-thumb {
    height: 150px;
    background: var(--navy-900);
    color: var(--gold-300);
    display: grid;
    place-items: center;
    overflow: hidden;
}
.tpl-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tpl-body { padding: 14px 16px 16px; }
.var-pill {
    display: inline-block;
    background: #eef3f8;
    border-radius: 6px;
    padding: 2px 7px;
    margin: 0 4px 6px 0;
    font-size: .78rem;
}

.public-body {
    min-height: 100vh;
    background: linear-gradient(180deg, #0b0c2a 0%, #141bcd 42%, #f3f5f8 42%);
}
.public-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 28px;
    max-width: 960px;
    margin: 0 auto;
}
.public-main {
    max-width: 640px;
    margin: 12px auto 48px;
    padding: 0 18px;
}
.verify-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 28px 28px 32px;
}
.verify-banner {
    margin-top: 16px;
    border-radius: 12px;
    padding: 14px 16px;
    font-weight: 800;
    letter-spacing: .04em;
    text-align: center;
}
.verify-valid { background: #e8f7ef; color: #0f7a43; }
.verify-invalid, .verify-revoked { background: #fdecec; color: #b42318; }
.verify-expired, .verify-replaced, .verify-suspended { background: #fff4d6; color: #8a6d12; }

@media (max-width: 1100px) {
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .form-grid, .perm-grid { grid-template-columns: 1fr; }
    .filter-bar { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: none; }
    .main { margin-left: 0; }
    .auth-body { grid-template-columns: 1fr; }
    .auth-art { display: none; }
    .auth-card-logo { display: block; }
    .stat-grid { grid-template-columns: 1fr; }
    .kv { grid-template-columns: 1fr; }
}
