:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #20242a;
  --muted: #69727d;
  --line: #d9dde3;
  --accent: #176b4d;
  --accent-dark: #0f5138;
  --danger: #b42318;
  --warning: #9a6700;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, "Microsoft YaHei", sans-serif; }
button, input, select, textarea { font: inherit; }
button { min-height: 38px; border: 1px solid var(--accent); border-radius: 6px; padding: 7px 14px; background: var(--accent); color: white; cursor: pointer; }
button:hover { background: var(--accent-dark); }
button:disabled { cursor: not-allowed; opacity: .45; }
button.secondary { background: white; color: var(--accent); }
button.danger { border-color: var(--danger); background: var(--danger); }
input, select, textarea { min-height: 38px; width: 100%; border: 1px solid var(--line); border-radius: 5px; padding: 7px 9px; background: white; color: var(--text); }
input[type="checkbox"] { width: 18px; min-height: 18px; }
input[type="color"] { min-width: 72px; padding: 3px; }
label { display: grid; gap: 5px; color: var(--muted); }
.hidden { display: none !important; }
.topbar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: #202c27; color: white; }
.topbar strong { margin-right: 12px; font-size: 20px; }
.topbar span { color: #c7d3ce; }
main { width: min(1500px, calc(100% - 32px)); margin: 22px auto 48px; }
.login-panel { width: min(420px, 100%); margin: 80px auto; padding: 24px; border: 1px solid var(--line); background: var(--surface); }
.login-panel h1 { margin: 0 0 20px; font-size: 22px; }
.login-panel form { display: grid; gap: 14px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); }
.tab { border-color: transparent; border-radius: 5px 5px 0 0; background: transparent; color: var(--muted); }
.tab.active { border-color: var(--line); border-bottom-color: white; background: white; color: var(--text); }
.band { padding: 20px 0; border-bottom: 1px solid var(--line); }
.band h2 { margin: 0 0 14px; font-size: 18px; }
.band h3 { margin: 24px 0 10px; font-size: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)) auto; align-items: end; gap: 12px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.search-row { display: grid; grid-template-columns: minmax(220px, 1fr) 150px auto; gap: 8px; }
.filter-grid { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); align-items: end; gap: 8px; width: 100%; }
.batch-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.batch-bar select { width: 180px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: white; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #eef1f3; color: #4f5964; font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.actions { display: flex; gap: 6px; }
.actions { flex-wrap: wrap; }
.actions button { min-height: 30px; padding: 4px 8px; }
.message { min-height: 20px; color: var(--muted); }
.message.error { color: var(--danger); }
.message.warning { color: var(--warning); }
.message.success { color: var(--accent); }
.generated { max-height: 240px; overflow: auto; padding: 12px; border: 1px dashed var(--accent); background: white; white-space: pre-wrap; word-break: break-all; }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 14px; }
.status { font-weight: 600; }
.status-active, .status-unused { color: var(--accent); }
.status-disabled, .status-expired { color: var(--danger); }
.status-deleted { color: var(--muted); }
.license-key { display: inline-block; min-width: 220px; font-family: ui-monospace, Consolas, monospace; }
.color-swatch { display: inline-block; width: 14px; height: 14px; margin-right: 8px; border: 1px solid var(--line); vertical-align: -2px; }
.hint { margin: -8px 0 0; color: var(--muted); }
.app-update-form { margin-top: 18px; }
.app-update-form .full-row { grid-column: 1 / -1; }
.checkbox-label { display: flex; align-items: center; gap: 8px; min-height: 38px; color: var(--text); }
.checkbox-label input { width: 18px; min-height: 18px; }

@media (max-width: 820px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .search-row { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .tabs { overflow-x: auto; }
  .tab { flex: 0 0 auto; white-space: nowrap; }
}

@media (max-width: 520px) {
  .app-update-form { grid-template-columns: 1fr; }
  .app-update-form .full-row { grid-column: auto; }
}
