@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #070b14;
    --bg-elevated: #0d1322;
    --surface: rgba(18, 26, 46, 0.92);
    --surface-2: #151f38;
    --surface-hover: #1b2744;
    --border: rgba(148, 163, 184, 0.12);
    --border-strong: rgba(148, 163, 184, 0.22);
    --text: #f1f5f9;
    --muted: #8b9cb8;
    --primary: #6366f1;
    --primary-2: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.25);
    --success: #10b981;
    --danger: #f43f5e;
    --warning: #f59e0b;
    --info: #38bdf8;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
    --sidebar-w: 220px;
}

html { font-size: 14px; }

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.45;
    font-size: 0.92rem;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% -10%, rgba(99, 102, 241, 0.18), transparent),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(56, 189, 248, 0.08), transparent);
    pointer-events: none;
    z-index: 0;
}

a { color: var(--info); text-decoration: none; }
a:hover { color: #7dd3fc; }

code {
    background: rgba(255,255,255,0.06);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: ui-monospace, monospace;
}

body { display: flex; position: relative; }

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, rgba(13,19,34,0.98), rgba(10,14,26,0.98));
    border-right: 1px solid var(--border);
    min-height: 100vh;
    padding: 0.9rem 0.75rem;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 10;
    backdrop-filter: blur(12px);
}

.sidebar-brand {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    padding: 0.55rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(56,189,248,0.08));
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.brand-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    border-radius: 12px;
    font-size: 1rem;
    box-shadow: 0 8px 24px var(--primary-glow);
}

.sidebar-brand strong { display: block; font-size: 0.92rem; font-weight: 800; }
.sidebar-brand small { color: var(--muted); font-size: 0.68rem; }

.sidebar-nav { display: flex; flex-direction: column; gap: 0.3rem; }

.sidebar-nav a {
    color: var(--muted);
    text-decoration: none;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.84rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav a::before {
    display: none;
}

.sidebar-nav .nav-icon {
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.78rem;
    opacity: 0.85;
}

.sidebar-nav a:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.sidebar-nav a.active {
    background: linear-gradient(90deg, rgba(99,102,241,0.2), transparent);
    color: var(--text);
    border: 1px solid rgba(99,102,241,0.25);
}

.sidebar-nav a.active .nav-icon {
    opacity: 1;
    filter: drop-shadow(0 0 6px var(--primary-glow));
}

.sidebar-footer { margin-top: auto; padding-top: 1rem; }

.main {
    flex: 1;
    padding: 1.1rem 1.35rem 1.75rem;
    max-width: 1280px;
    position: relative;
    z-index: 1;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1.1rem;
}

.topbar h1 {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.35rem;
}

.topbar p, .panel-header p, .form-hint { color: var(--muted); font-size: 0.82rem; }

.topbar-actions, .action-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.7rem;
    margin-bottom: 1.1rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 0.85rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
    transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--border-strong);
}

