:root {
  color-scheme: light;
  --background: #f5f6fa;
  --surface: #fff;
  --text: #202637;
  --muted: #626b7c;
  --line: #e5e8f0;
  --primary: #5146d8;
  --primary-hover: #4034ba;
  --primary-soft: #f0eeff;
  --danger: #b82f43;
  --radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--background);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
body:has(dialog[open]) { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
button, input, select, textarea { border-radius: 9px; }
:focus-visible { outline: 3px solid #7165df; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(24px, 3vw, 30px); line-height: 1.4; letter-spacing: -.6px; font-weight: 650; }
h2 { font-size: 19px; font-weight: 650; line-height: 1.5; }
h3 { font-size: 15px; font-weight: 650; }
p, dd, h1, h2, h3, span { overflow-wrap: anywhere; }
fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
fieldset:disabled input, fieldset:disabled textarea { background: #f4f5f8; color: var(--muted); }
input:not([type="checkbox"]), select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #cdd2df; background: var(--surface); color: var(--text); transition: border-color .15s; }
input::placeholder, textarea::placeholder { color: #788193; opacity: 1; }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: #9fa7be; }
textarea { resize: vertical; max-height: 280px; }
input[type="checkbox"] { width: 19px; height: 19px; margin: 3px 0 0; accent-color: var(--primary); flex-shrink: 0; }
label { display: block; margin-bottom: 7px; font-size: 14px; font-weight: 550; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link:focus { position: fixed; top: 8px; left: 16px; padding: 10px 16px; z-index: 20; background: #fff; color: var(--primary); border-radius: 8px; }
.noscript { padding: 16px; color: #82293a; background: #fff0f1; text-align: center; }
.muted { color: var(--muted); }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1264px; min-height: 78px; padding: 12px 32px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 18px; }
.brand-mark { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 11px; color: white; background: var(--primary); letter-spacing: -.5px; flex-shrink: 0; }
.brand-divider { color: #b4bac8; margin: 0 8px; font-weight: 400; }
.brand-section { color: #626b7c; font-size: 15px; font-weight: 450; }
.header-session { display: flex; align-items: center; gap: 20px; }
.admin-label { font-size: 13px; color: var(--muted); }
.button { min-height: 44px; padding: 10px 17px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid transparent; font-size: 14px; font-weight: 550; line-height: 1.5; text-decoration: none; transition: background .15s, border-color .15s; }
.button-primary { background: var(--primary); color: white; }
.button-primary:hover:not(:disabled) { background: var(--primary-hover); }
.button-secondary { background: white; color: #414961; border-color: #d8dce7; }
.button-secondary:hover:not(:disabled) { background: #f7f7fc; border-color: #b4afd9; }
.button-quiet { background: transparent; color: #565f73; padding: 9px 12px; }
.button-quiet:hover:not(:disabled) { background: #f0f1f7; }
.button-danger { background: var(--danger); color: #fff; }
.button-danger:hover:not(:disabled) { background: #9e2336; }
.button-manage { background: var(--primary-soft); color: #493ebc; min-width: 68px; }
.button-manage:hover:not(:disabled) { background: #e5e1ff; }
.button-full { width: 100%; }
.plus { font-size: 22px; line-height: 1; font-weight: 400; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }
.section-kicker { color: var(--primary); font-size: 12px; font-weight: 650; letter-spacing: 1.5px; margin-bottom: 9px; }
.login-wrap { padding: 64px 20px; min-height: calc(100vh - 79px); display: grid; place-items: center; }
.login-card { width: 100%; max-width: 440px; padding: 38px; background: white; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 12px 45px #24295a08; }
.login-card h1 { font-size: 25px; }
.login-intro { margin-top: 12px; margin-bottom: 28px; font-size: 14px; }
.login-card .field { margin-bottom: 22px; }
.login-footnote { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 12px; letter-spacing: 1px; }
.session-retry { margin-top: 12px; }
.dashboard { max-width: 1264px; margin: 0 auto; padding: 36px 32px 24px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.page-heading .muted { margin-top: 10px; font-size: 14px; }
.page-heading > .button { flex-shrink: 0; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 26px; }
.summary-card { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 23px; display: flex; flex-direction: column; gap: 8px; }
.summary-label { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 550; color: #4c5569; }
.summary-card strong { font-size: 34px; font-weight: 650; line-height: 1.35; font-variant-numeric: tabular-nums; }
.summary-description { font-size: 12px; color: var(--muted); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-active { background: #308064; }
.dot-pending { background: #7160cd; }
.dot-expired { background: #ad7024; }
.dot-disabled { background: #8f6372; }
.list-card { background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-heading { padding: 23px 25px 0; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.title-line { display: flex; align-items: center; gap: 12px; }
.count-label { padding: 2px 9px; background: #f0f1f7; border-radius: 6px; color: var(--muted); font-size: 12px; }
.provider-notice { padding: 4px 10px; border-radius: 6px; background: #faf3e7; color: #82622f; font-size: 12px; }
.list-toolbar { display: flex; flex-wrap: wrap; gap: 12px; padding: 20px 25px; }
.search-field { flex: 1 1 240px; max-width: 420px; }
.filter-field { min-width: 135px; }
.list-toolbar > .button { margin-left: auto; }
.table-wrap { width: 100%; overflow-x: auto; }
.license-table { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: left; }
.license-table th { padding: 12px 20px; background: #f8f9fc; color: #72798a; font-size: 12px; font-weight: 500; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.license-table th:first-child { width: 29%; padding-left: 25px; }
.license-table th:nth-child(2) { width: 24%; }
.license-table th:nth-child(3) { width: 22%; }
.license-table th:nth-child(4) { width: 13%; }
.license-table .actions-column { width: 12%; text-align: right; padding-right: 25px; }
.license-table td { padding: 20px; border-bottom: 1px solid #edf0f5; vertical-align: middle; overflow-wrap: anywhere; font-size: 14px; }
.license-table td:first-child { padding-left: 25px; }
.license-table td:last-child { text-align: right; padding-right: 25px; }
.license-table tbody tr:last-child td { border-bottom: 0; }
.license-table tbody tr:hover { background: #fcfcff; }
.cell-primary { display: block; color: #2b344a; font-size: 14px; font-weight: 550; }
.cell-secondary { display: block; color: #727a8c; font-size: 12px; margin-top: 5px; }
.code-hint { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .6px; }
.status { display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; padding: 4px 9px; font-size: 12px; font-weight: 550; white-space: nowrap; }
.status-active { background: #eaf6ef; color: #286549; }
.status-pending { background: #f0edfd; color: #6051a6; }
.status-expired { background: #fff3df; color: #8e601c; }
.status-disabled { background: #f7edf0; color: #8b4559; }
.list-footer { padding: 15px 25px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.page-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 20px 2px; color: var(--muted); font-size: 12px; }
.empty-state { padding: 55px 24px; text-align: center; color: var(--muted); }
.empty-state h3 { color: #3e475b; margin: 12px 0 8px; font-size: 17px; }
.empty-state p { font-size: 14px; }
.empty-state .button { margin-top: 18px; }
.empty-mark { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: #f0eef9; color: var(--primary); font-size: 24px; }
.spinner { display: inline-block; width: 24px; height: 24px; border: 2px solid #e5e2f8; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { margin-bottom: 18px; padding: 12px 15px; border-radius: 9px; font-size: 13px; line-height: 1.75; overflow-wrap: anywhere; }
.notice-info { background: #f0f2ff; color: #4b548f; border: 1px solid #e0e4fd; }
.notice-success { background: #edf8f1; color: #286349; border: 1px solid #d5ebde; }
.notice-warning { background: #fff7e9; color: #815b22; border: 1px solid #f2e2c7; }
.notice-error { background: #fff0f2; color: #9a3145; border: 1px solid #f2d8de; }
.list-message { margin: 0 25px 18px; }
.review-notice h2 { font-size: 15px; margin-bottom: 5px; }
.review-notice .button-row { margin-top: 12px; }
.review-notice .field-help { color: #795d36; }
.dialog { width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid #e4e6ee; border-radius: 18px; background: white; color: var(--text); box-shadow: 0 24px 90px #19204426; overflow: auto; }
.dialog::backdrop { background: #20243773; }
.dialog-wide { width: min(780px, calc(100% - 32px)); }
.dialog-compact { width: min(480px, calc(100% - 32px)); }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 23px 25px 20px; border-bottom: 1px solid var(--line); }
.dialog-heading .section-kicker { margin-bottom: 4px; }
.close-button { width: 44px; height: 44px; border: 0; background: #f5f6fa; color: #626b7c; font-size: 26px; line-height: 1; flex-shrink: 0; }
.close-button:hover:not(:disabled) { background: #ebeef5; }
.dialog-body { padding: 23px 25px; }
.dialog-footer { padding: 17px 25px; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; background: #fafbfe; border-top: 1px solid var(--line); }
.field { margin-bottom: 19px; }
.field:last-child { margin-bottom: 0; }
.field-help { color: var(--muted); font-size: 12px; line-height: 1.7; margin-top: 6px; }
.required-label, .optional-label { margin-left: 5px; font-size: 11px; font-weight: 400; }
.required-label { color: #6153af; }
.optional-label { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 19px; }
.form-grid .field { margin: 0; }
.checkbox-field { display: flex; align-items: flex-start; gap: 10px; margin-top: 20px; margin-bottom: 0; font-size: 13px; font-weight: 450; cursor: pointer; }
.action-customer { font-weight: 600; margin-bottom: 15px; overflow-wrap: anywhere; }
#action-error, #create-error { margin-top: 18px; margin-bottom: 12px; }
.manage-subtitle { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; margin: 0; }
.details-grid > div { min-width: 0; }
.details-grid .detail-full { grid-column: 1 / -1; }
.details-grid dt { color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.details-grid dd { margin: 0; font-size: 14px; white-space: pre-wrap; }
.management-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 24px; margin-bottom: 8px; }
#manage-lock-notice { margin-top: 14px; }
.detail-section { padding-top: 24px; margin-top: 24px; border-top: 1px solid var(--line); }
.usage-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 15px 0 0; }
.usage-grid > div { padding: 14px; background: #f7f8fc; border-radius: 10px; min-width: 0; }
.usage-grid dt { font-size: 12px; color: var(--muted); }
.usage-grid dd { margin: 5px 0 0; font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; }
.audit-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.audit-heading > .button { flex-shrink: 0; }
.audit-list { list-style: none; padding: 0; margin: 18px 0 0; }
.audit-list li { position: relative; padding: 0 0 20px 20px; border-left: 1px solid #e3e4ef; margin-left: 4px; }
.audit-list li::before { content: ""; position: absolute; left: -4px; top: 8px; width: 7px; height: 7px; border-radius: 50%; background: #aaa3d7; }
.audit-list li:last-child { padding-bottom: 0; }
.audit-title-line { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.audit-title-line strong { font-weight: 550; font-size: 13px; }
.audit-list time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.audit-detail { margin-top: 3px; color: var(--muted); font-size: 12px; }
.code-field { margin-top: 20px; }
.code-value { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 19px; line-height: 1.7; color: #3f358e; background: #f8f7ff; overflow-wrap: anywhere; resize: none; user-select: all; }
textarea.code-value { border-color: #d4cef4; background: #f8f7ff; color: #3f358e; }
.copy-status { margin-top: 14px; font-size: 13px; color: #525c76; }
@media (max-width: 950px) {
  .dashboard { padding: 28px 22px 20px; }
  .header-inner { padding-right: 22px; padding-left: 22px; }
  .summary-grid { gap: 12px; }
  .summary-card { padding: 17px; }
  .license-table th, .license-table td { padding-left: 13px; padding-right: 13px; }
  .license-table th:first-child { width: 25%; }
  .license-table th:nth-child(4) { width: 15%; }
  .license-table .actions-column { width: 14%; }
}
@media (max-width: 680px) {
  .header-inner { min-height: 68px; padding: 10px 16px; gap: 8px; }
  .brand { gap: 8px; font-size: 16px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 9px; font-size: 15px; }
  .brand-divider { margin: 0 4px; }
  .brand-section { font-size: 13px; }
  .admin-label { display: none; }
  .header-session { gap: 0; }
  .header-session .button { padding-right: 6px; padding-left: 6px; font-size: 12px; }
  .dashboard { padding: 24px 16px 16px; }
  .page-heading { align-items: stretch; flex-direction: column; gap: 18px; margin-bottom: 20px; }
  .page-heading h1 { font-size: 25px; }
  .page-heading .muted { font-size: 13px; }
  .page-heading > .button { align-self: flex-start; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
  .summary-card { padding: 16px; }
  .summary-card strong { font-size: 30px; }
  .summary-description { font-size: 11px; }
  .list-heading { padding: 18px 16px 0; }
  .list-toolbar { padding: 16px; gap: 10px; }
  .search-field { flex-basis: 100%; max-width: none; }
  .filter-field { flex: 1; min-width: 0; }
  .list-toolbar > .button { flex: 1; margin-left: 0; }
  .license-table, .license-table tbody { display: block; }
  .license-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .license-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: 17px 16px; border-top: 1px solid var(--line); gap: 13px 12px; }
  .license-table td, .license-table td:first-child, .license-table td:last-child { padding: 0; border: 0; text-align: left; }
  .license-table td:first-child { grid-column: 1; grid-row: 1; }
  .license-table td:nth-child(2) { grid-column: 1; grid-row: 2; }
  .license-table td:nth-child(3) { grid-column: 1; grid-row: 3; }
  .license-table td:nth-child(4) { grid-column: 2; grid-row: 1; align-self: start; text-align: right; }
  .license-table td:last-child { grid-column: 2; grid-row: 3; align-self: end; text-align: right; }
  .license-table td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: 11px; margin-bottom: 3px; }
  .cell-secondary { margin-top: 3px; }
  .list-footer { padding: 14px 16px; font-size: 11px; }
  .list-message { margin-right: 16px; margin-left: 16px; }
  .page-footer { font-size: 11px; }
  .login-wrap { padding: 30px 16px; min-height: calc(100dvh - 69px); }
  .login-card { padding: 27px 23px; }
  .dialog, .dialog-wide, .dialog-compact { width: calc(100% - 24px); max-height: calc(100dvh - 24px); border-radius: 14px; }
  .dialog-heading { padding: 19px 18px 16px; }
  .dialog-body { padding: 19px 18px; }
  .dialog-footer { padding: 15px 18px; gap: 9px; }
  .dialog-footer .button { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .details-grid { gap: 16px; }
  .usage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-grid dd { font-size: 20px; }
  .management-actions .button { flex: 1 1 auto; }
  .code-value { font-size: 17px; }
  input:not([type="checkbox"]), select, textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
