:root {
  --ink: #18171f;
  --muted: #737184;
  --paper: #f5f3fa;
  --card: #ffffff;
  --primary: #5b4ce2;
  --primary-dark: #4434bd;
  --danger: #c84257;
  --line: #e5e1ef;
  --success: #21875d;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--paper); }
a { color: inherit; text-decoration: none; }
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: #171521; color: #fff; padding: 28px 18px; }
.brand { font-size: 20px; font-weight: 750; padding: 0 12px 28px; }
.brand small { display: block; margin-top: 5px; color: #aaa6bd; font-size: 12px; font-weight: 400; }
.nav a { display: block; padding: 11px 12px; border-radius: 10px; color: #c9c5d7; margin-bottom: 5px; }
.nav a:hover { background: #2a2736; color: #fff; }
.content { padding: 36px; overflow: auto; }
.topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
h1 { font-size: 28px; margin: 0; }
h2 { font-size: 18px; margin: 0 0 16px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: 0 10px 30px rgba(37, 31, 66, .05); }
.metric { color: var(--muted); font-size: 14px; }
.metric strong { display: block; color: var(--ink); font-size: 32px; margin-top: 12px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 18px; }
.field-label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
input, select { min-height: 40px; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 0 12px; color: var(--ink); }
button, .button { border: 0; border-radius: 9px; min-height: 40px; padding: 0 16px; background: var(--primary); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
button:hover, .button:hover { background: var(--primary-dark); }
.button.secondary { background: #ece9f8; color: var(--primary-dark); }
.button.danger { background: #fae8eb; color: var(--danger); }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 14px; overflow: hidden; }
th, td { padding: 14px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 14px; }
th { color: var(--muted); background: #fbfaff; font-size: 12px; text-transform: uppercase; }
.badge { display: inline-block; padding: 4px 8px; border-radius: 99px; background: #efedf7; color: #59566a; font-size: 12px; }
.badge.ACTIVE, .badge.PENDING { background: #e6f5ee; color: var(--success); }
.badge.DISABLED { background: #fae8eb; color: var(--danger); }
.pager { display: flex; gap: 8px; margin-top: 18px; }
.muted { color: var(--muted); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(410px, 100%); }
.login-card input { width: 100%; margin: 7px 0 14px; }
.login-card button { width: 100%; margin-top: 8px; }
.alert { padding: 11px 13px; border-radius: 9px; margin-bottom: 14px; background: #fae8eb; color: var(--danger); }
.alert.success { background: #e6f5ee; color: var(--success); }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 10px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; padding: 13px; border: 1px dashed #bbb3e5; border-radius: 9px; background: #faf9ff; }
.page-subtitle { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.section-kicker { margin-bottom: 8px; color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.license-create-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.license-card { min-width: 0; }
.license-card h2 { margin-bottom: 7px; }
.license-card > .muted { min-height: 40px; margin: 0 0 18px; line-height: 1.55; }
.license-form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.license-form input { width: 100%; }
.field-label small { color: #8a8798; font-size: 11px; line-height: 1.45; }
.code-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .03em; }
.form-actions { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.form-actions button { flex: 0 0 auto; min-width: 152px; }
.form-actions .muted { font-size: 12px; }
.list-card { padding: 0; overflow: hidden; }
.list-heading { display: flex; align-items: end; justify-content: space-between; gap: 22px; padding: 22px 22px 18px; }
.list-heading h2, .list-heading p { margin-bottom: 0; }
.list-heading p { margin-top: 7px; }
.toolbar.compact { margin: 0; flex-wrap: nowrap; }
.table-scroll { overflow-x: auto; }
.license-table { border-radius: 0; min-width: 1120px; }
.code-cell code { display: block; width: max-content; max-width: 280px; padding: 7px 9px; border: 1px solid #ddd8ef; border-radius: 7px; background: #f8f7fc; color: #312b52; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; white-space: normal; user-select: all; }
.legacy-hint { display: block; margin-top: 6px; color: #b56a13; font-size: 11px; }
.batch-cell { max-width: 160px; overflow-wrap: anywhere; }
.actions-cell { min-width: 190px; }
.actions-cell form { margin: 0 0 8px; }
.restore-form { display: grid; gap: 7px; }
.restore-form input { width: 100%; min-height: 36px; font-size: 12px; }
.restore-form .button { width: 100%; min-height: 36px; }
.empty-state { padding: 42px 20px; color: var(--muted); text-align: center; }
.user-table { min-width: 1080px; }
.openid { display: inline-block; max-width: 260px; padding: 6px 8px; color: #373248; background: #f5f3fa; border: 1px solid var(--line); border-radius: 7px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; overflow-wrap: anywhere; user-select: all; }
.generated-card { max-width: 980px; }
.generated-actions { display: flex; gap: 10px; margin: 18px 0; }
.generated-card .codes { margin-top: 6px; }
.admin-error-card { display: flex; align-items: flex-start; gap: 20px; max-width: 720px; margin: 50px auto; padding: 30px; }
.admin-error-card h1 { margin-bottom: 10px; }
.admin-error-card p { margin: 0 0 22px; line-height: 1.7; }
.error-mark { flex: 0 0 54px; width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: #fae8eb; color: var(--danger); font-size: 28px; font-weight: 800; }
@media (max-width: 850px) { .shell { grid-template-columns: 1fr; } .sidebar { position: static; } .nav { display: flex; overflow-x: auto; } .content { padding: 22px 14px; } .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1100px) { .license-create-grid { grid-template-columns: 1fr; } .list-heading { align-items: stretch; flex-direction: column; } }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } .form-actions { align-items: stretch; flex-direction: column; } .form-actions button { width: 100%; } .toolbar.compact { display: grid; grid-template-columns: 1fr; } .generated-actions { flex-direction: column; } }