.stat-card.stat-info::after { background: linear-gradient(90deg, var(--info), transparent); }
.stat-card.stat-success::after { background: linear-gradient(90deg, var(--success), transparent); }
.stat-card.stat-danger::after { background: linear-gradient(90deg, var(--danger), transparent); }
.stat-card.stat-warn::after { background: linear-gradient(90deg, #f59e0b, transparent); }

.stat-label {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: block;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}

.stat-success .stat-value { color: var(--success); }
.stat-danger .stat-value { color: var(--danger); }
.stat-info .stat-value { color: var(--info); }
.stat-warn .stat-value { color: #fbbf24; }

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.panel-header {
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.panel-header h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th, td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    vertical-align: middle;
}

tbody tr { transition: background 0.15s; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody tr:last-child td { border-bottom: none; }

th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(0,0,0,0.15);
}

.domain-cell { display: flex; align-items: center; gap: 0.55rem; }

.domain-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.72rem;
    color: white;
    flex-shrink: 0;
    text-transform: uppercase;
}

.domain-meta { display: flex; flex-direction: column; gap: 0.15rem; }
.domain-name { font-weight: 700; font-size: 0.84rem; }
.domain-id { color: var(--muted); font-size: 0.66rem; font-family: ui-monospace, monospace; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-active, .badge-restored { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.25); }
.badge-missing, .badge-offline { background: rgba(244,63,94,0.12); color: #fb7185; border: 1px solid rgba(244,63,94,0.25); }
.badge-remote, .badge-wordpress, .badge-preset, .badge-scan, .badge-origin { background: rgba(56,189,248,0.12); color: #7dd3fc; border: 1px solid rgba(56,189,248,0.2); }
.badge-local { background: rgba(167,139,250,0.12); color: #c4b5fd; border: 1px solid rgba(167,139,250,0.2); }

.path-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 1.5rem 1.25rem;
}

.path-tag {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-family: ui-monospace, monospace;
}

.steps { padding: 1.25rem 1.5rem; display: grid; gap: 0.85rem; }

.step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.15rem;
    transition: border-color 0.2s;
}

.step:hover { border-color: var(--border-strong); }

.step-num {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.step strong { display: block; margin-bottom: 0.2rem; font-size: 0.92rem; }
.step p { color: var(--muted); font-size: 0.85rem; line-height: 1.55; }

.btn {
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.48rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-decoration: none;
}

.btn:hover { transform: translateY(-1px); }
.btn-primary {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white;
    box-shadow: 0 8px 24px var(--primary-glow);
}
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: linear-gradient(135deg, #f43f5e, #e11d48); color: white; }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: white; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--surface-hover); }
.btn-sm { padding: 0.32rem 0.62rem; font-size: 0.72rem; }
.btn-block { width: 100%; }

.system-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    padding: 1.25rem 1.5rem 1.5rem;
}

.system-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.system-item span { color: var(--muted); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.system-item strong { font-size: 1.1rem; }
.system-item code { word-break: break-all; }

.info-box {
    padding: 1rem 1.5rem 1.35rem;
    font-size: 0.88rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.12);
}

.log-list { max-height: 380px; overflow-y: auto; }

.log-item {
    display: grid;
    grid-template-columns: 140px 100px 1fr;
    gap: 1rem;
    padding: 0.9rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.84rem;
    align-items: center;
}

.log-item:hover { background: rgba(255,255,255,0.02); }
.log-time { color: var(--muted); font-size: 0.8rem; }
.log-action {
    color: var(--primary-2);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    background: rgba(99,102,241,0.12);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    text-align: center;
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.alert-danger {
    background: rgba(244,63,94,0.1);
    border: 1px solid rgba(244,63,94,0.3);
    color: #fecdd3;
}

.empty-state {
    text-align: center;
    padding: 4rem 1.5rem;
    color: var(--muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 { color: var(--text); margin-bottom: 0.5rem; font-size: 1.15rem; }
.empty-state.small { padding: 1.5rem; }

/* Auth */
.auth-page {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--bg);
}

.auth-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 50% at 50% -20%, rgba(99,102,241,0.25), transparent),
        radial-gradient(ellipse 50% 40% at 100% 100%, rgba(56,189,248,0.1), transparent);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2.25rem;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(16px);
}

.auth-card .brand { text-align: center; margin-bottom: 2rem; }
.auth-card .brand-icon {
    width: 56px; height: 56px;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
}
.auth-card h1 { margin-bottom: 0.35rem; font-weight: 800; font-size: 1.5rem; }
.auth-card > .brand p { color: var(--muted); font-size: 0.9rem; }

.auth-form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.auth-form input {
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    margin-bottom: 1.25rem;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-error { color: var(--danger); font-size: 0.85rem; margin-top: 0.75rem; text-align: center; }

/* Modal */
body.modal-open { overflow: hidden; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 7, 15, 0.82);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0.85rem;
    overflow-x: hidden;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.is-open { display: flex; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    width: min(960px, calc(100vw - 1.5rem));
    max-width: min(960px, calc(100vw - 1.5rem));
    max-height: 88vh;
    overflow-x: hidden;
    overflow-y: auto;
    background: linear-gradient(180deg, #121a2f, #0d1322);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    box-shadow: var(--shadow);
    animation: slideUp 0.25s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: rgba(13,19,34,0.95);
    backdrop-filter: blur(12px);
    z-index: 1;
}

.modal-header h2 {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.modal-subtitle { color: var(--muted); font-size: 0.78rem; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }

.modal-close {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.modal-close:hover { background: var(--danger); border-color: var(--danger); }

.modal-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.55rem;
    padding: 0.75rem 1.1rem;
    border-bottom: 1px solid var(--border);
}

.modal-stat {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.6rem;
    text-align: center;
}

.modal-stat span {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
}

.modal-stat strong { font-size: 1.1rem; font-weight: 800; }
.modal-stat strong.small { font-size: 0.72rem; font-weight: 600; }

.modal-section {
    padding: 0.75rem 1.1rem 0.9rem;
    border-bottom: 1px solid var(--border);
    min-width: 0;
    overflow-x: hidden;
}

.modal-section:last-child { border-bottom: none; }

.modal-section h3 {
    font-size: 0.68rem;
    margin-bottom: 0.65rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.modal-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.55rem;
}

.modal-info-wide {
    grid-column: 1 / -1;
}

.modal-info-grid > div {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.7rem;
    min-width: 0;
}

.modal-info-grid span {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.modal-info-grid code,
.modal-info-grid a {
    word-break: break-all;
    overflow-wrap: anywhere;
}

.modal-config {
    display: grid;
    gap: 1rem;
}

.modal-config .muted { color: var(--muted); }

.modal-payload,
.modal-config {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    min-width: 0;
    overflow: hidden;
}

.modal-summary-grid,
.modal-target-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.modal-summary-card,
.modal-target-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
    min-width: 0;
}

.modal-summary-card span,
.modal-target-card span {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
}

.modal-summary-card strong,
.modal-target-card strong {
    display: block;
    font-size: 1rem;
    font-weight: 800;
}

.modal-summary-card strong.small,
.modal-target-card small {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted);
}

.modal-target-card.is-active {
    border-color: rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.06);
}

.modal-target-grid--dense {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.path-link-inline {
    margin-left: 0.4rem;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.82rem;
}
    border-color: rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.06);
}

.modal-subsection {
    margin-top: 1rem;
}

.modal-subsection-title {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.65rem;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.22);
    font-size: 0.68rem;
    max-width: 100%;
}

.chip--ghost {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border);
}

.chip code {
    font-size: 0.68rem;
    word-break: break-all;
}

.chip-count {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
}

.chip-more {
    margin-top: 0.65rem;
}

.chip-more summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 600;
    list-style: none;
}

.chip-more summary::-webkit-details-marker { display: none; }

.chip-list--wrap {
    margin-top: 0.65rem;
}

.modal-config-rows {
    display: grid;
    gap: 0.75rem;
}

.modal-config-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 0.75rem;
    align-items: start;
}

