:root {
  color-scheme: dark;
  font-family: Inter, "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #08111f;
  color: #e8f2ff;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 10%, rgba(0, 229, 255, .18), transparent 35%),
    radial-gradient(circle at 80% 20%, rgba(79, 70, 229, .22), transparent 34%),
    #08111f;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.admin-layout {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.admin-shell {
  display: grid !important;
  grid-template-columns: 260px minmax(0, 1fr) !important;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  background: rgba(3, 10, 24, .82);
  border-right: 1px solid rgba(99, 179, 237, .2);
  box-shadow: 18px 0 60px rgba(0, 0, 0, .24);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand h1 {
  margin: 0;
  font-size: 30px;
}

.side-nav {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 10px;
}

.nav-item {
  width: 100%;
  text-align: left;
  background: rgba(15, 23, 42, .66);
  border: 1px solid rgba(148, 163, 184, .14);
  color: #c7d7ea;
}

.nav-item:hover,
.nav-item.active {
  background: linear-gradient(135deg, rgba(34, 211, 238, .26), rgba(99, 102, 241, .38));
  border-color: rgba(34, 211, 238, .42);
  color: #fff;
}

.logout { margin-top: auto; }

.admin-content {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.content-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.content-topbar h2 {
  font-size: clamp(28px, 3vw, 42px);
  margin: 0;
}

.module-panel { display: none; }
.module-panel.active { display: block; }

.card {
  background: rgba(8, 19, 35, .86);
  border: 1px solid rgba(99, 179, 237, .25);
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .35);
  padding: 28px;
}

.hero { width: min(680px, 100%); }

.eyebrow {
  margin: 0 0 8px;
  color: #22d3ee;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
}

h1, h2 { margin: 0 0 16px; }

h1 { font-size: clamp(32px, 5vw, 54px); }
h2 { font-size: 22px; }

.muted { color: #a9bbcf; line-height: 1.7; }

.form {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

label { color: #c7d7ea; font-weight: 700; }

input, textarea, select {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, .35);
  background: rgba(15, 23, 42, .9);
  color: #e8f2ff;
  border-radius: 14px;
  padding: 14px 16px;
  font: inherit;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: #22d3ee;
  box-shadow: 0 0 0 4px rgba(34, 211, 238, .13);
}

button {
  border: 0;
  border-radius: 14px;
  min-height: 46px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #0e7490, #4338ca);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

button:disabled { opacity: .55; cursor: not-allowed; }

button:focus-visible {
  outline: 3px solid #67e8f9;
  outline-offset: 3px;
}

.secondary {
  background: rgba(148, 163, 184, .16);
  color: #e8f2ff;
  border: 1px solid rgba(148, 163, 184, .28);
}

.message {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(34, 211, 238, .12);
  border: 1px solid rgba(34, 211, 238, .24);
  color: #bae6fd;
}

.message.error {
  background: rgba(239, 68, 68, .12);
  border-color: rgba(239, 68, 68, .32);
  color: #fecaca;
}

.result { margin-top: 22px; }

.guide-box {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid rgba(99, 179, 237, .22);
}

.guide-steps {
  display: grid;
  gap: 12px;
  margin: 0 0 16px;
  padding-left: 24px;
  color: #c7d7ea;
  line-height: 1.7;
}

.guide-steps strong { color: #67e8f9; }

.form-help {
  margin: -4px 0 0;
  color: #8fa6c0;
  font-size: 13px;
  line-height: 1.5;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.result-head, .topbar, .section-head, .pager, .search-form {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.search-form {
  justify-content: flex-end;
  min-width: min(420px, 100%);
}

.search-form input { min-width: 240px; }

.stacked-search {
  align-items: stretch;
  flex-direction: column;
}

.filter-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.code-row button {
  min-width: 140px;
}

.filter-row select {
  min-width: 170px;
}

.pager {
  justify-content: center;
  margin-top: 18px;
}

.warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  padding: 8px 12px;
  border-radius: 10px;
}

.danger {
  background: linear-gradient(135deg, #ef4444, #f97316);
  padding: 8px 12px;
  border-radius: 10px;
}

.compact {
  padding: 8px 12px;
  border-radius: 10px;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-preview {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  color: #dbeafe;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cdk-full {
  word-break: break-all;
}

.legacy-cdk {
  display: inline-block;
  margin-left: 8px;
  color: #fbbf24;
  font-size: 12px;
}

pre, .output {
  white-space: pre-wrap;
  word-break: break-all;
  background: rgba(2, 6, 23, .65);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, .18);
}

.dashboard { display: grid; gap: 22px; }
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat {
  padding: 20px;
  border-radius: 18px;
  background: rgba(15, 23, 42, .78);
  border: 1px solid rgba(99, 179, 237, .2);
}
.stat strong { display: block; font-size: 30px; color: #22d3ee; }
.stat span { color: #a9bbcf; }

.batch-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.mini-stat {
  padding: 16px;
  border-radius: 16px;
  background: rgba(15, 23, 42, .7);
  border: 1px solid rgba(148, 163, 184, .18);
}

.mini-stat strong {
  display: block;
  color: #67e8f9;
  font-size: 24px;
}

.mini-stat span {
  color: #a9bbcf;
  font-size: 13px;
}

.sensitive-result {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid rgba(245, 158, 11, .45);
  border-radius: 16px;
  background: rgba(120, 53, 15, .2);
}

.sensitive-result input {
  margin: 10px 0 14px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid rgba(148, 163, 184, .15); }
th { color: #93c5fd; }

@media (max-width: 960px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
  }
  .side-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .shell { padding: 12px; }
  .card { padding: 20px 16px; border-radius: 18px; }
  .result-actions,
  .result-actions button {
    width: 100%;
  }
}

@media (max-width: 820px) {
  .grid, .stats, .batch-summary { grid-template-columns: 1fr; }
  .topbar, .content-topbar, .result-head, .section-head, .search-form { align-items: stretch; flex-direction: column; }
  .filter-row { align-items: stretch; flex-direction: column; }
  .search-form input { min-width: 0; }
}
