:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #eff6ff;
    --navy: #0b1526;
    --navy-2: #111f35;
    --text: #182230;
    --muted: #667085;
    --border: #e5e9f0;
    --surface: #ffffff;
    --canvas: #f5f7fa;
    --success: #12b76a;
    --warning: #f79009;
    --danger: #f04438;
    --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .04);
    --radius: 14px;
    font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    color: var(--text);
    background: var(--canvas);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { min-height: 100vh; margin: 0; background: var(--canvas); color: var(--text); font-size: 14px; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50; width: 248px; padding: 0 14px 20px;
    display: flex; flex-direction: column; color: #d8e1ef;
    background: radial-gradient(circle at 10% 0%, rgba(59,130,246,.16), transparent 30%), var(--navy);
    border-right: 1px solid rgba(255,255,255,.05);
}
.brand { height: 86px; display: flex; align-items: center; gap: 12px; padding: 0 10px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: #fff; font-size: 19px; font-weight: 800; background: linear-gradient(145deg, #3b82f6, #1d4ed8); box-shadow: 0 8px 20px rgba(37,99,235,.35); }
.brand-copy { display: flex; min-width: 0; flex-direction: column; }
.brand-copy strong { color: #fff; font-size: 17px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-copy small { margin-top: 3px; color: #7f91aa; font-size: 11px; letter-spacing: .06em; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-caption { padding: 14px 14px 8px; color: #5f718b; font-size: 10px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.nav-caption-spaced { margin-top: 12px; }
.nav-item { position: relative; height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 13px; border-radius: 10px; color: #96a6bb; font-weight: 500; transition: .18s ease; }
.nav-item:hover { color: #edf4ff; background: rgba(255,255,255,.055); }
.nav-item.active { color: #fff; background: linear-gradient(90deg, rgba(37,99,235,.28), rgba(37,99,235,.12)); box-shadow: inset 0 0 0 1px rgba(96,165,250,.14); }
.nav-item.active::before { content: ""; position: absolute; left: -14px; width: 3px; height: 22px; border-radius: 0 4px 4px 0; background: #60a5fa; }
.nav-icon { width: 20px; text-align: center; font-size: 17px; color: #71839c; }
.nav-item.active .nav-icon { color: #79b1ff; }
.sidebar-footer { margin-top: auto; padding: 18px 12px 0; border-top: 1px solid rgba(255,255,255,.07); }
.system-health { display: flex; align-items: center; gap: 8px; color: #96a6bb; font-size: 12px; }
.health-dot { width: 7px; height: 7px; border-radius: 50%; background: #32d583; box-shadow: 0 0 0 4px rgba(50,213,131,.1); }
.version { display: block; margin-top: 8px; color: #51627a; font-size: 10px; }

.main-panel { min-height: 100vh; margin-left: 248px; display: flex; flex-direction: column; }
.topbar { height: 86px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--border); backdrop-filter: blur(12px); }
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar h1 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.site-link { padding: 8px 12px; color: var(--primary); font-size: 12px; font-weight: 600; border-radius: 8px; background: var(--primary-soft); }
.account-menu { display: flex; align-items: center; gap: 9px; padding-left: 16px; border-left: 1px solid var(--border); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; color: #fff; font-weight: 700; border-radius: 10px; background: linear-gradient(145deg, #475467, #101828); }
.account-menu div { display: flex; flex-direction: column; min-width: 82px; }
.account-menu strong { font-size: 12px; }
.account-menu small { color: var(--muted); font-size: 10px; }
.logout-link { color: var(--muted); font-size: 12px; }
.logout-link:hover { color: var(--danger); }
.mobile-menu { display: none; }

.content-wrap { width: 100%; max-width: 1680px; margin: 0 auto; padding: 28px 32px 48px; flex: 1; }
.page-heading { margin-bottom: 24px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.eyebrow { display: block; margin-bottom: 7px; color: var(--primary); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.page-heading h2 { margin: 0; font-size: 25px; letter-spacing: -.035em; }
.page-heading p { max-width: 670px; margin: 8px 0 0; color: var(--muted); line-height: 1.65; }
.page-actions { display: flex; align-items: center; gap: 10px; }
.page-footer { padding: 20px 32px; display: flex; justify-content: space-between; color: #98a2b3; font-size: 11px; border-top: 1px solid var(--border); background: #fff; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { position: relative; min-height: 138px; padding: 21px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat-icon { width: 36px; height: 36px; display: grid; place-items: center; color: var(--primary); border-radius: 10px; background: var(--primary-soft); font-size: 17px; }
.stat-value { display: block; margin-top: 13px; font-size: 28px; font-weight: 750; letter-spacing: -.04em; }
.stat-meta { margin-top: 5px; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.trend-up { color: var(--success); font-weight: 700; }
.trend-neutral { color: var(--primary); font-weight: 700; }

.grid-main { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, .75fr); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { min-height: 66px; padding: 17px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); }
.card-title h3 { margin: 0; font-size: 14px; }
.card-title p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.card-body { padding: 20px; }
.card-link { color: var(--primary); font-size: 12px; font-weight: 600; }

.chart { height: 230px; padding: 20px 10px 4px; display: flex; align-items: flex-end; gap: 12px; border-bottom: 1px solid var(--border); background: repeating-linear-gradient(to top, transparent 0, transparent 47px, #f1f3f7 48px); }
.chart-column { flex: 1; min-width: 20px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; }
.chart-bar { width: min(34px, 68%); min-height: 3px; border-radius: 7px 7px 2px 2px; background: linear-gradient(to top, var(--primary-dark), #60a5fa); transition: .3s ease; }
.chart-column:hover .chart-bar { filter: brightness(1.08); transform: translateY(-2px); }
.chart-label { color: var(--muted); font-size: 10px; white-space: nowrap; }
.chart-value { color: var(--text); font-size: 10px; font-weight: 700; }
.quick-list { display: flex; flex-direction: column; }
.quick-item { padding: 13px 0; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #f0f2f5; }
.quick-item:last-child { border: 0; }
.quick-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(18,183,106,.09); }
.quick-dot.warning { background: var(--warning); box-shadow: 0 0 0 4px rgba(247,144,9,.1); }
.quick-copy { min-width: 0; flex: 1; }
.quick-copy strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; }
.quick-copy small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.quick-count { color: var(--text); font-size: 12px; font-weight: 700; }

.toolbar { margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.filter-group { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.search-field { position: relative; min-width: 250px; }
.search-field::before { content: "⌕"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #98a2b3; font-size: 17px; }
.search-field input { width: 100%; padding-left: 36px; }
.form-control, .form-select { height: 40px; padding: 0 12px; color: var(--text); background: #fff; border: 1px solid #d7dce5; border-radius: 9px; outline: none; transition: .15s; }
textarea.form-control { height: auto; min-height: 92px; padding-top: 10px; resize: vertical; }
.form-control:focus, .form-select:focus { border-color: #84adff; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-control::placeholder { color: #aab2c0; }
.btn { height: 40px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-size: 12px; font-weight: 650; transition: .15s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: #fff; background: var(--primary); box-shadow: 0 4px 10px rgba(37,99,235,.2); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { color: #344054; background: #fff; border-color: #d7dce5; }
.btn-danger { color: #b42318; background: #fff5f4; border-color: #fecdca; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 11px; border-radius: 7px; }
.btn-icon { width: 32px; padding: 0; }

.table-card { overflow: hidden; }
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; min-width: 900px; border-collapse: collapse; }
.data-table th { height: 43px; padding: 0 16px; color: #667085; background: #f9fafb; border-bottom: 1px solid var(--border); text-align: left; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 14px 16px; border-bottom: 1px solid #edf0f4; vertical-align: middle; font-size: 12px; }
.data-table tbody tr:hover { background: #fbfcfe; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.primary-cell { display: flex; align-items: center; gap: 11px; min-width: 180px; }
.domain-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: var(--primary); background: var(--primary-soft); font-weight: 700; }
.primary-cell strong, .primary-cell small { display: block; }
.primary-cell strong { max-width: 250px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; }
.primary-cell small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.muted { color: var(--muted); }
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; }
.truncate { display: block; max-width: 260px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 99px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.status-active { color: #027a48; background: #ecfdf3; }
.status-active::before { background: #12b76a; }
.status-disabled { color: #475467; background: #f2f4f7; }
.status-disabled::before { background: #98a2b3; }
.status-expired { color: #b42318; background: #fef3f2; }
.status-expired::before { background: #f04438; }
.status-warning { color: #b54708; background: #fffaeb; }
.status-warning::before { background: #f79009; }
.action-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.inline-form { display: inline-flex; }
.empty-state { padding: 70px 24px; text-align: center; }
.empty-state-icon { width: 54px; height: 54px; margin: 0 auto 16px; display: grid; place-items: center; color: var(--primary); border-radius: 15px; background: var(--primary-soft); font-size: 22px; }
.empty-state h3 { margin: 0 0 7px; font-size: 15px; }
.empty-state p { margin: 0 auto 18px; max-width: 420px; color: var(--muted); line-height: 1.6; }
.table-footer { min-height: 58px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; border-top: 1px solid var(--border); }
.pagination { display: flex; gap: 5px; }
.pagination a, .pagination span { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 7px; background: #fff; }
.pagination .current { color: #fff; border-color: var(--primary); background: var(--primary); }

.alert { margin-bottom: 18px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid; border-radius: 10px; font-size: 12px; }
.alert button { border: 0; color: inherit; background: transparent; cursor: pointer; font-size: 18px; }
.alert-success { color: #027a48; background: #ecfdf3; border-color: #abefc6; }
.alert-error { color: #b42318; background: #fef3f2; border-color: #fecdca; }
.alert-warning { color: #b54708; background: #fffaeb; border-color: #fedf89; }

dialog.modal { width: min(680px, calc(100vw - 28px)); max-height: calc(100vh - 40px); padding: 0; overflow: hidden; color: var(--text); border: 0; border-radius: 16px; box-shadow: 0 25px 70px rgba(16,24,40,.28); }
dialog.modal::backdrop { background: rgba(8,15,28,.58); backdrop-filter: blur(3px); }
.modal-header { padding: 19px 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-header p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.modal-close { width: 32px; height: 32px; color: var(--muted); background: #f2f4f7; border: 0; border-radius: 8px; cursor: pointer; font-size: 19px; }
.modal-body { max-height: calc(100vh - 190px); padding: 22px; overflow-y: auto; }
.modal-footer { padding: 14px 22px; display: flex; align-items: center; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--border); background: #fafbfc; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.field { min-width: 0; }
.field-full { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 7px; font-size: 11px; font-weight: 650; }
.field .form-control, .field .form-select { width: 100%; }
.field-help { margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.required { color: var(--danger); }
.input-group { display: flex; }
.input-group > * { border-radius: 0; }
.input-group > *:first-child { border-radius: 9px 0 0 9px; }
.input-group > *:last-child { border-radius: 0 9px 9px 0; }
.input-addon { min-width: 45px; padding: 0 10px; display: grid; place-items: center; color: var(--muted); background: #f8f9fb; border: 1px solid #d7dce5; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; background: #f2f4f7; border-radius: 10px; }
.segmented label { margin: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { height: 34px; display: grid; place-items: center; color: var(--muted); border-radius: 8px; cursor: pointer; font-size: 11px; font-weight: 600; }
.segmented input:checked + span { color: var(--primary); background: #fff; box-shadow: 0 1px 4px rgba(16,24,40,.1); }
.expiry-panel { margin-top: 12px; padding: 14px; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; }
.expiry-panel[hidden] { display: none; }
.form-section { padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.form-section:last-child { padding: 0; margin: 0; border: 0; }
.form-section-title { margin: 0 0 16px; font-size: 13px; }
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
.settings-note { padding: 18px; color: #344054; background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; line-height: 1.65; }
.settings-note h3 { margin: 0 0 8px; font-size: 13px; }
.settings-note p { margin: 0; color: var(--muted); font-size: 11px; }

.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 220px; padding: 12px 14px; color: #fff; border-radius: 10px; background: #101828; box-shadow: 0 12px 30px rgba(16,24,40,.25); animation: toast-in .2s ease; font-size: 12px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 9px; color: var(--text); background: #fff; cursor: pointer; }
.sidebar-backdrop { display: none; }
.check-row { margin: 8px 0 0 !important; color: var(--muted); font-weight: 500 !important; }

.login-page { overflow: hidden; background: #fff; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(440px, .95fr) minmax(520px, 1.05fr); }
.login-showcase { position: relative; padding: 42px 54px; display: flex; flex-direction: column; overflow: hidden; color: #fff; background: radial-gradient(circle at 70% 25%, rgba(37,99,235,.32), transparent 28%), radial-gradient(circle at 20% 80%, rgba(14,165,233,.12), transparent 30%), #091426; }
.login-showcase::after { content: ""; position: absolute; right: -140px; bottom: 40px; width: 420px; height: 420px; border: 1px solid rgba(96,165,250,.16); border-radius: 50%; box-shadow: 0 0 0 70px rgba(96,165,250,.04), 0 0 0 140px rgba(96,165,250,.025); }
.login-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; font-size: 18px; }
.showcase-copy { position: relative; z-index: 1; margin: auto 0; max-width: 570px; }
.login-kicker { color: #60a5fa; font-size: 11px; font-weight: 700; letter-spacing: .2em; }
.showcase-copy h1 { margin: 24px 0 20px; font-size: clamp(38px, 4.4vw, 62px); line-height: 1.15; letter-spacing: -.055em; }
.showcase-copy p { max-width: 500px; margin: 0; color: #9eacc0; font-size: 15px; line-height: 1.9; }
.showcase-points { margin-top: 38px; display: flex; gap: 22px; }
.showcase-points span { display: inline-flex; align-items: center; gap: 7px; color: #ccd6e5; font-size: 12px; }
.showcase-points span::before { content: "✓"; width: 20px; height: 20px; display: grid; place-items: center; color: #60a5fa; border-radius: 50%; background: rgba(96,165,250,.12); }
.showcase-footer { position: relative; z-index: 1; color: #60718a; font-size: 10px; letter-spacing: .06em; }
.login-panel { padding: 48px; display: grid; place-items: center; background: #fff; }
.login-card { width: 100%; max-width: 390px; }
.login-card h2 { margin: 0; font-size: 30px; letter-spacing: -.04em; }
.login-intro { margin: 9px 0 30px; color: var(--muted); }
.login-field { margin-bottom: 17px; }
.login-field label { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 650; }
.login-field .form-control { width: 100%; height: 47px; }
.login-submit { width: 100%; height: 47px; margin-top: 6px; justify-content: space-between; padding: 0 18px; }
.login-security { margin-top: 22px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 10px; }
.mobile-login-brand { display: none; }

@media (max-width: 1180px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-main, .settings-layout { grid-template-columns: 1fr; }
    .settings-note { order: -1; }
}
@media (max-width: 820px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop { position: fixed; inset: 0; z-index: 45; width: 100%; height: 100%; border: 0; background: rgba(8,15,28,.5); }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .main-panel { margin-left: 0; }
    .topbar { height: 76px; padding: 0 18px; }
    .mobile-menu { display: block; }
    .site-link, .account-menu div, .logout-link { display: none; }
    .account-menu { padding: 0; border: 0; }
    .content-wrap { padding: 22px 18px 38px; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1; }
    .toolbar { align-items: stretch; flex-direction: column; }
    .filter-group { width: 100%; }
    .search-field { min-width: 100%; }
    .page-footer { padding: 18px; }
    .login-page { overflow: auto; }
    .login-shell { display: block; }
    .login-showcase { display: none; }
    .login-panel { min-height: 100vh; padding: 32px 22px; }
    .mobile-login-brand { margin-bottom: 54px; display: flex; align-items: center; gap: 12px; font-size: 18px; }
}
@media (max-width: 560px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card { min-height: 122px; }
    .form-grid { grid-template-columns: 1fr; }
    .field-full { grid-column: auto; }
    .segmented { grid-template-columns: 1fr; gap: 3px; }
    .page-heading h2 { font-size: 22px; }
    .page-footer span:last-child { display: none; }
    .modal-body { padding: 18px; }
}