.modal-config-row > span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-top: 0.15rem;
}

.modal-config-row code,
.modal-config-stack code {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-config-stack {
    display: grid;
    gap: 0.35rem;
}

.modal-section-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.modal-section-head-row h3 {
    margin-bottom: 0;
}

.modal-path-count {
    color: var(--muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.modal-path-toolbar {
    display: grid;
    gap: 0.75rem;
}

.modal-path-search {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.48rem 0.7rem;
    font: inherit;
    font-size: 0.8rem;
}

.modal-path-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    min-width: 0;
}

.modal-filter-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 999px;
    padding: 0.28rem 0.62rem;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
}

.modal-filter-btn.is-active {
    color: var(--text);
    border-color: rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.08);
}

.modal-path-filters--status .modal-filter-btn.is-active {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.1);
}

.health-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.22rem 0.55rem;
    border-radius: 8px;
    font-size: 0.68rem;
    font-weight: 600;
    border: 1px solid transparent;
    vertical-align: middle;
}

.health-badge strong {
    font-variant-numeric: tabular-nums;
    font-size: 0.78rem;
}

.health-badge--healthy {
    background: rgba(16, 185, 129, 0.14);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.28);
}

.health-badge--warn {
    background: rgba(245, 158, 11, 0.14);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.28);
}

.health-badge--critical {
    background: rgba(244, 63, 94, 0.12);
    color: #fb7185;
    border-color: rgba(244, 63, 94, 0.28);
}

.health-mini {
    display: flex;
    gap: 0.55rem;
    margin-top: 0.28rem;
    color: var(--muted);
    font-size: 0.66rem;
}

.modal-health {
    display: grid;
    gap: 0.85rem;
}

.modal-health-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: center;
}

.modal-health-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid transparent;
}

.modal-health-score strong {
    font-size: 1.8rem;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.modal-health-score span {
    margin-top: 0.35rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-align: center;
}

.modal-health-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.55rem;
}

.modal-health-metrics div {
    background: rgba(0, 0, 0, 0.12);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
}

