:root {
  color-scheme: light;
  --ink: #15201c;
  --muted: #6f7d76;
  --line: #dfe6e2;
  --surface: #ffffff;
  --canvas: #f4f7f5;
  --green: #126c4d;
  --green-dark: #0b5039;
  --green-soft: #e7f3ed;
  --amber: #a66109;
  --red: #b93c3c;
  --shadow: 0 18px 60px rgba(23, 52, 40, .12);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.brand-mark { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 22px; border-radius: 18px; color: white; background: linear-gradient(145deg, #16805a, #0b4c36); font-size: 24px; font-weight: 900; box-shadow: 0 14px 30px rgba(18,108,77,.24); }
.brand-mark.small { width: 34px; height: 34px; margin: 0; border-radius: 11px; font-size: 15px; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 20%, #d9eee4, transparent 32%), radial-gradient(circle at 90% 80%, #dce9e3, transparent 30%), #f7faf8; }
.login-card { width: min(440px, 100%); padding: 48px; border: 1px solid rgba(255,255,255,.9); border-radius: 28px; background: rgba(255,255,255,.92); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
h1, h2 { margin: 0; letter-spacing: -.03em; }
.login-card h1 { font-size: 34px; }
.stack { display: grid; gap: 18px; margin-top: 32px; }
label { display: grid; gap: 8px; color: #3d4a44; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; color: var(--ink); background: white; outline: none; transition: .18s ease; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(18,108,77,.1); }
button { border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 750; }
.primary { color: white; background: var(--green); }
.primary:hover { background: var(--green-dark); }
.secondary { color: var(--ink); border: 1px solid var(--line); background: white; }
.danger { color: white; background: var(--red); }
.warning { color: white; background: var(--amber); }
.text-button, .icon-button { padding: 4px; color: var(--muted); background: transparent; }
.error-text { min-height: 18px; margin: 0; color: var(--red); font-size: 13px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px 1fr; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 236px; display: flex; flex-direction: column; padding: 24px 16px; color: white; background: #12281f; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 28px; }
.sidebar nav { display: grid; gap: 6px; }
.nav-item { width: 100%; padding: 13px 14px; color: #b8c9c1; text-align: left; background: transparent; }
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.1); }
.sidebar-footer { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 16px 10px 0; border-top: 1px solid rgba(255,255,255,.12); color: #b8c9c1; font-size: 13px; }
.sidebar-footer #admin-name { margin-right: auto; }
.workspace { grid-column: 2; min-width: 0; padding: 36px 42px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.topbar h1 { font-size: 30px; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.enforcement-control { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 13px; white-space: nowrap; }
.enforcement-control input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.enforcement-control i { position: relative; width: 42px; height: 24px; border-radius: 999px; background: #c7d1cb; transition: .18s ease; }
.enforcement-control i::after { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.18); content: ''; transition: .18s ease; }
.enforcement-control input:checked + i { background: var(--green); }
.enforcement-control input:checked + i::after { transform: translateX(18px); }
.enforcement-control input:focus-visible + i { box-shadow: 0 0 0 3px rgba(18,108,77,.2); }
.enforcement-control input:disabled + i { opacity: .58; }
.enforcement-control strong { min-width: 42px; color: var(--muted); font-size: 12px; }
.enforcement-control.is-enabled strong { color: var(--green); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.stat-card strong { display: block; margin-top: 10px; font-size: 30px; letter-spacing: -.04em; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.toolbar { display: flex; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line); }
.toolbar input { max-width: 360px; }
.toolbar select { width: 150px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 13px 16px; color: var(--muted); background: #f9fbfa; text-align: left; font-size: 11px; letter-spacing: .05em; }
td { padding: 15px 16px; border-top: 1px solid #edf1ef; vertical-align: top; }
tbody tr:hover { background: #fafcfb; }
.domain-list { display: grid; gap: 4px; }
.domain-list code { color: var(--ink); }
.badge { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.badge.active, .badge.success { color: var(--green); background: var(--green-soft); }
.badge.disabled { color: var(--amber); background: #fff1d8; }
.badge.revoked, .badge.failed { color: var(--red); background: #fde9e9; }
.empty { padding: 48px; color: var(--muted); text-align: center; }
dialog { width: min(620px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 20px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(10, 24, 18, .52); backdrop-filter: blur(4px); }
.dialog-card { padding: 28px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.icon-button { font-size: 26px; line-height: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 9px; }
.check input { width: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.key-result { text-align: center; }
.success-icon { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 16px; border-radius: 50%; color: white; background: var(--green); font-size: 26px; }
.key-result code { display: block; margin: 24px 0; padding: 18px; border-radius: 12px; color: #0d5139; background: #edf7f2; font-size: 16px; word-break: break-all; }
.detail-card { max-height: 86vh; overflow: auto; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 22px; }
.detail-item { padding: 13px; border-radius: 10px; background: var(--canvas); }
.detail-item span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.section-title { margin: 24px 0 10px; font-size: 14px; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.compact-stack { margin-top: 0; }
.password-hint { margin: 14px 0; font-size: 12px; }
.toast { position: fixed; right: 26px; bottom: 26px; z-index: 20; max-width: 380px; padding: 13px 18px; border-radius: 11px; color: white; background: #183b2e; box-shadow: var(--shadow); }
@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: auto; min-height: auto; flex-direction: row; align-items: center; gap: 16px; }
  .sidebar-brand { padding: 0; }
  .sidebar nav { display: flex; }
  .sidebar-footer { margin: 0 0 0 auto; padding: 0; border: 0; gap: 10px; }
  .workspace { padding: 24px 18px 50px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .sidebar-brand strong, #admin-name { display: none; }
  .topbar { align-items: flex-start; }
  .topbar-actions { align-items: flex-end; flex-direction: column; gap: 10px; }
  .stats-grid, .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .toolbar { flex-wrap: wrap; }
  .login-card { padding: 30px; }
}
