:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --line: #dfe7f1;
    --text: #172033;
    --muted: #64748b;
    --accent: #1d4ed8;
    --accent-2: #0f9f6e;
    --danger: #dc2626;
    --warning: #d97706;
    --success: #059669;
    --shadow: 0 18px 48px rgba(15, 23, 42, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.boot-loading {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.boot-card {
    width: min(320px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
}

.boot-card strong {
    font-size: 17px;
}

.boot-card span {
    color: var(--muted);
    font-size: 13px;
}

.boot-spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid #dbeafe;
    border-top-color: var(--accent);
    animation: bootSpin .75s linear infinite;
}

@keyframes bootSpin {
    to { transform: rotate(360deg); }
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.center-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}

.side {
    background: #0f172a;
    color: #dbeafe;
    padding: 22px 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.brand-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb, #10b981);
    color: #fff;
    font-weight: 800;
}

.brand h1 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    line-height: 1.3;
}

.brand p {
    margin: 2px 0 0;
    color: #93a4bd;
    font-size: 12px;
}

.side-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.site-list {
    display: grid;
    gap: 8px;
}

.site-item {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 9px;
    padding: 12px;
    background: rgba(15, 23, 42, .56);
    color: #e5edf8;
    text-align: left;
}

.site-item.active {
    border-color: rgba(96, 165, 250, .72);
    background: rgba(37, 99, 235, .22);
}

.site-item strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.site-item span {
    display: block;
    color: #9fb0c6;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.main {
    min-width: 0;
    padding: 24px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
}

.topbar h2 {
    margin: 0 0 5px;
    font-size: 24px;
    letter-spacing: 0;
}

.topbar p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
    gap: 18px;
    align-items: start;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-head {
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.panel-head h3 {
    margin: 0;
    font-size: 16px;
}

.panel-head p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.panel-body {
    padding: 20px;
}

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

.field {
    display: grid;
    gap: 7px;
}

.field.full {
    grid-column: 1 / -1;
}

.field label {
    color: #334155;
    font-size: 13px;
    font-weight: 650;
}

.field small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.input,
.textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    padding: 10px 11px;
    outline: none;
}

.textarea {
    min-height: 92px;
    resize: vertical;
    line-height: 1.6;
}

.input:focus,
.textarea:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, .18);
}

.switch-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel-soft);
    color: #334155;
    font-size: 13px;
}

.switch input {
    width: 16px;
    height: 16px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.btn {
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 10px 13px;
    background: #e2e8f0;
    color: #1e293b;
    font-size: 13px;
    font-weight: 650;
}

.btn.primary {
    background: var(--accent);
    color: #fff;
}

.btn.success {
    background: var(--accent-2);
    color: #fff;
}

.btn.danger {
    background: #fee2e2;
    color: var(--danger);
}

.btn.ghost {
    background: transparent;
    border-color: rgba(148, 163, 184, .35);
    color: inherit;
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.notice {
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    background: #eff6ff;
    color: #1e40af;
    font-size: 13px;
    line-height: 1.7;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 9px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 12px;
    font-weight: 650;
}

.status.on {
    background: #dcfce7;
    color: #166534;
}

.status.off {
    background: #fee2e2;
    color: #991b1b;
}

.code {
    margin: 0;
    max-height: 320px;
    overflow: auto;
    padding: 14px;
    border-radius: 10px;
    background: #0f172a;
    color: #dbeafe;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tab {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 9px;
    padding: 9px 12px;
    color: #475569;
    font-size: 13px;
    font-weight: 650;
}

.tab.active {
    color: #fff;
    border-color: var(--accent);
    background: var(--accent);
}

.log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.log-table th,
.log-table td {
    border-bottom: 1px solid #eef2f7;
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
}

.log-table th {
    color: #475569;
    background: #f8fafc;
    font-weight: 700;
}

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

.empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--muted);
}

.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-box {
    width: min(460px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 26px;
}

.login-box h1 {
    margin: 0 0 8px;
    font-size: 24px;
}

.login-box p {
    margin: 0 0 18px;
    color: var(--muted);
    line-height: 1.7;
    font-size: 13px;
}

.toast {
    position: fixed;
    right: 20px;
    top: 20px;
    max-width: min(420px, calc(100vw - 40px));
    padding: 13px 15px;
    border-radius: 10px;
    background: #0f172a;
    color: #fff;
    box-shadow: var(--shadow);
    z-index: 10;
    font-size: 13px;
}

@media (max-width: 980px) {
    .center-shell {
        grid-template-columns: 1fr;
    }
    .side {
        position: static;
    }
    .grid,
    .form-grid {
        grid-template-columns: 1fr;
    }
}