.modal-health-metrics span {
    display: block;
    color: var(--muted);
    font-size: 0.66rem;
    margin-bottom: 0.2rem;
}

.modal-health-metrics strong {
    font-size: 0.95rem;
}

.modal-health-issues {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--muted);
    font-size: 0.78rem;
    display: grid;
    gap: 0.25rem;
}

.modal-health-meta {
    display: grid;
    gap: 0.35rem;
    font-size: 0.78rem;
}

.modal-health-meta span {
    color: var(--muted);
    margin-right: 0.45rem;
}

.backup-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.85rem;
    padding: 0 1.5rem 1rem;
}

.backup-import {
    display: inline-flex;
}

.form-hint {
    color: var(--muted);
    font-size: 0.78rem;
    margin: 0;
}

@media (max-width: 1100px) {
    .modal-health-grid { grid-template-columns: 1fr; }
    .modal-health-metrics { grid-template-columns: repeat(2, 1fr); }
}

.modal-path-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.74rem;
}

.modal-path-table th,
.modal-path-table td {
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
    overflow: hidden;
    min-width: 0;
}

.modal-path-table th:nth-child(1),
.modal-path-table td:nth-child(1) { width: 4.5rem; }

.modal-path-table th:nth-child(2),
.modal-path-table td:nth-child(2) { width: 18%; }

.modal-path-table th:nth-child(3),
.modal-path-table td:nth-child(3) { width: 8.5rem; }

.modal-path-table th:nth-child(5),
.modal-path-table td:nth-child(5) { width: 7.5rem; }

.modal-path-table th:nth-child(6),
.modal-path-table td:nth-child(6) { width: 5.25rem; }

.modal-path-table td code {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-path-table th {
    color: var(--muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.path-row--fresh { background: rgba(34, 197, 94, 0.04); }
.path-row--recent { background: rgba(56, 189, 248, 0.03); }

.path-folder-badge {
    display: inline-flex;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    font-size: 0.72rem;
    color: var(--muted);
}

.path-dir {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.path-time {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
}

.modal-path-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.85rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.modal-section-head {
    margin-bottom: 0.85rem;
}

.modal-section-head h3 {
    margin-bottom: 0.25rem;
}

.modal-section-head .form-hint {
    font-size: 0.8rem;
    line-height: 1.45;
}

.modal-section-paths {
    padding-bottom: 1.25rem;
}

.path-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: none;
    overflow: hidden;
    min-width: 0;
    padding-right: 0;
}

.path-empty {
    text-align: center;
    color: var(--muted);
    padding: 2rem 1rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.12);
}

.path-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 0;
}

.path-card--fresh {
    border-color: rgba(16, 185, 129, 0.35);
    box-shadow: inset 3px 0 0 var(--success);
}

.path-card--recent {
    border-color: rgba(56, 189, 248, 0.28);
    box-shadow: inset 3px 0 0 var(--info);
}

.path-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.path-fresh-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.path-fresh-badge--fresh {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.path-fresh-badge--recent {
    background: rgba(56, 189, 248, 0.15);
    color: #7dd3fc;
}

.path-fresh-badge--today {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.path-fresh-badge--stale {
    background: rgba(148, 163, 184, 0.12);
    color: var(--muted);
}

.path-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
}

.path-card-row {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 0.65rem;
    align-items: start;
}

.path-label {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-top: 0.15rem;
}

.path-value,
.path-link {
    font-size: 0.8rem;
    min-width: 0;
}

.path-value-break,
.path-link {
    word-break: break-all;
    overflow-wrap: anywhere;
    white-space: normal;
    line-height: 1.45;
}

.path-link {
    color: var(--info);
}

.path-card-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-top: 0.15rem;
}

.modal-table-wrap {
    max-height: 220px;
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    min-width: 0;
}

.modal-table-wrap table th,
.modal-table-wrap table td {
    padding: 0.45rem 0.55rem;
    font-size: 0.74rem;
}

.empty-cell {
    text-align: center;
    color: var(--muted);
    padding: 2.5rem !important;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    color: var(--text);
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    z-index: 10000;
    font-size: 0.88rem;
    font-weight: 500;
    animation: slideUp 0.3s ease;
    max-width: 360px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.65rem 1.1rem 0.8rem;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.12);
}

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

