:root {
    color-scheme: light;
    --bg: #f3f6fb;
    --panel: #ffffff;
    --text: #162033;
    --muted: #657089;
    --line: #dce3ef;
    --blue: #1683e2;
    --blue-dark: #0e68b7;
    --green: #16875d;
    --red: #c53b4a;
    --amber: #9a6812;
    --shadow: 0 14px 40px rgba(28, 44, 76, .08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.55;
}
a { color: var(--blue-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
.text-danger { color: var(--red); }
button, input { font: inherit; }
code {
    border-radius: 5px;
    background: #eef3f9;
    padding: 2px 5px;
    font-family: "SFMono-Regular", Consolas, monospace;
    overflow-wrap: anywhere;
}
.shell { width: min(1480px, calc(100% - 32px)); margin-inline: auto; }
.site-header {
    border-bottom: 1px solid var(--line);
    background: rgba(255,255,255,.96);
}
.header-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { color: var(--text); font-size: 19px; font-weight: 750; letter-spacing: .02em; }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 18px; }
.page { min-height: calc(100vh - 130px); padding-block: 36px 56px; }
.footer { color: var(--muted); padding-block: 0 26px; text-align: center; }
h1, h2 { line-height: 1.2; margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(25px, 3vw, 36px); }
h2 { margin-bottom: 16px; font-size: 20px; }
.eyebrow { margin: 0 0 7px; color: var(--blue-dark); font-size: 12px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.muted { margin: 0; color: var(--muted); }
.nowrap { white-space: nowrap; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.count-card {
    min-width: 150px;
    border: 1px solid #b9d7f2;
    border-radius: 14px;
    background: #eaf5ff;
    padding: 16px 22px;
    color: var(--blue-dark);
    text-align: right;
    font-size: 18px;
}
.count-card span { font-size: 38px; font-weight: 800; }
.auth-card, .panel {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: var(--shadow);
}
.auth-card { width: min(460px, 100%); margin: 5vh auto 0; padding: clamp(24px, 5vw, 42px); }
.wide-card { width: min(680px, 100%); margin-top: 0; }
.panel { margin-bottom: 24px; padding: 24px; }
.stack-form { display: grid; gap: 17px; margin-top: 28px; }
.compact-form { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: 14px; align-items: start; }
label { display: grid; gap: 7px; color: #39455c; font-weight: 650; }
input {
    width: 100%;
    min-height: 42px;
    border: 1px solid #bdc8d9;
    border-radius: 7px;
    outline: none;
    background: #fff;
    color: var(--text);
    padding: 9px 11px;
}
input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22, 131, 226, .13); }
.captcha-control {
    display: grid;
    grid-template-columns: minmax(110px, 1fr) 176px;
    gap: 10px;
    align-items: stretch;
}
.captcha-image-link {
    display: block;
    overflow: hidden;
    border: 1px solid #bdc8d9;
    border-radius: 7px;
    background: #f4f8fc;
    line-height: 0;
}
.captcha-image-link:hover { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(22, 131, 226, .1); }
.captcha-image { display: block; width: 100%; height: auto; aspect-ratio: 220 / 64; object-fit: contain; }
.captcha-help { color: var(--muted); font-weight: 400; }
button, .button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    padding: 9px 16px;
    font-weight: 700;
    text-decoration: none;
}
.button:hover { text-decoration: none; }
.primary { border-color: var(--blue); background: var(--blue); color: #fff; }
.primary:hover { background: var(--blue-dark); }
.secondary { border-color: #b9c8da; background: #fff; color: #31415b; }
.danger { border-color: var(--red); background: #fff; color: var(--red); }
.align-end { align-self: end; }
.inline-form { display: inline-flex; margin: 0; }
.link-button { min-height: 0; border: 0; background: none; color: var(--blue-dark); padding: 0; }
.danger-link { color: var(--red); }
.auth-switch { margin: 22px 0 0; text-align: center; }
.alert { margin-bottom: 20px; border: 1px solid; border-radius: 8px; padding: 11px 14px; }
.alert-success { border-color: #a6ddc7; background: #eaf9f3; color: #116947; }
.alert-error { border-color: #efbbc1; background: #fff0f2; color: #a72938; }
.check-list { list-style: none; margin: 24px 0; padding: 0; display: grid; gap: 8px; }
.check-ok { color: var(--green); }
.check-fail { color: var(--red); }
.actions { display: flex; gap: 10px; margin: -8px 0 18px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 12px 13px; text-align: left; vertical-align: top; }
th { background: #f7f9fc; color: #526078; font-size: 12px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfe; }
td small { display: block; margin-top: 5px; color: var(--muted); }
.compact-table table { min-width: 720px; }
.empty { border: 1px dashed #c4cede; border-radius: 10px; padding: 34px; color: var(--muted); text-align: center; background: rgba(255,255,255,.6); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.section-heading h2 { margin-bottom: 0; }
.section-heading span { color: var(--muted); }
.section-heading > div { display: flex; align-items: center; gap: 16px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.badge { display: inline-flex; border-radius: 100px; padding: 3px 9px; font-size: 12px; font-weight: 700; }
.badge-ok { background: #e6f7f0; color: var(--green); }
.badge-off { background: #edf0f4; color: #70798b; }
.secret-box { border: 1px solid #e5c36e; border-radius: 10px; background: #fff9e8; margin-bottom: 24px; padding: 18px; color: #6c4d08; }
.secret-box code { display: block; margin: 12px 0 7px; background: #fff; padding: 10px; user-select: all; }
.secret-box p { margin: 0; }

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 18px;
}
.stat-card {
    display: block;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    padding: 16px 18px;
    color: inherit;
    text-decoration: none;
    box-shadow: var(--shadow);
}
.stat-card:hover { text-decoration: none; border-color: #b9c7db; }
.stat-card.active { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(22,131,226,.12); }
.stat-card .stat-label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.stat-card strong { display: block; font-size: 28px; line-height: 1.1; }
.stat-card small { display: block; margin-top: 6px; color: var(--muted); }
.kind-tag {
    display: inline-flex;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.kind-startup_block { background: #fff0f2; color: #a72938; }
.kind-runtime_event { background: #eaf4ff; color: #0e68b7; }
.kind-other { background: #edf0f4; color: #70798b; }

.ip-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}
.ip-sidebar {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.ip-sidebar-title {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.ip-list { display: grid; max-height: min(70vh, 720px); overflow: auto; }
.ip-item {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    color: inherit;
    text-decoration: none;
}
.ip-item:last-child { border-bottom: 0; }
.ip-item:hover { background: #f7fafc; text-decoration: none; }
.ip-item.active { background: #eaf5ff; box-shadow: inset 3px 0 0 var(--blue); }
.ip-item strong { font-size: 15px; word-break: break-all; }
.ip-item span { color: var(--blue-dark); font-weight: 700; }
.ip-item small { color: var(--muted); }
.ip-detail {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 20px;
    min-height: 280px;
}
.ip-detail-heading { margin-bottom: 16px; }
.ip-detail-heading h2 { margin: 0 0 6px; font-size: 22px; word-break: break-all; }

@media (max-width: 900px) {
    .form-grid, .two-column, .stats-row, .ip-layout { grid-template-columns: 1fr; }
    .page-heading { align-items: flex-start; }
    .count-card { min-width: 120px; }
}
@media (max-width: 620px) {
    .shell { width: min(100% - 20px, 1480px); }
    .header-inner { min-height: 58px; }
    .brand { font-size: 16px; }
    .nav { gap: 10px; }
    .page { padding-top: 22px; }
    .page-heading { display: grid; }
    .count-card { width: 100%; text-align: left; }
    .panel { padding: 17px; }
    .actions { flex-wrap: wrap; }
}
@media (max-width: 420px) {
    .captcha-control { grid-template-columns: 1fr; }
}
