:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --border: #e3e7ef;
    --text: #1c2433;
    --text-2: #4a5872;
    --muted: #7a859c;
    --primary: #1f5eff;
    --primary-hover: #1649cc;
    --primary-soft: #e8efff;
    --ok: #12805c;
    --ok-soft: #e3f5ee;
    --warning: #a35c00;
    --warning-soft: #fff3e0;
    --danger: #c62828;
    --danger-soft: #fdecec;
    --side: #0f1b33;
    --side-2: #18284a;
    --side-text: #b7c3dc;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; margin-bottom: 12px; }
h3 { font-size: 14px; margin: 18px 0 8px; }
p { margin: 0 0 12px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.strong { font-weight: 600; color: var(--text); }
.nowrap { white-space: nowrap; }
.mt-2 { margin-top: 10px; }
.mb-3 { margin-bottom: 20px; }
.warn { color: var(--warning); }

.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ico-ok { color: var(--ok); }
.ico-lg { width: 36px; height: 36px; margin-bottom: 8px; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 236px; flex: none; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, #3b7bff, #1f5eff); color: #fff; display: inline-grid; place-items: center; font-weight: 800; font-size: 16px; }
.brand-text { font-weight: 700; font-size: 15px; line-height: 1.15; }
.brand-text small { display: block; font-weight: 500; font-size: 11.5px; color: var(--side-text); }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--side-text); font-weight: 500; }
.nav-link:hover { background: var(--side-2); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--side-2); color: #fff; box-shadow: inset 3px 0 0 #3b7bff; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 700; padding: 0 7px; line-height: 18px; }
.nav-sep { height: 1px; background: rgba(255, 255, 255, .08); margin: 10px 6px; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, .08); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.me { display: flex; align-items: center; gap: 9px; min-width: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--side-2); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.me-text { color: #fff; font-size: 13px; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { display: block; color: var(--side-text); font-weight: 400; font-size: 11.5px; }
.btn-link { background: none; border: 0; color: var(--side-text); cursor: pointer; font: inherit; font-size: 12.5px; padding: 0; }
.btn-link:hover { color: #fff; text-decoration: underline; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 22px 32px 6px; }
.page-title { font-size: 21px; }
.page-actions { margin-left: auto; }
.menu-toggle { display: none; background: none; border: 0; padding: 6px; cursor: pointer; color: var(--text); }
.menu-toggle .ico { width: 22px; height: 22px; }
.content { padding: 16px 32px 48px; max-width: 1280px; width: 100%; }

/* ---------- building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.table-card { padding: 0; overflow-x: auto; }
.card-pad { padding: 16px 20px 4px; }
.table-card .card-head.card-pad { padding: 14px 20px; margin: 0; border-bottom: 1px solid var(--border); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-wide-left { grid-template-columns: 1.6fr 1fr; }
.grid-2 + .card, .grid-2 + section { margin-top: 18px; }
.row-gap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: #cfd6e3; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-text { color: var(--danger); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: #eef1f6; color: var(--text-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: #c3cad8; }
.dot-ok { background: var(--ok); }
.dot-warning { background: #e08a00; }
.dot-danger { background: var(--danger); }

.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash-success { background: var(--ok-soft); border-color: #bfe6d6; color: #0c5c42; }
.flash-error { background: var(--danger-soft); border-color: #f5c9c9; color: #8e1c1c; }
.flash-info { background: var(--primary-soft); border-color: #cddbff; color: #1a3d99; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stats-3 { grid-template-columns: repeat(3, 1fr); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; color: var(--text); box-shadow: var(--shadow); border-top: 3px solid var(--border); }
a.stat:hover { text-decoration: none; border-color: #cfd6e3; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat-sub { font-size: 12.5px; color: var(--muted); }
.stat-warning { border-top-color: #e08a00; }
.stat-danger { border-top-color: var(--danger); }

/* ---------- lists ---------- */
.alert-list, .site-list { list-style: none; margin: 0 -20px -20px; padding: 0; }
.alert-item { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-top: 1px solid var(--border); border-left: 3px solid transparent; }
.alert-item.sev-critical { border-left-color: var(--danger); }
.alert-item.sev-warning { border-left-color: #e08a00; }
.alert-main { flex: 1; min-width: 0; }
.alert-msg { font-weight: 550; }
.alert-meta { font-size: 12.5px; color: var(--muted); }
.site-row { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--border); color: var(--text); }
.site-row:hover { background: var(--surface-2); text-decoration: none; }
.site-name { flex: 1; min-width: 0; font-weight: 600; }
.site-name small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.empty-sm { color: var(--muted); padding: 6px 0; }
.empty-sm .ico { margin-right: 6px; }
.card.empty-sm { padding: 20px; }
.empty { text-align: center; padding: 48px 20px; }
.empty h2 { font-size: 17px; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 10px 20px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 20px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.card:not(.table-card) .table th, .card:not(.table-card) .table td { padding-left: 10px; padding-right: 10px; }
.table .num { text-align: right; }
.table .sub, .sub { font-size: 12.5px; color: var(--muted); }
.row-link { cursor: pointer; }
.row-link:hover td { background: var(--surface-2); }
.row-removed td { opacity: .55; }
.w-check { width: 36px; }
.group-head td { background: var(--surface-2); font-weight: 650; }
tbody.group + tbody.group .group-head td { border-top: 1px solid var(--border); }
.table tfoot td { border-top: 2px solid var(--border); padding: 12px 20px; }
.result-list { margin: 6px 0 0; padding-left: 16px; font-size: 12.5px; color: var(--text-2); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
input[type=text], input[type=email], input[type=search], input[type=date], input[type=password], select, textarea {
    width: 100%; height: 38px; padding: 0 11px; border: 1px solid #cfd6e3; border-radius: 8px; font: inherit; color: var(--text); background: #fff; }
textarea { height: auto; padding: 9px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31, 94, 255, .15); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); vertical-align: -3px; }
.field-error { color: var(--danger); font-size: 12.5px; }
.form-card { max-width: 760px; }
.form-card h2:not(:first-of-type) { margin-top: 26px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.span-2 { grid-column: span 2; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.field-check { align-self: end; height: 38px; }
.input-prefix { display: flex; align-items: center; border: 1px solid #cfd6e3; border-radius: 8px; overflow: hidden; background: #fff; }
.input-prefix span { padding: 0 10px; color: var(--muted); background: var(--surface-2); height: 36px; display: grid; place-items: center; border-right: 1px solid #cfd6e3; }
.input-prefix input { border: 0; border-radius: 0; height: 36px; }
.input-prefix:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31, 94, 255, .15); }
.input-prefix input:focus { box-shadow: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.table-card .form-actions { padding: 0 20px 20px; }
.card .form-actions:last-child { margin-bottom: 0; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar p { margin: 0; }
.search { position: relative; flex: 1; max-width: 380px; }
.search .ico { position: absolute; left: 11px; top: 11px; color: var(--muted); }
.search input { padding-left: 34px; }
.seg { display: inline-flex; background: #e8ecf3; border-radius: 8px; padding: 3px; }
.seg a { padding: 5px 14px; border-radius: 6px; color: var(--text-2); font-weight: 600; font-size: 13px; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg a.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.bulk-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px; margin-bottom: 14px; box-shadow: 0 4px 12px rgba(16, 24, 40, .06); }
.update-site .check .strong { margin-left: 2px; }

.toggle { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; font: inherit; padding: 0; color: var(--text-2); }
.toggle::before { content: ""; }
.toggle .toggle-knob { width: 34px; height: 20px; border-radius: 99px; background: #cfd6e3; position: relative; transition: background .15s; }
.toggle .toggle-knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.toggle.on .toggle-knob { background: var(--ok); }
.toggle.on .toggle-knob::after { left: 16px; }

/* ---------- site page ---------- */
.site-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.site-url { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; margin-bottom: 6px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 9px 14px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.notes { margin-top: 16px; padding: 12px 14px; background: var(--surface-2); border-radius: 8px; color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 3px 12px; font-size: 13px; color: var(--text-2); }
.chip strong { color: var(--text); margin-left: 3px; }
.pair-card { border-color: #cddbff; background: linear-gradient(0deg, #fff, #f5f8ff); }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.steps li { padding-left: 4px; }
.steps li > .btn { margin-left: 8px; }
.code-box { display: flex; align-items: center; gap: 10px; margin-top: 10px; background: var(--side); border-radius: 8px; padding: 10px 10px 10px 14px; }
.code-box code { color: #d7e2ff; flex: 1; word-break: break-all; font-size: 12.5px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.btn + .hint { margin-left: 8px; }
.code-box + .hint { margin-left: 0; }
.jobs-banner { display: flex; align-items: center; gap: 14px; background: var(--warning-soft); border: 1px solid #f5d9ad; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; }
.spinner { width: 20px; height: 20px; border: 2.5px solid #f0c27a; border-top-color: var(--warning); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.danger-zone h2 + p { font-size: 13px; }
.danger-zone input { max-width: 240px; }

.plugin-hero { display: flex; align-items: center; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 4px; flex-wrap: wrap; }
.plugin-hero h2 { margin: 0; }
.plugin-hero p { margin: 0; }
.plugin-hero .btn { margin-left: auto; }
.plugin-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.plugin-icon .ico { width: 24px; height: 24px; }
.bullets { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); }

/* ---------- auth ---------- */
.auth-body { background: radial-gradient(1200px 600px at 50% -10%, #1d3264, var(--side)); min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-wrap { width: 100%; max-width: 400px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; color: #fff; font-weight: 700; font-size: 18px; margin-bottom: 22px; }
.auth-card { padding: 28px; }
.auth-card h2 { font-size: 19px; }
.auth-foot { text-align: center; color: var(--side-text); font-size: 12.5px; margin-top: 18px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .grid-wide-left { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
    .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
    .sidebar.open { transform: none; }
    .menu-toggle { display: inline-flex; }
    .topbar { padding: 14px 16px 4px; }
    .content { padding: 12px 16px 40px; }
    .hide-sm { display: none; }
    .stats, .stats-3 { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .kv { grid-template-columns: 120px 1fr; }
    .table th, .table td { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 480px) {
    .stats, .stats-3 { grid-template-columns: 1fr; }
}

/* ---------- 2FA ---------- */
.qr { width: 200px; height: 200px; margin: 6px auto 8px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px; }
.qr svg { width: 100%; height: 100%; display: block; }
.center { text-align: center; margin-left: 0; }
.secret { font-size: 13px; letter-spacing: .04em; color: var(--text); }
.code-input { font-family: var(--mono); font-size: 20px !important; letter-spacing: .3em; text-align: center; height: 46px !important; }
.inline { display: inline-block; }
.break { word-break: break-all; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.mini-stats > div { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; }
.mini-stats .stat-value { font-size: 20px; }
.card-head h2 .badge { margin-left: 6px; vertical-align: 2px; }
p.card-pad { padding-bottom: 16px; }
.mt-section { margin-top: 18px; }

/* ---------- security tab ---------- */
.section-title { font-size: 16px; margin: 26px 0 12px; }
.small { font-size: 12px; }
.stat-value.warn { color: var(--warning); }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.checklist li:first-child { border-top: 0; }
.check-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #c3cad8; }
.check-ok .check-dot { background: var(--ok); }
.check-warn .check-dot { background: #e08a00; }
.check-bad .check-dot { background: var(--danger); }
.check-label { flex: 1; min-width: 0; }
.check-label small { display: block; color: var(--muted); font-size: 12px; }
.timeline { display: flex; gap: 2px; height: 26px; margin-top: 12px; }
.tl { flex: 1; border-radius: 2px; background: #e3e7ef; }
.tl-up { background: #3fb68b; }
.tl-down { background: var(--danger); }
.timeline-legend { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin: 4px 0 16px; }
.file-list { margin: 0 0 10px; padding-left: 18px; font-family: var(--mono); font-size: 12px; color: var(--text-2); max-height: 180px; overflow: auto; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 8px 0; border-top: 1px solid var(--border); }
.plain-list li:first-child { border-top: 0; }
.stats-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .stats-5 { grid-template-columns: repeat(2, 1fr); } }

/* Consistent inner spacing for everything placed directly inside a table card. */
.table-card > h2.card-pad { margin: 0; padding: 18px 20px 12px; }
.table-card > .empty-sm.card-pad { padding: 4px 20px 20px; }
.table-card > .card-head.card-pad + .empty-sm.card-pad { padding-top: 16px; }
.table-card > p.card-pad { margin: 0; padding: 12px 20px 16px; border-top: 1px solid var(--border); }
.table-card > .table + p.card-pad { border-top: 1px solid var(--border); }
.vuln-details summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.vuln-details ul { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.vuln-details .sub { display: block; }
