:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --panel: #ffffff;
  --line: #d9e1ee;
  --text: #132238;
  --muted: #5f6f85;
  --primary: #2f6fed;
  --primary-strong: #1d4ed8;
  --danger: #d14343;
  --success: #14804a;
  --sidebar: #0f172a;
  --sidebar-soft: #1e293b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 50;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #12351f;
  color: #f0fff5;
  box-shadow: 0 14px 36px rgba(15, 23, 42, .18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity .18s ease, transform .18s ease;
  font-size: 14px;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast.error { background: #5b1d1d; }
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}
.sidebar {
  background: linear-gradient(180deg, var(--sidebar), #111827);
  color: #e5edf9;
  padding: 24px 18px;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.12);
  font-weight: 700;
}
.brand-title { font-size: 18px; font-weight: 700; }
.brand-sub { font-size: 12px; color: #a8b6ca; }
.nav { display: grid; gap: 10px; }
.nav-btn {
  border: 0;
  height: 42px;
  border-radius: 8px;
  background: transparent;
  color: #d7e2f2;
  text-align: left;
  padding: 0 14px;
  cursor: pointer;
}
.nav-btn.active, .nav-btn:hover { background: rgba(255,255,255,.1); }
.main { padding: 24px; }
.main.view-transition {
  animation: viewFade .2s ease;
}
.hero, .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.hero {
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.hero h1 { margin: 0 0 6px; font-size: 26px; }
.hero p { margin: 0; color: var(--muted); }
.hero-actions { display: flex; gap: 10px; }
.card { padding: 18px; margin-bottom: 18px; }
.create-card { padding: 20px; }
.login-card { max-width: 980px; }
.grid {
  display: grid;
  gap: 14px;
}
.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.create-layout {
  display: grid;
  gap: 18px;
}
.form-section {
  display: grid;
  gap: 12px;
}
.form-section-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}
.license-form {
  grid-template-columns: 2fr 1fr 1fr 1.2fr;
  align-items: end;
}
label { display: grid; gap: 8px; }
label span { font-size: 13px; color: var(--muted); }
input,
select {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.feature-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.feature-check input { width: 18px; height: 18px; flex: 0 0 auto; }
.feature-check span {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.actions { display: flex; gap: 10px; margin-top: 16px; }
.create-actions {
  justify-content: flex-end;
  margin-top: 18px;
}
.btn {
  min-width: 92px;
  height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn.primary {
  background: var(--primary);
  color: #fff;
}
.btn.primary:hover { background: var(--primary-strong); }
.btn.ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}
.status { color: var(--muted); min-height: 20px; }
.hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.result-box {
  min-height: 96px;
  border-radius: 8px;
  background: #0f172a;
  color: #dbe7ff;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.btn:disabled,
.row-actions button:disabled {
  cursor: wait;
  opacity: .7;
}
.is-busy {
  position: relative;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}
.section-head h2 { margin: 0; font-size: 18px; }
.section-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.table-wrap { overflow: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 12px 10px;
  border-bottom: 1px solid #ebf0f7;
  text-align: left;
  white-space: nowrap;
  font-size: 13px;
}
th { color: var(--muted); font-weight: 600; }
tbody tr {
  transition: background-color .2s ease, opacity .18s ease, transform .18s ease;
}
tbody tr.row-highlight {
  animation: rowFlash 1.4s ease;
}
tbody tr.row-removing {
  opacity: .45;
  transform: translateX(8px);
}
.license-key {
  display: inline-block;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
  color: var(--text);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
}
.feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 260px;
}
.feature-pill {
  display: inline-block;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid #cdd8ea;
  border-radius: 999px;
  background: #f7faff;
  color: #23405f;
  padding: 3px 8px;
  font-size: 12px;
  line-height: 18px;
}
.empty-cell {
  color: var(--muted);
  text-align: center;
}
.row-actions { display: flex; gap: 8px; }
.row-actions button {
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 10px;
  cursor: pointer;
}
.row-actions .danger { color: var(--danger); }
.hidden { display: none; }

@keyframes rowFlash {
  0% { background: #fff7d6; }
  100% { background: transparent; }
}

@keyframes viewFade {
  from { opacity: .82; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1280px) {
  .license-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }
  .grid.two,
  .license-form,
  .feature-grid {
    grid-template-columns: 1fr;
  }
  .create-actions { justify-content: stretch; }
  .create-actions .btn { width: 100%; }
}
