:root {
  --bg: #eef3fb;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --line: #d8e2f1;
  --text: #142033;
  --muted: #66758c;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #0f9f62;
  --red: #e5484d;
  --amber: #d97706;
  --nav: #0d1729;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, #f8fbff 0%, var(--bg) 100%);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: var(--nav);
  color: #fff;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2f6df6, #1d4ed8);
  font-size: 20px;
  font-weight: 900;
}

.brand { font-size: 21px; font-weight: 900; }
.brand-subtitle { margin-top: 4px; color: #93a4bd; font-size: 12px; }

.sidebar-copy,
.admin-card {
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius: 12px;
  background: rgba(15, 23, 42, .55);
}

.copy-title { font-weight: 800; margin-bottom: 8px; }
.sidebar-copy p { margin: 0; color: #a8b6ca; font-size: 13px; line-height: 1.7; }
.admin-card { margin-top: auto; background: #111d32; }

.admin-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #bdebd2;
  font-size: 13px;
  font-weight: 800;
}

.status-dot { width: 8px; height: 8px; border-radius: 999px; background: #22c55e; }
.admin-name { margin-top: 10px; font-size: 18px; font-weight: 900; }
.admin-meta { margin-top: 6px; color: #93a4bd; font-size: 12px; }
.admin-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }

.main { min-width: 0; padding: 24px; }
.login-view { min-height: calc(100vh - 48px); display: grid; place-items: center; }

.login-card {
  width: min(430px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 24px 80px rgba(21, 40, 80, .16);
}

.login-badge {
  width: max-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eaf1ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.login-card h1 { margin: 16px 0 8px; font-size: 26px; }
.login-desc { margin: 0 0 22px; color: var(--muted); line-height: 1.7; }

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
  background: #e9eef7;
  color: #1f2a44;
}

button:disabled { cursor: not-allowed; opacity: .65; }
button.primary { background: var(--blue); color: #fff; }
button.primary:hover { background: var(--blue-dark); }
button.danger { background: #ffe9ea; color: var(--red); }
button.warn { background: #fff4db; color: var(--amber); }
button.ok { background: #e6f8ee; color: var(--green); }
.ghost { background: #fff; border: 1px solid var(--line); color: var(--text); }
.ghost:hover { background: #f0f4fa; }
.ghost-dark { color: #dbeafe; background: rgba(148, 163, 184, .15); }
.danger-text { color: #fecaca; }
.login-button { width: 100%; height: 44px; }
.login-status { min-height: 20px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.login-status.fail { color: var(--red); }
.login-status.ok { color: var(--green); }
.login-footnote { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.dashboard { display: grid; gap: 16px; }
.topbar { display: flex; justify-content: space-between; align-items: stretch; gap: 18px; }
.topbar h1 { margin: 0; font-size: 24px; }
.topbar p,
.section-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.topbar-stats { display: grid; grid-template-columns: repeat(5, 112px); gap: 10px; }
.stat-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--panel); }
.stat-card span { display: block; color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin-top: 4px; color: var(--blue); font-size: 22px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 12px 36px rgba(24, 39, 75, .06);
}

h2 { margin: 0; font-size: 18px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px; }
.create-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: stretch;
}
.grid { display: grid; gap: 12px; }
.create-grid { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(110px, 1fr)); }

.checks { display: flex; gap: 22px; margin: 4px 0 14px; flex-wrap: wrap; }
.checks label { display: flex; align-items: center; gap: 8px; margin: 0; }
.checks input { width: auto; }
.create-button { min-width: 140px; }
.created-box {
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  overflow: hidden;
}
.created-head { padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 900; color: #334155; }

pre {
  margin: 0;
  min-height: 112px;
  max-height: 170px;
  overflow: auto;
  white-space: pre-wrap;
  background: #0f172a;
  color: #dbeafe;
  padding: 14px;
}

.plans-list { display: grid; gap: 10px; margin-bottom: 16px; }
.plan-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; grid-template-columns: 1fr auto; gap: 12px; background: var(--panel-soft); }
.plan-title { font-weight: 900; }
.plan-form { border-top: 1px solid var(--line); padding-top: 14px; }
.plan-form h3 { margin: 0 0 12px; font-size: 15px; }
.plan-form-actions { display: flex; gap: 8px; margin-top: 8px; }

.list-head { align-items: flex-start; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.toolbar-search { width: 260px; }
.toolbar select { width: auto; min-width: 118px; }
.batch-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 12px; background: #f0f4ff; border: 1px solid #c7d7f5; border-radius: 10px; font-size: 13px; }
.batch-select-all { display: flex; align-items: center; gap: 6px; cursor: pointer; margin: 0; }
.batch-select-all input { width: auto; }
.batch-count { font-weight: 800; color: var(--blue); }
.batch-actions { display: flex; gap: 6px; margin-left: auto; }
.batch-actions button { padding: 6px 10px; font-size: 12px; }

.card-table-head {
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) minmax(190px, .9fr) minmax(190px, .9fr) minmax(170px, .75fr) 260px;
  gap: 12px;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.cards { display: grid; gap: 8px; }
.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) minmax(190px, .9fr) minmax(190px, .9fr) minmax(170px, .75fr) 260px;
  gap: 12px;
  background: var(--panel-soft);
  align-items: center;
}

.card-main { display: grid; grid-template-columns: 22px 1fr; gap: 10px; min-width: 0; }
.card-check { width: 18px; height: 18px; margin-top: 4px; cursor: pointer; }
.card-key { font-family: Consolas, "Microsoft YaHei", monospace; font-weight: 900; word-break: break-all; }
.card-sub { margin-top: 6px; color: var(--muted); font-size: 12px; }
.cell-title { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.cell-value { font-weight: 800; word-break: break-all; }
.meta-line { color: var(--muted); font-size: 12px; margin-top: 5px; }

.badge { display: inline-flex; border-radius: 999px; padding: 3px 8px; font-size: 12px; font-weight: 900; }
.badge.unused { background: #eff6ff; color: var(--blue); }
.badge.active { background: #e6f8ee; color: var(--green); }
.badge.disabled,
.badge.expired { background: #ffe9ea; color: var(--red); }
.row-actions { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.row-actions button { padding: 8px 6px; font-size: 12px; }
.copy-btn { background: #edf4ff; color: var(--blue); }
.events { display: grid; gap: 8px; color: var(--muted); font-size: 13px; max-height: 220px; overflow: auto; }
.empty-line { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }
.hidden { display: none !important; }

@media (max-width: 1250px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; }
  .topbar { display: grid; }
  .topbar-stats { grid-template-columns: repeat(5, minmax(90px, 1fr)); }
  .create-layout { grid-template-columns: 1fr; }
  .card-table-head { display: none; }
  .card { grid-template-columns: 1fr; }
  .row-actions { grid-template-columns: repeat(5, 100px); justify-content: start; }
}

@media (max-width: 760px) {
  .main { padding: 14px; }
  .topbar-stats { grid-template-columns: repeat(2, 1fr); }
  .create-grid,
  .grid-4 { grid-template-columns: 1fr; }
  .toolbar { justify-content: stretch; }
  .toolbar-search,
  .toolbar select { width: 100%; }
}


.create-bottom-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  margin-top: 4px;
}

.create-bottom-row .create-button {
  width: 140px;
  min-height: 58px;
}

.created-box-inline {
  min-height: 58px;
}

.created-box-inline .created-head {
  display: none;
}

.created-box-inline pre {
  min-height: 58px;
  max-height: 96px;
  display: flex;
  align-items: center;
}
