:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: #18201d;
  background: #f2f4f1;
  font-synthesis: none;
  --ink: #18201d;
  --muted: #65716c;
  --line: #dce2dd;
  --surface: #ffffff;
  --soft: #edf2ee;
  --accent: #356b57;
  --accent-dark: #285242;
  --accent-soft: #e3f0e9;
  --danger: #b43d35;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 980px; min-height: 100vh; background: #f2f4f1; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(53, 107, 87, .2); outline-offset: 2px; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.admin-rail { position: sticky; top: 0; height: 100vh; padding: 24px 16px; display: flex; flex-direction: column; color: #f5f7f5; background: #161c19; }
.rail-brand, .login-brand { display: flex; align-items: center; gap: 12px; }
.rail-brand { padding: 0 8px 28px; border-bottom: 1px solid #2a322e; }
.rail-brand strong, .login-brand strong { display: block; font-size: 16px; }
.rail-brand small, .login-brand small { display: block; margin-top: 4px; color: #9da9a3; font-size: 10px; }
.brand-mark { width: 38px; aspect-ratio: 1; position: relative; display: grid; place-items: center; border-radius: 9px; background: #eff7f2; overflow: hidden; flex: 0 0 auto; }
.brand-mark span { position: absolute; height: 3px; border-radius: 3px; background: var(--accent); transform-origin: right center; }
.brand-mark span:nth-child(1) { width: 23px; transform: translate(-1px, -7px) rotate(24deg); }
.brand-mark span:nth-child(2) { width: 27px; transform: translate(-3px, 0) rotate(-8deg); }
.brand-mark span:nth-child(3) { width: 18px; transform: translate(3px, 7px) rotate(-34deg); }
.admin-rail nav { display: grid; gap: 6px; margin-top: 24px; }
.admin-rail nav button { min-height: 44px; padding: 0 13px; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 7px; color: #abb5b0; background: transparent; text-align: left; }
.admin-rail nav button:hover { color: #fff; background: #202823; }
.admin-rail nav button.active { color: #fff; background: #2e5f4d; }
.admin-rail nav button span { width: 20px; text-align: center; }
.rail-foot { margin-top: auto; padding: 18px 8px 0; border-top: 1px solid #2a322e; }
.rail-foot > span { display: block; color: #8d9993; font-size: 12px; }
.rail-foot strong { display: block; margin-top: 5px; }
.rail-foot button { margin-top: 14px; padding: 0; border: 0; color: #aeb8b3; background: transparent; }
.rail-foot button:hover { color: #fff; }

.admin-main { min-width: 0; padding: 30px 34px 48px; }
.admin-view { display: none; max-width: 1480px; margin: 0 auto; }
.admin-view.active { display: block; }
.page-head { min-height: 72px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.page-head h1 { margin: 0; font-size: 28px; line-height: 1.2; }
.page-head p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.primary, .secondary { min-height: 42px; padding: 0 18px; border-radius: 7px; font-weight: 650; }
.primary { border: 1px solid var(--accent); color: #fff; background: var(--accent); }
.primary:hover { background: var(--accent-dark); }
.secondary { border: 1px solid #cfd7d1; color: var(--ink); background: #fff; }
.secondary:hover { background: #f4f6f4; }
.metrics { margin: 20px 0; display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.metrics div { min-height: 92px; padding: 20px 22px; border-right: 1px solid var(--line); }
.metrics div:last-child { border-right: 0; }
.metrics span { display: block; color: var(--muted); font-size: 13px; }
.metrics strong { display: block; margin-top: 10px; font-size: 24px; font-variant-numeric: tabular-nums; }

.data-panel { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.table-tools { min-height: 72px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.search-field { width: min(430px, 42vw); position: relative; }
.search-field span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.search-field input, .dialog-body input, .dialog-body textarea { width: 100%; border: 1px solid #cfd7d1; border-radius: 7px; color: var(--ink); background: #fff; }
.search-field input { height: 42px; padding: 0 13px; }
.filter-tabs { padding: 3px; display: flex; gap: 2px; border-radius: 7px; background: var(--soft); }
.filter-tabs button { min-height: 34px; padding: 0 12px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; }
.filter-tabs button.active { color: var(--accent-dark); background: #fff; box-shadow: 0 1px 4px rgba(20, 33, 27, .12); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid #e7ebe8; text-align: left; vertical-align: middle; }
th { color: #6e7974; background: #fafbfa; font-size: 12px; font-weight: 650; }
td { font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfb; }
.license-code { display: flex; align-items: center; gap: 8px; font-family: Consolas, monospace; font-weight: 650; }
.copy-button, .row-button, .icon-button { border: 1px solid #d5dcd7; color: #52605a; background: #fff; }
.copy-button { width: 28px; height: 28px; border-radius: 5px; }
.row-button { min-height: 32px; padding: 0 11px; border-radius: 6px; }
.row-button:hover, .copy-button:hover, .icon-button:hover { color: var(--accent-dark); background: var(--soft); }
.status { display: inline-flex; min-height: 26px; padding: 0 9px; align-items: center; border-radius: 999px; font-size: 12px; font-weight: 650; }
.status.active { color: #256044; background: #e5f3eb; }
.status.unused { color: #5b6670; background: #edf0f2; }
.status.expired, .status.disabled { color: #92382f; background: #fae9e7; }
.muted { color: var(--muted); }
.empty-state { min-height: 320px; padding: 40px; display: grid; place-content: center; text-align: center; }
.empty-state[hidden] { display: none; }
.empty-state strong { font-size: 17px; }
.empty-state span { margin-top: 8px; color: var(--muted); font-size: 13px; }
.release-list { display: grid; }
.release-item { min-height: 90px; padding: 18px 20px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px; border-bottom: 1px solid var(--line); }
.release-item:last-child { border-bottom: 0; }
.release-item h3 { margin: 0; font-size: 16px; }
.release-item p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.release-item code { font-family: Consolas, monospace; color: #52605a; }

dialog { padding: 0; border: 0; border-radius: 10px; color: var(--ink); background: #fff; box-shadow: 0 18px 48px rgba(16, 24, 20, .24); }
dialog::backdrop { background: rgba(18, 24, 21, .52); }
.sheet-dialog { width: min(620px, calc(100vw - 48px)); }
.detail-dialog { width: min(760px, calc(100vw - 48px)); }
.dialog-head { min-height: 86px; padding: 20px 24px; display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 21px; }
.dialog-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.icon-button { width: 34px; height: 34px; border-radius: 6px; font-size: 22px; line-height: 1; }
.dialog-body { padding: 22px 24px 24px; display: grid; gap: 18px; }
.dialog-body > label, .field-row label { display: grid; gap: 8px; font-size: 13px; font-weight: 650; }
.dialog-body input { height: 44px; padding: 0 12px; }
.dialog-body textarea { padding: 11px 12px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
fieldset { margin: 0; padding: 0; border: 0; }
fieldset legend { margin-bottom: 9px; font-size: 13px; font-weight: 650; }
.choice { min-height: 62px; padding: 12px; display: flex; align-items: center; gap: 11px; border: 1px solid #d4dbd6; }
.choice:first-of-type { border-radius: 7px 7px 0 0; }
.choice:last-of-type { border-top: 0; border-radius: 0 0 7px 7px; }
.choice input { width: 16px; height: 16px; }
.choice span { display: grid; gap: 3px; }
.choice strong { font-size: 13px; }
.choice small { color: var(--muted); font-weight: 400; }
.toggle-line { display: flex !important; grid-template-columns: none; align-items: center; gap: 10px !important; }
.toggle-line input { width: 17px; height: 17px; }
.dialog-actions { padding-top: 4px; display: flex; justify-content: flex-end; gap: 10px; }
.detail-content { max-height: min(720px, calc(100vh - 80px)); overflow: auto; }
.detail-content .dialog-head { position: sticky; top: 0; background: #fff; z-index: 1; }
.detail-section { padding: 20px 24px; border-bottom: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 14px; font-size: 15px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.detail-grid span { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.detail-grid strong { color: var(--ink); font-size: 13px; }
.full-code { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; border-radius: 7px; background: var(--soft); font-family: Consolas, monospace; font-size: 15px; }
.device-row { padding: 13px 0; display: grid; grid-template-columns: 1fr auto; gap: 14px; border-top: 1px solid #e6ebe7; }
.device-row:first-of-type { border-top: 0; }
.device-row strong, .device-row small { display: block; }
.device-row small { margin-top: 4px; color: var(--muted); }
.detail-actions { padding: 18px 24px; display: flex; justify-content: space-between; gap: 12px; }
.detail-actions-group { display: flex; gap: 8px; }
.danger { border-color: #efc7c3; color: var(--danger); background: #fff; }
.danger:hover { background: #fff1ef; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 380px; padding: 13px 16px; border-radius: 7px; color: #fff; background: #26322d; box-shadow: 0 8px 20px rgba(16, 24, 20, .2); z-index: 10; }
.toast.error { background: #8e342e; }

.login-body { min-width: 720px; display: grid; place-items: center; color: #edf3ef; background: #151b18; }
.login-shell { width: min(940px, calc(100vw - 64px)); min-height: 560px; display: grid; grid-template-columns: 1fr 1fr; border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 0 24px 70px rgba(0, 0, 0, .28); }
.login-brand { position: relative; padding: 48px; align-items: flex-start; background: #1a211d; overflow: hidden; }
.login-brand::after { content: ""; position: absolute; width: 330px; height: 330px; right: -120px; bottom: -145px; border: 1px solid #365043; border-radius: 50%; box-shadow: inset 0 0 0 55px #1a211d, inset 0 0 0 56px #2e473b, inset 0 0 0 112px #1a211d, inset 0 0 0 113px #263c32; }
.login-brand .brand-mark { background: #eef6f1; }
.login-panel { padding: 70px 58px; color: var(--ink); }
.login-panel header { margin-bottom: 34px; }
.login-panel h1 { margin: 18px 0 0; font-size: 28px; }
.login-panel header p { margin: 9px 0 0; color: var(--muted); font-size: 14px; }
.security-mark { width: 42px; height: 42px; display: block; border-radius: 9px; background: var(--accent-soft); position: relative; }
.security-mark::before { content: ""; position: absolute; inset: 10px 12px; border: 2px solid var(--accent); border-radius: 4px; }
.security-mark::after { content: ""; position: absolute; width: 10px; height: 8px; left: 16px; top: 7px; border: 2px solid var(--accent); border-bottom: 0; border-radius: 8px 8px 0 0; }
.login-panel form { display: grid; gap: 18px; }
.login-panel label { display: grid; gap: 8px; font-size: 13px; font-weight: 650; }
.login-panel input { height: 46px; padding: 0 13px; border: 1px solid #ccd5ce; border-radius: 7px; }
.login-panel button { height: 48px; margin-top: 4px; border: 0; border-radius: 7px; color: #fff; background: var(--accent); font-weight: 700; }
.login-panel button:hover { background: var(--accent-dark); }
.form-error { margin: -16px 0 18px; padding: 10px 12px; border-radius: 6px; color: #8d302a; background: #fff0ee; font-size: 13px; }
.login-footnote { margin: 22px 0 0; color: var(--muted); font-size: 12px; }

@media (max-width: 1100px) {
  .admin-shell { grid-template-columns: 200px minmax(0, 1fr); }
  .admin-main { padding: 26px 22px 40px; }
  .table-tools { align-items: stretch; flex-direction: column; }
  .search-field { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