.builder-form {
    padding: 1.25rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.form-field label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-field input[type="text"],
.form-field input[type="file"],
.form-field textarea {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    font: inherit;
}

.form-field textarea {
    font-family: ui-monospace, monospace;
    font-size: 0.82rem;
    resize: vertical;
    min-height: 180px;
}

.form-field input:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.builder-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 0.25rem;
}

.preset-row {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.preset-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.preset-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.preset-chip {
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--muted);
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-chip:hover {
    color: var(--text);
    border-color: var(--primary);
}

.preset-chip.is-active {
    color: var(--text);
    border-color: rgba(99, 102, 241, 0.45);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(99, 102, 241, 0.06));
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.15);
}

.bundle-intro {
    margin: 0;
}

.payload-bundle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.payload-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.08);
    padding: 1rem 1.1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.payload-card-head {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.payload-enable-label code {
    font-size: 0.92rem;
}

.payload-card-hint {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

.payload-badge {
    display: inline-flex;
    align-self: flex-start;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.payload-badge--spread {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.payload-badge--inject {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.panel-subsection {
    padding: 1.25rem 1.5rem 1.5rem;
    border-top: 1px solid var(--border);
}

.panel-subsection h3 {
    font-size: 1rem;
    margin-bottom: 0.35rem;
}

.blocked-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 0.85rem;
}

.blocked-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.muted { color: var(--muted); }

.settings-form {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.settings-group {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.35rem 1.35rem;
    margin: 0;
    background: rgba(0, 0, 0, 0.08);
}

.settings-group legend {
    font-size: 0.95rem;
    font-weight: 800;
    padding: 0 0.35rem;
    color: var(--text);
}

.settings-group-desc {
    margin: 0.25rem 0 1rem;
}

.settings-form-footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: 0.25rem;
}

.panel-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.form-field input[type="number"],
.form-field input[type="password"] {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    font: inherit;
}

.form-field input.mono,
.form-field textarea.mono,
.settings-textarea {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85rem;
}

.settings-select {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}
    font-family: ui-monospace, monospace;
    font-size: 0.82rem;
}

.form-field--checkbox {
    justify-content: flex-end;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    text-transform: none;
    letter-spacing: normal;
    font-size: 0.92rem;
    padding: 0.5rem 0;
}

.checkbox-label input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary);
}

.input-with-action {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.input-with-action input {
    flex: 1;
    min-width: 0;
}

.field-error {
    display: none;
    color: var(--danger);
    font-size: 0.78rem;
    font-weight: 600;
}

.form-field.has-error input {
    border-color: var(--danger);
}

.kill-switch-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.25rem 1.5rem 1.5rem;
}

.kill-switch-row span {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.panel-compact .panel-header {
    padding-bottom: 0.85rem;
}

.tools-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    padding: 0 1.5rem 1.35rem;
}

.tool-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.tool-label {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tool-card-body {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.tool-status--danger { color: var(--danger); }
.tool-count { font-size: 1.35rem; line-height: 1; }
.tool-count-suffix { color: var(--muted); font-size: 0.85rem; }

.modal--blocked {
    max-width: 560px;
    max-height: min(85vh, 640px);
    display: flex;
    flex-direction: column;
}

.blocked-modal-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.5rem 1rem;
    flex-wrap: wrap;
}

.blocked-search {
    flex: 1;
    min-width: 180px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    font: inherit;
    font-size: 0.88rem;
}

.blocked-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.blocked-count-label {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.blocked-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 1.5rem;
    min-height: 120px;
    max-height: 360px;
}

.blocked-list--modal {
    padding: 0;
    max-height: none;
}

.blocked-modal-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.85rem 1.5rem 0.25rem;
}

.pagination-info {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.panel-muted {
    opacity: 0.92;
}

.payload-card--single {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.08);
    padding: 1rem 1.1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.filename-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.filename-example {
    display: inline-block;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    font-size: 0.8rem;
}

@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .modal-stats, .modal-info-grid, .modal-summary-grid, .modal-target-grid { grid-template-columns: repeat(2, 1fr); }
    .modal-config-row { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    body { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .payload-bundle { grid-template-columns: 1fr; }
    .tools-row { grid-template-columns: 1fr; }
    .log-item { grid-template-columns: 1fr; gap: 0.35rem; }
    .topbar { flex-direction: column; }
    .main { padding: 1.25rem; }
}
