/* ==========================================================================
   License Manager — 样式表
   无外部依赖，深色顶栏 + 浅色内容区，表格优先。
   ========================================================================== */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #1c2024;
  --ink-2: #5b6470;
  --ink-3: #8b949e;
  --line: #e3e6ea;
  --line-2: #eef0f3;
  --brand: #2f6fed;
  --brand-dark: #1f55c4;
  --brand-soft: #eaf1fe;
  --ok: #148f5a;
  --ok-soft: #e6f6ee;
  --warn: #b26a00;
  --warn-soft: #fff4e0;
  --danger: #d13a3a;
  --danger-soft: #fdecec;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: .92em; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: #14181f;
  border-bottom: 1px solid #232a34;
  position: sticky; top: 0; z-index: 30;
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 20px;
  height: 56px; display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 650; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, #4b86ff, #2f6fed);
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 14px; letter-spacing: -.5px;
}
.brand-mark.lg { width: 44px; height: 44px; border-radius: 12px; font-size: 22px; }
.brand-text { letter-spacing: -.2px; }

.mainnav { display: flex; gap: 4px; flex: 1; }
.mainnav a {
  color: #a9b2c0; padding: 7px 12px; border-radius: 7px;
  font-weight: 500; font-size: 13.5px;
}
.mainnav a:hover { background: #1e242e; color: #e8ecf2; text-decoration: none; }
.mainnav a.on { background: #232a34; color: #fff; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.whoami { color: #8b95a4; font-size: 13px; }
.topbar .btn-ghost { color: #c6cdd7; border-color: #333c48; }
.topbar .btn-ghost:hover { background: #232a34; color: #fff; }

/* ---------- 布局 ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 22px 20px 60px; }
.foot {
  max-width: 1280px; margin: 0 auto; padding: 0 20px 34px;
  color: var(--ink-3); font-size: 12px;
}
.centered { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.centered .wrap { width: 100%; max-width: 420px; padding: 0; }
.centered .foot { display: none; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 16px; flex-wrap: wrap;
}
.page-head h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.3px; }
.page-head p { margin: 0; color: var(--ink-2); font-size: 13px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; margin-bottom: 16px;
}
.card > h2 {
  font-size: 15px; margin: 0 0 14px; font-weight: 650;
  display: flex; align-items: center; gap: 8px;
}
.card > h2 .sub { font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
.card-tight { padding: 0; overflow: hidden; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- 统计卡 ---------- */
.stat-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 18px; }
@media (max-width: 1000px) { .stat-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  padding: 12px 14px; box-shadow: var(--shadow);
}
.stat .num { font-size: 21px; font-weight: 680; letter-spacing: -.5px; line-height: 1.2; }
.stat .lbl { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.stat.is-ok .num { color: var(--ok); }
.stat.is-warn .num { color: var(--warn); }
.stat.is-danger .num { color: var(--danger); }

/* ---------- 表单 ---------- */
.form { display: block; }
.field { display: block; margin-bottom: 14px; }
.field > .label, .label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--ink-2); margin-bottom: 5px;
}
.field .desc { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

input[type=text], input[type=password], input[type=number], input[type=date],
input[type=email], input[type=search], select, textarea {
  width: 100%; padding: 8px 11px; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, .13);
}
textarea { resize: vertical; min-height: 68px; }
input[readonly] { background: #f7f8fa; color: var(--ink-2); }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 180px; margin-bottom: 0; }
.inline { display: inline; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; font: inherit; font-weight: 560; font-size: 13.5px;
  color: var(--ink); background: #fff; border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .04s;
}
.btn:hover { background: #f7f8fa; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { color: var(--danger); border-color: #f0c9c9; background: var(--danger-soft); }
.btn-danger:hover { background: #fbdcdc; }
.btn-ok { color: var(--ok); border-color: #bfe6d2; background: var(--ok-soft); }
.btn-ok:hover { background: #d8f2e4; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.2px; }
table.tbl th, table.tbl td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
table.tbl thead th {
  background: #fafbfc; color: var(--ink-2); font-weight: 600; font-size: 12.3px;
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
  border-bottom: 1px solid var(--line);
}
table.tbl tbody tr:hover { background: #fafbfd; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl tr.highlight { background: #fffbe6; }
table.tbl .actions { display: flex; gap: 6px; flex-wrap: wrap; }

.ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 11.8px; font-weight: 600;
  background: var(--line-2); color: var(--ink-2); white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-plain { background: #f3f4f6; color: var(--ink-2); font-weight: 500; }

.chip {
  display: inline-block; padding: 1px 7px; margin: 1px 3px 1px 0;
  border-radius: 5px; background: #f1f3f6; color: var(--ink-2);
  font-size: 11.5px; font-family: var(--mono);
}

/* ---------- 授权码展示 ---------- */
.keybox {
  display: flex; gap: 8px; align-items: stretch;
}
.keybox textarea {
  font-family: var(--mono); font-size: 12px; line-height: 1.5;
  min-height: 92px; word-break: break-all; background: #fbfcfd;
}
.keybox-actions { display: flex; flex-direction: column; gap: 6px; }

/* ---------- Flash ---------- */
.flash {
  padding: 10px 14px; border-radius: 9px; margin-bottom: 14px;
  font-size: 13.2px; border: 1px solid transparent;
}
.flash-success { background: var(--ok-soft); color: #0f6d45; border-color: #c8e9d8; }
.flash-error   { background: var(--danger-soft); color: #a52a2a; border-color: #f3cfcf; }
.flash-warning { background: var(--warn-soft); color: #8a5200; border-color: #f2ddb5; }
.flash-info    { background: var(--brand-soft); color: #1c4ca8; border-color: #cfe0fb; }

/* ---------- 杂项 ---------- */
.muted { color: var(--ink-3); }
.small { font-size: 12.3px; }
.mt0 { margin-top: 0; } .mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; }
.mb0 { margin-bottom: 0; } .mb8 { margin-bottom: 8px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.kv { display: grid; grid-template-columns: 132px 1fr; gap: 8px 14px; font-size: 13.2px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; word-break: break-all; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input[type=search] { flex: 1 1 220px; }
.filters select { width: auto; }

.pager { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 14px; }
.pager a, .pager span {
  padding: 5px 10px; border-radius: 7px; border: 1px solid var(--line);
  font-size: 12.8px; color: var(--ink-2); background: #fff;
}
.pager .cur { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty .big { font-size: 30px; margin-bottom: 8px; opacity: .35; }

.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 28px; box-shadow: 0 8px 28px rgba(16, 24, 40, .08); width: 100%;
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
.login-brand h1 { font-size: 18px; margin: 0 0 2px; letter-spacing: -.3px; }
.login-brand p { margin: 0; color: var(--ink-3); font-size: 12.5px; }
.hint { color: var(--ink-3); font-size: 12px; margin: 16px 0 0; line-height: 1.6; }

.copy-ok { background: var(--ok-soft) !important; border-color: #bfe6d2 !important; color: var(--ok) !important; }

details summary { cursor: pointer; color: var(--brand); font-size: 13px; }
details pre {
  background: #14181f; color: #d7dee8; padding: 12px 14px; border-radius: 8px;
  overflow-x: auto; font-size: 12px; line-height: 1.6;
}
