:root {
    color: #202124;
    background: #f7f8fa;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f7f8fa; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    position: sticky; top: 0; display: flex; flex: 0 0 216px; flex-direction: column;
    height: 100vh; padding: 18px 12px; background: #fff; border-right: 1px solid #e8eaed;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 24px; text-decoration: none; }
.brand-mark { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid #b9d8ff; border-radius: 9px; color: #1677d8; background: #f0f8ff; font-weight: 800; }
.brand-name { font-size: 16px; font-weight: 750; }
.brand-subtitle { margin-top: 2px; color: #8a919d; font-size: 11px; letter-spacing: .05em; }
.nav-caption { padding: 14px 12px 7px; color: #9299a5; font-size: 12px; }
.nav-links { display: grid; gap: 3px; }
.nav-link { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 12px; border-radius: 8px; color: #525965; text-decoration: none; font-size: 14px; font-weight: 600; }
.nav-link:hover { background: #f4f6f8; }
.nav-link.active { color: #1769d6; background: #edf5ff; }
.nav-icon { width: 18px; color: currentColor; text-align: center; font-size: 16px; }
.sidebar-footer { margin-top: auto; padding: 16px 10px 4px; color: #8a919d; font-size: 12px; }

.workspace { min-width: 0; flex: 1; }
.topbar { display: flex; align-items: center; justify-content: flex-end; min-height: 64px; padding: 0 34px; border-bottom: 1px solid #e8eaed; background: rgba(255,255,255,.92); }
.account { display: flex; align-items: center; gap: 9px; color: #6b7280; font-size: 13px; }
.account-dot { width: 8px; height: 8px; border-radius: 50%; background: #18a66d; }
.logout-link { margin-left: 10px; color: #1769d6; text-decoration: none; font-weight: 650; }
.content { width: min(100%, 1420px); margin: 0 auto; padding: 28px 34px 46px; }

.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin: 0 0 20px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: 23px; line-height: 1.3; letter-spacing: 0; }
h2 { margin-bottom: 6px; font-size: 17px; line-height: 1.35; }
h3 { margin-bottom: 3px; font-size: 14px; }
.muted { color: #747b87; font-size: 13px; line-height: 1.55; }

.panel { border: 1px solid #e4e7eb; border-radius: 8px; background: #fff; }
.panel-padding { padding: 22px; }
.dashboard-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .68fr); overflow: hidden; }
.hero-copy { padding: 25px 28px; }
.eyebrow { margin-bottom: 10px; color: #3687df; font-size: 12px; font-weight: 700; }
.hero-title { margin-bottom: 8px; font-size: 27px; }
.hero-actions { display: flex; gap: 10px; margin-top: 20px; }
.hero-side { padding: 24px; border-left: 1px solid #e7ebef; background: #fbfcfd; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid #e9edf0; font-size: 13px; }
.status-row:last-child { border-bottom: 0; }
.status-label { color: #68707c; }
.status-value { color: #272c34; font-weight: 700; }
.status-ok { color: #139661; }

.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.stat-card { min-height: 142px; padding: 20px; border: 1px solid #e4e7eb; border-radius: 8px; background: #fff; }
.stat-icon { display: grid; width: 30px; height: 30px; place-items: center; margin-bottom: 16px; border-radius: 50%; color: #257cd4; background: #eef7ff; font-size: 14px; }
.stat-value { margin-bottom: 5px; font-size: 25px; font-weight: 750; line-height: 1; }
.stat-label { color: #67707c; font-size: 13px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 21px 22px 13px; }
.section-head h2 { margin-bottom: 4px; }

.table-wrap { overflow-x: auto; border: 1px solid #e4e7eb; border-radius: 8px; background: #fff; }
table { width: 100%; min-width: 780px; border-collapse: collapse; text-align: left; }
th, td { padding: 14px 16px; border-bottom: 1px solid #edf0f2; vertical-align: top; font-size: 13px; }
th { color: #7a828e; background: #fbfcfd; font-size: 12px; font-weight: 700; white-space: nowrap; }
td { color: #323840; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fcfdfe; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.empty { padding: 38px 20px; color: #7b8490; text-align: center; }

.button, button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 14px; border: 1px solid #2383e2; border-radius: 7px; background: #2383e2; color: #fff; font-size: 13px; font-weight: 700; text-decoration: none; }
.button:hover, button:hover { background: #146fc9; border-color: #146fc9; }
.button-secondary { border-color: #dce2e8; background: #fff; color: #4d5661; }
.button-secondary:hover { border-color: #b9c5d1; background: #f7f9fb; color: #26313d; }
.button-danger { border-color: #d92d20; background: #d92d20; }
.button-danger:hover { border-color: #b72318; background: #b72318; }
.button-small { min-height: 32px; padding: 0 11px; font-size: 12px; }

.notice, .error { margin: 0 0 16px; padding: 11px 13px; border-radius: 7px; font-size: 13px; }
.notice { border: 1px solid #bdebd5; color: #0b7850; background: #effcf5; }
.error { border: 1px solid #ffd1cc; color: #b42318; background: #fff4f2; }
.unlock-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .55fr); gap: 30px; padding: 26px; }
.unlock-copy { padding-right: 10px; }
.unlock-copy h2 { font-size: 21px; }
.unlock-form { align-self: center; }
.key-state { display: flex; align-items: center; gap: 8px; color: #138a5d; font-size: 13px; font-weight: 700; }
.key-state-dot { width: 8px; height: 8px; border-radius: 50%; background: #13a16b; }
.form-card { padding: 22px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, .38fr) auto; gap: 14px; align-items: end; }
label { display: grid; gap: 6px; color: #4e5661; font-size: 12px; font-weight: 700; }
input { width: 100%; min-height: 39px; padding: 0 11px; border: 1px solid #dce1e6; border-radius: 6px; outline: none; color: #20252b; background: #fff; }
input:focus { border-color: #4b9ce8; box-shadow: 0 0 0 3px #eaf5ff; }
input[type="checkbox"] { width: 16px; min-height: 16px; accent-color: #2383e2; }
textarea { width: 100%; min-height: 150px; padding: 11px; border: 1px solid #dce1e6; border-radius: 6px; outline: none; color: #20252b; resize: vertical; line-height: 1.55; }
textarea:focus { border-color: #4b9ce8; box-shadow: 0 0 0 3px #eaf5ff; }
.announcement-form { display: grid; gap: 16px; max-width: 760px; margin-top: 18px; }
.created-key { margin: 16px 0; padding: 16px 18px; border: 1px solid #b8d9ff; border-radius: 8px; background: #f4f9ff; }
.created-key strong { display: block; margin-top: 7px; color: #155fae; font-size: clamp(17px, 3vw, 25px); letter-spacing: .04em; overflow-wrap: anywhere; }
.license-key { color: #172f4b; font-weight: 700; }
.license-form { display: grid; grid-template-columns: minmax(155px, 1fr) minmax(180px, 1fr) minmax(78px, .45fr) minmax(90px, auto); gap: 8px; align-items: end; min-width: 580px; }
.license-form label { min-width: 0; }
.toggle-label { display: flex; align-items: center; min-height: 39px; white-space: nowrap; }
.row-actions { display: flex; gap: 7px; }

.auth-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: #f6f8fb; }
.auth { width: min(100%, 430px); padding: 30px; border: 1px solid #e4e7eb; border-radius: 10px; background: #fff; box-shadow: 0 14px 36px rgba(36, 48, 66, .08); }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 25px; }
.auth form { display: grid; gap: 14px; }
.auth form label { gap: 7px; }
.auth button { width: 100%; margin-top: 5px; }

@media (max-width: 820px) {
    .app-shell { display: block; }
    .sidebar { position: static; width: 100%; height: auto; padding: 13px 16px; border-right: 0; border-bottom: 1px solid #e8eaed; }
    .brand { padding: 0 2px 11px; }
    .nav-caption, .sidebar-footer { display: none; }
    .nav-links { display: flex; overflow-x: auto; gap: 5px; }
    .nav-link { flex: 0 0 auto; min-height: 34px; padding: 0 10px; }
    .topbar { min-height: 48px; padding: 0 18px; }
    .content { padding: 22px 16px 32px; }
    .dashboard-hero, .unlock-panel { grid-template-columns: 1fr; }
    .hero-side { border-top: 1px solid #e7ebef; border-left: 0; }
    .stats-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid button { width: 100%; }
}

@media (max-width: 480px) {
    .page-heading { display: block; }
    .page-heading > .button { margin-top: 12px; }
    .hero-copy, .hero-side, .panel-padding, .form-card, .unlock-panel { padding: 19px; }
    .hero-title { font-size: 23px; }
    .hero-actions { flex-direction: column; }
    .hero-actions .button { width: 100%; }
}
.status-bad { color: #d64545; }
.log-box {
    white-space: pre-wrap;
    word-break: break-all;
    background: #f6f8fa;
    border: 1px solid #e2e7ec;
    border-radius: 6px;
    padding: 8px 10px;
    max-height: 240px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.5;
    margin: 4px 0 0;
}
details summary { cursor: pointer; color: #2584e5; font-size: 13px; }
.captcha-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 10px; align-items: end; }
.captcha-image-button { width: 150px; min-height: 39px; padding: 0; border: 1px solid #dce1e6; border-radius: 7px; background: #f8fafc; overflow: hidden; }
.captcha-image-button:hover { background: #eef5fc; border-color: #b9cde3; }
.captcha-image-button img { display: block; width: 150px; height: 48px; object-fit: cover; }
.captcha-hint { margin: -7px 0 0; color: #8a919d; font-size: 12px; line-height: 1.45; }
.captcha-trap { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; }
@media (max-width: 480px) { .captcha-row { grid-template-columns: 1fr; } .captcha-image-button { width: 150px; } }