:root {
    color-scheme: dark;
    --bg: #06111f;
    --panel: rgba(12, 27, 47, .92);
    --panel-2: #0e2037;
    --line: rgba(115, 189, 255, .18);
    --text: #edf7ff;
    --muted: #8faac1;
    --cyan: #43d9ff;
    --blue: #367dff;
    --green: #39e6a0;
    --red: #ff6a7d;
    --yellow: #ffd166;
    --shadow: 0 22px 55px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background:
        radial-gradient(circle at 16% 5%, rgba(39, 152, 255, .23), transparent 28rem),
        radial-gradient(circle at 87% 18%, rgba(80, 54, 255, .18), transparent 30rem),
        linear-gradient(145deg, #050d18 0%, #071726 55%, #04101c 100%);
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .19;
    background-image:
        linear-gradient(rgba(100, 201, 255, .12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(100, 201, 255, .12) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, #000, transparent 88%);
}

a { color: var(--cyan); text-decoration: none; }
a:hover { color: #99edff; }
.container { width: min(1160px, calc(100% - 32px)); margin: 0 auto; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--line);
    background: rgba(5, 14, 25, .78);
    backdrop-filter: blur(18px);
}
.topbar-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand-row { display: flex; align-items: center; gap: 16px; }
.brand-row.compact { gap: 12px; }
.brand-logo { width: 66px; height: 66px; border-radius: 17px; object-fit: cover; box-shadow: 0 10px 28px rgba(18, 161, 255, .24); }
.compact .brand-logo { width: 48px; height: 48px; border-radius: 13px; }
.brand-row h1 { margin: 2px 0 0; font-size: clamp(23px, 4vw, 32px); }
.eyebrow { margin: 0 0 6px; color: var(--cyan); font-size: 11px; font-weight: 800; letter-spacing: .17em; }
.muted, small { color: var(--muted); }
.logout { padding: 10px 15px; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: rgba(255, 255, 255, .025); }

.login-page { display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(480px, 100%); }
.login-card, .panel, .hero-panel {
    border: 1px solid var(--line);
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(16, 37, 62, .96), rgba(8, 22, 38, .96));
    box-shadow: var(--shadow);
}
.login-card { padding: clamp(25px, 6vw, 42px); }
.login-card .muted { margin: 22px 0; line-height: 1.7; }

.dashboard { padding: 34px 0 48px; }
.hero-panel {
    display: grid;
    grid-template-columns: .82fr 1.5fr;
    gap: 30px;
    align-items: center;
    padding: 30px;
    overflow: hidden;
    position: relative;
}
.hero-panel::after {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    right: -80px;
    top: -120px;
    background: rgba(67, 217, 255, .16);
    filter: blur(12px);
}
.hero-panel h1 { margin: 0; display: flex; align-items: center; gap: 12px; font-size: 32px; }
.hero-panel p:last-child { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.status-dot { width: 13px; height: 13px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 7px rgba(255, 255, 255, .04); }
.status-dot.online { background: var(--green); box-shadow: 0 0 22px var(--green); }
.status-dot.offline { background: var(--red); box-shadow: 0 0 22px var(--red); }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.summary-grid div { min-height: 92px; padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: rgba(2, 11, 21, .35); }
.summary-grid span, .summary-grid strong { display: block; }
.summary-grid span { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.summary-grid strong { font-size: 15px; overflow-wrap: anywhere; }

.content-grid { margin-top: 20px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .75fr); gap: 20px; align-items: start; }
.panel { padding: 26px; }
.panel + .panel { margin-top: 20px; }
.panel-heading { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 24px; }
.panel-heading h2, .note-panel h2 { margin: 0; font-size: 20px; }
.badge { color: var(--green); background: rgba(57, 230, 160, .1); border: 1px solid rgba(57, 230, 160, .22); padding: 6px 10px; border-radius: 999px; font-size: 12px; }

form { display: grid; gap: 18px; }
label { display: grid; gap: 9px; color: #d8e8f6; font-size: 14px; font-weight: 650; }
label small { font-weight: 400; line-height: 1.5; }
input, textarea {
    width: 100%;
    border: 1px solid rgba(135, 191, 240, .2);
    border-radius: 12px;
    padding: 13px 14px;
    outline: none;
    color: var(--text);
    background: #081827;
    font: inherit;
    transition: border-color .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 100px; line-height: 1.55; }
input:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(67, 217, 255, .1); }
button { border: 0; border-radius: 12px; padding: 14px 18px; color: white; font: inherit; font-weight: 800; cursor: pointer; transition: transform .18s, filter .18s; }
button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.primary { background: linear-gradient(100deg, var(--blue), #27bce6); box-shadow: 0 12px 26px rgba(49, 126, 255, .22); }
.secondary { color: var(--cyan); background: rgba(67, 217, 255, .08); border: 1px solid rgba(67, 217, 255, .22); }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: rgba(2, 11, 21, .3); }
.switch-row strong, .switch-row small { display: block; }
.switch-row small { margin-top: 5px; }
.switch { position: relative; width: 54px; height: 30px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: #30465a; transition: .2s; }
.switch i::after { content: ""; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: white; transition: .2s; box-shadow: 0 3px 8px rgba(0,0,0,.3); }
.switch input:checked + i { background: linear-gradient(100deg, #1ac989, #35aaff); }
.switch input:checked + i::after { transform: translateX(24px); }

.alert { margin: 18px 0; padding: 14px 16px; border-radius: 13px; border: 1px solid; line-height: 1.55; }
.alert.error { color: #ffd7dd; border-color: rgba(255, 106, 125, .32); background: rgba(255, 106, 125, .1); }
.alert.success { color: #d4ffed; border-color: rgba(57, 230, 160, .3); background: rgba(57, 230, 160, .09); }
.note-panel p { color: var(--muted); line-height: 1.7; }
.note-panel code { display: block; padding: 13px; border-radius: 11px; color: var(--cyan); background: #061421; overflow-wrap: anywhere; }
footer { color: #68839a; text-align: center; padding: 0 0 28px; font-size: 12px; }

@media (max-width: 850px) {
    .hero-panel, .content-grid { grid-template-columns: 1fr; }
    .summary-grid { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 580px) {
    .container { width: min(100% - 22px, 1160px); }
    .dashboard { padding-top: 18px; }
    .hero-panel, .panel { padding: 20px; border-radius: 18px; }
    .hero-panel { gap: 22px; }
    .summary-grid { grid-template-columns: 1fr; }
    .summary-grid div { min-height: auto; }
    .topbar-inner { min-height: 66px; }
    .compact .brand-logo { width: 42px; height: 42px; }
    .compact .eyebrow { display: none; }
    .compact strong { font-size: 14px; }
    .logout { padding: 8px 11px; font-size: 13px; }
}
