:root {
  color-scheme: light;
  --ink: #17221c;
  --muted: #66736c;
  --paper: #fbfcf8;
  --panel: #ffffff;
  --line: #dfe6df;
  --green: #166b4b;
  --green-dark: #0d4c35;
  --mint: #dff3e8;
  --red: #a43b35;
  --amber: #986414;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at top left, #e4f2e9, transparent 32rem), var(--paper); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { border: 0; border-radius: .65rem; padding: .7rem 1rem; color: white; background: var(--green); font-weight: 700; cursor: pointer; }
button:hover { background: var(--green-dark); }
button:disabled { opacity: .55; cursor: wait; }
button.secondary { color: var(--green-dark); background: #edf4ef; border: 1px solid #d2dfd5; }
button.danger { color: var(--red); background: #fff1ef; border: 1px solid #f1cbc6; }
input, select, textarea { width: 100%; margin-top: .38rem; padding: .7rem .75rem; border: 1px solid #cad5cd; border-radius: .6rem; background: white; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(22,107,75,.14); border-color: var(--green); }
label { color: #39483f; font-size: .9rem; font-weight: 650; }
.shell { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 2.5rem 0 5rem; }
.login-card { width: min(430px, 100%); margin: 8vh auto; padding: 2.3rem; border: 1px solid var(--line); border-radius: 1.2rem; background: rgba(255,255,255,.94); box-shadow: 0 24px 70px rgba(28,64,43,.11); }
.login-card form { display: grid; gap: 1rem; margin-top: 1.6rem; }
.brand-mark { display: grid; place-items: center; width: 3.2rem; height: 3.2rem; margin-bottom: 1.4rem; color: white; background: var(--green); border-radius: .9rem; font-weight: 900; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .4rem; letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 1.2rem; }
.eyebrow { margin-bottom: .3rem; color: var(--green); font-size: .72rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.muted, .empty { color: var(--muted); }
.error { min-height: 1.3rem; margin: 1rem 0 0; color: var(--red); font-size: .9rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.topbar h1 { margin: 0; font-size: 2rem; }
.account { display: flex; align-items: center; gap: .8rem; color: var(--muted); }
.notice { position: sticky; top: 1rem; z-index: 10; margin-bottom: 1rem; padding: .85rem 1rem; border: 1px solid #b9d9c5; border-radius: .7rem; color: var(--green-dark); background: #effaf3; box-shadow: 0 8px 30px rgba(20,70,44,.08); }
.notice.is-error { color: var(--red); border-color: #efc6c2; background: #fff4f3; }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: .8rem; margin-bottom: 1rem; }
.stats article { padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: .85rem; background: rgba(255,255,255,.86); }
.stats span { display: block; color: var(--muted); font-size: .8rem; }
.stats strong { display: block; margin-top: .3rem; font-size: 1.55rem; }
.panel { margin-top: 1rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--panel); box-shadow: 0 12px 35px rgba(38,64,48,.05); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.license-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; }
.license-search { display: flex; gap: .5rem; }
.license-search input { min-width: 22rem; margin: 0; }
.license-search button { white-space: nowrap; }
.filters { display: flex; gap: .5rem; }
.filters select { min-width: 9rem; margin: 0; }
.generate-grid { display: grid; grid-template-columns: 1fr .7fr 2fr auto; align-items: end; gap: .8rem; }
.generated-box { margin-top: 1rem; padding: 1rem; border-radius: .8rem; background: #f3f8f4; }
.result-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.generated-box textarea { font-family: "Cascadia Mono", Consolas, monospace; line-height: 1.65; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th { color: var(--muted); font-size: .75rem; text-align: left; }
th, td { padding: .8rem .65rem; border-bottom: 1px solid #e8ede9; vertical-align: middle; }
td code { color: #294337; font-size: .8rem; }
.actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.actions button { padding: .42rem .6rem; font-size: .76rem; }
.badge { display: inline-flex; padding: .24rem .5rem; border-radius: 999px; color: var(--green-dark); background: var(--mint); font-size: .74rem; font-weight: 750; }
.badge.expired, .badge.disabled, .badge.deleted { color: var(--red); background: #fae9e7; }
.badge.unused { color: var(--amber); background: #fff3d5; }
.empty { margin: 1rem 0 0; text-align: center; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; color: var(--muted); font-size: .84rem; }
.pagination div { display: flex; gap: .5rem; }
.pagination button { padding: .48rem .7rem; font-size: .8rem; }
@media (max-width: 820px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .generate-grid { grid-template-columns: 1fr 1fr; }
  .generate-grid .wide { grid-column: 1 / -1; }
  .topbar, .panel-heading { align-items: flex-start; }
  .license-tools { width: 100%; justify-content: flex-start; }
  .license-search { width: 100%; }
  .license-search input { min-width: 0; }
}
@media (max-width: 520px) {
  .shell { width: min(100% - 1rem, 1180px); padding-top: 1rem; }
  .login-card, .panel { padding: 1rem; }
  .generate-grid { grid-template-columns: 1fr; }
  .generate-grid .wide { grid-column: auto; }
  .license-search { flex-wrap: wrap; }
  .license-search input { flex: 1 0 100%; }
  .topbar { display: block; }
  .account { margin-top: 1rem; justify-content: space-between; }
}
