:root {
    --bg: #f4f6f9;
    --panel: #ffffff;
    --line: #dfe4eb;
    --text: #182230;
    --muted: #667085;
    --blue: #1769e0;
    --blue-dark: #0d4fae;
    --green: #137a4d;
    --green-bg: #e9f7f0;
    --red: #b42318;
    --red-bg: #fff0ee;
    --amber: #9a6700;
    --amber-bg: #fff7d6;
    font-family: Arial, "Microsoft YaHei", sans-serif;
    color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 14px; line-height: 1.55; }
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
code { color: #304765; font-family: Consolas, monospace; word-break: break-all; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: #172235; color: #fff; }
.brand { display: block; padding: 25px 24px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand strong { display: block; font-size: 18px; letter-spacing: 0; }
.brand span { display: block; margin-top: 2px; color: #9fb0c7; font-size: 12px; }
.nav-list { padding: 16px 12px; }
.nav-list a { display: block; padding: 10px 12px; margin-bottom: 4px; border-radius: 5px; color: #c9d4e2; }
.nav-list a:hover, .nav-list a.active { color: #fff; background: #263853; }
.sidebar-foot { margin-top: auto; padding: 18px 24px; border-top: 1px solid rgba(255,255,255,.1); display: flex; justify-content: space-between; gap: 12px; color: #9fb0c7; }
.sidebar-foot a { color: #fff; }
.main-area { min-width: 0; }
.topbar { min-height: 70px; padding: 0 30px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; }
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: 0; }
.topbar .button { margin-left: auto; }
.menu-toggle { display: none; border: 1px solid var(--line); background: #fff; border-radius: 4px; padding: 6px 10px; }
.content-area { padding: 28px 30px 50px; }
.panel { margin-bottom: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.panel-head { min-height: 56px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); gap: 16px; }
.panel-head h2, .section-title h2 { margin: 0; font-size: 16px; letter-spacing: 0; }
.panel-head span, .section-title span { color: var(--muted); font-size: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.metric { min-height: 116px; padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: 6px; color: var(--text); display: flex; flex-direction: column; justify-content: space-between; }
.metric span { color: var(--muted); }
.metric strong { font-size: 30px; letter-spacing: 0; }
.table-wrap { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid #edf0f4; text-align: left; vertical-align: middle; }
th { color: #475467; background: #fafbfc; font-size: 12px; font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td small { display: block; margin-top: 3px; color: var(--muted); }
.actions-col { width: 120px; }
.actions { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.actions form { margin: 0; }
.domain-cell { min-width: 180px; max-width: 320px; }
.nowrap { white-space: nowrap; }
.empty { height: 100px; color: var(--muted); text-align: center; }
.status { display: inline-flex; min-width: 46px; justify-content: center; padding: 2px 8px; border-radius: 12px; font-size: 12px; white-space: nowrap; }
.status.active { color: var(--green); background: var(--green-bg); }
.status.disabled, .status.suspended { color: var(--amber); background: var(--amber-bg); }
.status.revoked { color: var(--red); background: var(--red-bg); }
.button { display: inline-flex; min-height: 36px; padding: 7px 14px; align-items: center; justify-content: center; border: 1px solid #cfd6df; border-radius: 5px; background: #fff; color: #344054; line-height: 1.2; }
.button:hover { background: #f8fafc; }
.button.primary { border-color: var(--blue); background: var(--blue); color: #fff; }
.button.primary:hover { background: var(--blue-dark); }
.button.danger { border-color: #e8a39d; color: var(--red); }
.button.small { min-height: 30px; padding: 5px 10px; font-size: 12px; }
.button.wide { width: 100%; }
.alert { margin-bottom: 20px; padding: 12px 16px; border: 1px solid; border-radius: 5px; }
.alert.success { color: var(--green); border-color: #b8dfcc; background: var(--green-bg); }
.alert.error { color: var(--red); border-color: #f3bbb5; background: var(--red-bg); }
.license-reveal { margin-top: 10px; display: flex; align-items: center; gap: 10px; }
.license-reveal code { padding: 8px 10px; background: #fff; border: 1px solid #b8dfcc; border-radius: 4px; color: #102a43; font-size: 15px; }
.split-layout { display: flex; gap: 20px; align-items: flex-start; }
.split-layout .grow { flex: 1 1 auto; min-width: 0; }
.form-panel { flex: 0 0 360px; }
.form-panel .form-stack { padding: 20px; }
.form-stack { display: grid; gap: 16px; }
label { display: grid; gap: 6px; color: #344054; font-weight: 600; }
label small { color: var(--muted); font-weight: 400; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
    width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #cfd6df; border-radius: 4px; background: #fff; color: var(--text); outline: none;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(23,105,224,.12); }
.form-actions { display: flex; align-items: center; gap: 10px; }
.license-form { padding: 0 22px 22px; }
.section-title { margin: 0 -22px 20px; padding: 18px 22px 12px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.section-title:not(:first-of-type) { margin-top: 26px; }
.form-grid { display: grid; gap: 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
fieldset { margin: 0 0 18px; padding: 0; border: 0; }
legend { margin-bottom: 8px; color: #344054; font-weight: 600; }
.check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.check-item { min-height: 58px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 4px; font-weight: 600; }
.check-item input { flex: 0 0 auto; }
.check-item small { display: block; }
.check-line { margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.sticky-actions { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.danger-zone { padding: 18px 20px; border: 1px solid #f3bbb5; background: #fff; border-radius: 6px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.danger-zone div { display: grid; gap: 3px; }
.danger-zone span { color: var(--muted); }
.system-panel { padding-bottom: 20px; }
.system-panel > label, .system-panel > .button { margin-left: 20px; margin-right: 20px; }
.system-panel > label { margin-top: 18px; }
.info-list { margin: 0; }
.info-list > div { padding: 12px 20px; border-bottom: 1px solid #edf0f4; display: grid; grid-template-columns: 140px minmax(0,1fr); align-items: center; gap: 16px; }
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; display: flex; align-items: center; gap: 10px; min-width: 0; }
.copy-helper { position: fixed; left: -9999px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: #eef2f7; }
.login-panel { width: min(400px, 100%); padding: 32px; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 10px 30px rgba(32,48,70,.08); }
.login-brand { margin-bottom: 26px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.login-brand strong { display: block; font-size: 22px; }
.login-brand span { color: var(--muted); }
@media (max-width: 1050px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split-layout { display: grid; }
    .form-panel { width: 100%; }
    .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .app-shell { display: block; }
    .sidebar { position: fixed; z-index: 20; left: -240px; width: 224px; transition: left .2s ease; box-shadow: 8px 0 24px rgba(0,0,0,.16); }
    .menu-open .sidebar { left: 0; }
    .topbar { min-height: 60px; padding: 0 16px; }
    .topbar h1 { font-size: 18px; }
    .menu-toggle { display: inline-flex; }
    .content-area { padding: 18px 14px 36px; }
    .metric-grid { gap: 10px; }
    .metric { min-height: 96px; padding: 14px; }
    .metric strong { font-size: 25px; }
    .form-grid.two, .form-grid.four, .check-grid { grid-template-columns: 1fr; }
    .danger-zone { align-items: flex-start; flex-direction: column; }
    .info-list > div { grid-template-columns: 1fr; gap: 4px; }
    .info-list dd { align-items: flex-start; flex-direction: column; }
    .login-panel { padding: 24px; }
}
