:root {
  color-scheme: light;
  --primary: #5652e8;
  --primary-hover: #4743d0;
  --primary-soft: #eeedff;
  --ink: #161a2a;
  --muted: #697386;
  --line: #e3e6ee;
  --surface: #ffffff;
  --surface-muted: #f6f7fb;
  --success: #087a55;
  --warning: #a45b00;
  --danger: #b42318;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--surface-muted); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: 24px; letter-spacing: 0; }
h2 { margin-bottom: 4px; font-size: 18px; letter-spacing: 0; }
.muted, .panel-heading p, .field-help { color: var(--muted); }
.eyebrow { margin-bottom: 5px; color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0, #e9e8ff 0, var(--surface-muted) 42%); }
.login-panel { width: min(100%, 430px); padding: 38px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 22px 60px rgba(25, 28, 58, .12); }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 24px; border-radius: 12px; background: var(--primary); color: #fff; font-size: 23px; font-weight: 850; box-shadow: 0 8px 18px rgba(86, 82, 232, .25); }
.login-panel h1 { font-size: 27px; }
label { display: block; margin: 18px 0 7px; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
input, select { height: 44px; padding: 0 13px; }
textarea { padding: 11px 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(86, 82, 232, .13); }
.button { min-height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 7px; font-weight: 750; transition: background .15s, border-color .15s, transform .15s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .58; }
.button.primary { background: var(--primary); color: #fff; box-shadow: 0 5px 12px rgba(86, 82, 232, .18); }
.button.primary:hover:not(:disabled) { background: var(--primary-hover); }
.button.secondary { border-color: var(--line); background: var(--surface); color: var(--ink); }
.button.secondary:hover:not(:disabled) { border-color: #babce9; background: var(--primary-soft); color: var(--primary); }
.button.danger { border-color: #f2b8b5; background: #fff5f4; color: var(--danger); }
.button.full { width: 100%; margin-top: 22px; }
.button.small { min-height: 32px; padding: 0 10px; font-size: 12px; box-shadow: none; }
.form-error { min-height: 18px; margin: 10px 0 0; color: var(--danger); font-size: 13px; }
.app-shell { min-height: 100vh; }
.topbar { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px clamp(18px, 4vw, 64px); border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar h1 { font-size: 21px; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.status-dot { display: inline-flex; align-items: center; gap: 7px; color: var(--success); font-size: 13px; font-weight: 650; }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
main { width: min(1480px, 100%); margin: 0 auto; padding: 30px clamp(18px, 4vw, 64px) 64px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 26px; }
.metric { padding: 19px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); box-shadow: 0 4px 14px rgba(31, 36, 58, .035); }
.metric strong { display: block; margin-top: 8px; font-size: 27px; }
.metric span { color: var(--muted); font-size: 13px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 14px; }
.tabs { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.tab { height: 38px; padding: 0 17px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 700; }
.tab.active { background: var(--primary-soft); color: var(--primary); }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 5px 18px rgba(31, 36, 58, .035); }
.panel-heading { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 19px 22px; border-bottom: 1px solid var(--line); }
.panel-heading p { margin-bottom: 0; font-size: 13px; }
.search { max-width: 330px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 18px; border-bottom: 1px solid #edf0f4; text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #fafbfc; font-size: 11px; letter-spacing: .03em; text-transform: uppercase; }
td { font-size: 13px; }
tbody tr:hover { background: #fbfbff; }
tbody tr:last-child td { border-bottom: 0; }
.align-right { text-align: right; }
.actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.customer-name { display: block; margin-bottom: 3px; font-weight: 750; }
.customer-contact { color: var(--muted); font-size: 12px; }
.key-mask { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 750; }
.badge.active, .badge.stable { background: #e7f6ef; color: var(--success); }
.badge.suspended, .badge.beta { background: #fff4df; color: var(--warning); }
.badge.revoked, .badge.inactive { background: #ffebe9; color: var(--danger); }
.empty-state { padding: 58px 20px; text-align: center; color: var(--muted); }
.audit-list { display: grid; }
.audit-row { display: grid; grid-template-columns: 190px 1fr 180px; gap: 20px; padding: 15px 22px; border-bottom: 1px solid #edf0f4; font-size: 13px; }
.audit-row:last-child { border-bottom: 0; }
.audit-action { font-weight: 700; }
.audit-meta { color: var(--muted); }
dialog { padding: 0; border: 0; }
dialog::backdrop { background: rgba(17, 20, 31, .48); backdrop-filter: blur(2px); }
.drawer { width: min(550px, 100%); max-width: none; height: 100vh; max-height: none; margin: 0 0 0 auto; background: var(--surface); }
.drawer[open] { animation: drawer-in 180ms ease-out; }
.drawer-content { height: 100%; display: grid; grid-template-rows: auto 1fr auto; }
.drawer-header { min-height: 82px; display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--line); background: var(--primary); color: #fff; }
.drawer-header .eyebrow { color: #dcdcff; }
.drawer-header h2 { margin: 0; font-size: 19px; }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 7px; background: transparent; color: #fff; font-size: 27px; line-height: 1; }
.icon-button:hover { background: rgba(255, 255, 255, .15); }
.drawer-body { overflow-y: auto; padding: 5px 24px 30px; }
.drawer-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-help { margin: 6px 0 0; font-size: 12px; }
.checkbox-row { display: flex; align-items: center; gap: 9px; }
.checkbox-row input { width: 18px; height: 18px; }
.notice { margin-top: 18px; padding: 13px; border-left: 3px solid var(--primary); border-radius: 6px; background: var(--primary-soft); color: #3d3b75; font-size: 13px; line-height: 1.5; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.key-dialog { width: min(520px, calc(100% - 32px)); border-radius: 10px; background: var(--surface); box-shadow: 0 20px 60px rgba(17, 20, 31, .2); }
.key-content { padding: 30px; }
.generated-key { display: block; margin: 22px 0; padding: 16px; border: 1px dashed var(--primary); border-radius: 7px; background: var(--primary-soft); color: #343177; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; font-weight: 800; text-align: center; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: 420px; padding: 13px 17px; border-radius: 8px; background: #202431; color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); font-size: 13px; }
@keyframes drawer-in { from { transform: translateX(18px); opacity: .5; } to { transform: translateX(0); opacity: 1; } }
@media (max-width: 880px) { .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .panel-heading, .toolbar { align-items: stretch; flex-direction: column; } .search { max-width: none; } .audit-row { grid-template-columns: 1fr; gap: 4px; } }
@media (max-width: 560px) { .login-panel { padding: 28px 21px; } .topbar { align-items: flex-start; } .status-dot { display: none; } .metrics { grid-template-columns: 1fr 1fr; } .metric { padding: 14px; } .metric strong { font-size: 22px; } .tabs { width: 100%; overflow-x: auto; } .tab { flex: 1; padding: 0 11px; } .field-row { grid-template-columns: 1fr; gap: 0; } .drawer { width: 100%; } .dialog-actions { flex-direction: column; } .dialog-actions .button { width: 100%; } }
