:root {
  color-scheme: light;
  --paper: #f5f7f6;
  --surface: #fff;
  --ink: #252d32;
  --muted: #707b80;
  --line: #e1e7e5;
  --accent: #c44e2e;
  --accent-hover: #a83d22;
  --teal: #246b68;
  --green: #38836a;
  --red: #ba5149;
  --cyan: #4b8790;
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-size: 14px; }
button, input, select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar { background: #20292d; color: #f5f8f7; display: flex; flex-direction: column; padding: 22px 14px 16px; min-height: 100vh; }
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 11px; padding: 0 10px 30px; font-weight: 650; }
.brand small { display: block; color: #9aa7a7; font-size: 9px; letter-spacing: 1px; margin-top: 3px; font-weight: 500; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; background: var(--accent); color: white; border-radius: 8px; font-size: 12px; font-weight: 800; letter-spacing: 0; flex: none; }
nav { display: grid; gap: 5px; }
.nav-item { border: 0; border-radius: 6px; padding: 11px 12px; background: transparent; color: #b9c3c3; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 11px; }
.nav-item:hover { background: #2b373b; color: white; }
.nav-item.is-active { color: white; background: #364447; box-shadow: inset 3px 0 var(--accent); }
.nav-icon { width: 18px; text-align: center; color: #a7c0bd; font-size: 17px; }
.sidebar-foot { margin-top: auto; padding: 12px; color: #aab6b5; font-size: 12px; border-top: 1px solid #394447; display: flex; align-items: center; gap: 8px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #61bd91; box-shadow: 0 0 0 3px #61bd9126; }
.workspace { min-width: 0; padding: 0 34px 48px; }
.topbar { min-height: 102px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.eyebrow { color: var(--teal); font-size: 10px; font-weight: 700; letter-spacing: 1.2px; margin: 0 0 6px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 23px; font-weight: 650; letter-spacing: 0; }
h2 { margin-bottom: 5px; font-size: 16px; font-weight: 650; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.muted { color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 32px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 17px 18px 15px; min-width: 0; }
.metric-label { color: #566267; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.metric-swatch { width: 8px; height: 8px; border-radius: 2px; }
.swatch-ink { background: #4f6267; }.swatch-green { background: var(--green); }.swatch-cyan { background: var(--cyan); }.swatch-red { background: var(--red); }
.metric strong { display: block; font-size: 30px; line-height: 1.25; margin: 13px 0 4px; font-weight: 650; font-variant-numeric: tabular-nums; }
.metric small { color: var(--muted); font-size: 11px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 27px 0 13px; }
.section-heading p { margin: 0; font-size: 12px; }
.button { border: 1px solid transparent; border-radius: 5px; min-height: 36px; padding: 0 13px; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; }
.button-primary { color: white; background: var(--accent); }.button-primary:hover { background: var(--accent-hover); }
.button-quiet { background: white; border-color: var(--line); }.button-quiet:hover { background: #f0f4f2; }
.button-wide { width: 100%; min-height: 41px; }
.text-button { border: 0; background: transparent; color: var(--teal); cursor: pointer; padding: 8px 0; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); background: white; border-radius: 5px; cursor: pointer; font-size: 18px; }
.icon-button:hover { background: #eff3f1; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 680px; text-align: left; }
th { color: #748084; text-transform: uppercase; font-size: 10px; letter-spacing: .55px; font-weight: 650; padding: 12px 15px; background: #f9fbfa; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 15px; border-bottom: 1px solid #edf0ef; vertical-align: middle; white-space: nowrap; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
.code-value { font-family: ui-monospace, Consolas, monospace; font-weight: 650; letter-spacing: 0; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-active { color: var(--green); }.status-unused { color: var(--cyan); }.status-revoked, .status-expired { color: var(--red); }
.row-actions { display: flex; gap: 7px; }
.small-button { border: 0; background: transparent; color: var(--teal); cursor: pointer; padding: 4px 2px; font-size: 11px; }
.small-button.danger { color: var(--red); }
.small-button:disabled { color: #a9b2b2; cursor: default; }
.empty-state { padding: 35px 15px; color: var(--muted); text-align: center; }
.activity-heading { margin-top: 30px; }
.activity-list, .audit-list { background: white; border: 1px solid var(--line); border-radius: 7px; }
.activity-item, .audit-item { display: flex; align-items: flex-start; gap: 12px; padding: 13px 15px; border-bottom: 1px solid #edf0ef; }
.activity-item:last-child, .audit-item:last-child { border-bottom: 0; }
.activity-mark { width: 27px; height: 27px; flex: none; border-radius: 6px; display: grid; place-items: center; background: #edf4f1; color: var(--teal); }
.activity-copy { min-width: 0; flex: 1; }.activity-copy p { margin: 1px 0 4px; font-size: 12px; }.activity-copy small { color: var(--muted); font-size: 11px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin: 0 0 14px; }
.search-box { min-width: 220px; max-width: 360px; flex: 1; height: 37px; display: flex; align-items: center; gap: 8px; background: white; border: 1px solid var(--line); border-radius: 5px; padding: 0 10px; color: #728083; }
.search-box input { border: 0; outline: 0; min-width: 0; width: 100%; background: transparent; color: var(--ink); }
select, input { border: 1px solid var(--line); border-radius: 5px; min-height: 37px; padding: 0 10px; background: white; color: var(--ink); }
.toolbar select { min-width: 125px; }
.table-note { margin: 10px 2px; color: var(--muted); font-size: 11px; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: #e9efed; }
.login-panel { width: min(100%, 390px); padding: 30px; background: white; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 18px 60px #223b3512; }
.login-panel > .brand-mark { margin-bottom: 22px; width: 42px; height: 42px; }
.login-panel h1 { margin-bottom: 8px; }
.login-panel > .muted { font-size: 13px; margin-bottom: 24px; }
.stack-form, .dialog form { display: grid; gap: 15px; }
label { display: grid; gap: 7px; color: #4e5b5f; font-size: 12px; font-weight: 600; }
label input, label select { width: 100%; font-weight: 400; }
.form-error { min-height: 17px; margin: -7px 0 0; color: var(--red); font-size: 12px; }
.dialog { width: min(100% - 28px, 440px); border: 1px solid var(--line); border-radius: 8px; padding: 22px; color: var(--ink); box-shadow: 0 24px 90px #182d2b40; }
.dialog::backdrop { background: #15232175; }
.dialog form { gap: 15px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 5px; }
.dialog-heading h2 { font-size: 19px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 5px; }
.codes-dialog > .muted { font-size: 12px; line-height: 1.6; }
.created-codes { display: grid; gap: 7px; max-height: 270px; overflow: auto; margin: 14px 0; }
.created-code { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; background: #f4f7f6; border: 1px solid var(--line); border-radius: 5px; }
.created-code code { overflow-wrap: anywhere; font-size: 12px; font-weight: 650; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; background: #20292d; color: white; padding: 10px 15px; border-radius: 5px; box-shadow: 0 5px 24px #15232130; transition: .18s ease; z-index: 5; max-width: calc(100% - 24px); text-align: center; }
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
@media (max-width: 900px) { .app-shell { grid-template-columns: 190px minmax(0, 1fr); }.workspace { padding: 0 22px 36px; }.metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .app-shell { display: block; }.sidebar { min-height: auto; padding: 10px 12px; }.brand { padding: 0 3px 10px; }.sidebar nav { display: flex; overflow-x: auto; }.nav-item { flex: none; padding: 9px 11px; }.sidebar-foot { display: none; }
  .workspace { padding: 0 14px 28px; }.topbar { min-height: 84px; margin-bottom: 18px; }.topbar h1 { font-size: 20px; }.topbar-actions .muted { display: none; }
  .metric-grid { gap: 8px; }.metric { padding: 13px; }.metric strong { font-size: 25px; }.metric small { font-size: 10px; }
  .section-heading { align-items: flex-end; }.section-heading h2 { font-size: 15px; }.section-heading p { font-size: 11px; }.button { padding: 0 10px; min-height: 34px; font-size: 12px; }
  .toolbar { flex-wrap: wrap; }.search-box { flex-basis: 100%; max-width: none; }.toolbar select { flex: 1; }.toolbar > .button { flex: none; }
  .login-panel { padding: 23px; }
}
