:root {
  color-scheme: light;
  --bg: #08111f;
  --bg-soft: #0d1728;
  --panel: rgba(12, 20, 36, 0.78);
  --panel-solid: #ffffff;
  --panel-border: rgba(148, 163, 184, 0.18);
  --text: #e5eefc;
  --text-soft: #9db0cd;
  --text-dark: #0f172a;
  --muted-dark: #64748b;
  --brand: #5eead4;
  --brand-2: #60a5fa;
  --danger: #f87171;
  --shadow: 0 24px 80px rgba(2, 6, 23, 0.35);
  --radius: 0;
  --radius-sm: 0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text-dark);
  font-family: "Microsoft YaHei UI", "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(96, 165, 250, 0.28), transparent 28%),
    radial-gradient(circle at top right, rgba(94, 234, 212, 0.18), transparent 24%),
    linear-gradient(180deg, #0a1221 0%, #101b30 22%, #edf4ff 22.01%, #f6f9ff 100%);
  min-height: 100vh;
}

.app-shell {
  width: min(1600px, calc(100vw - 48px));
  margin: 24px auto 32px;
}

h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--text-soft); }
.danger { color: var(--danger); }
.hidden { display: none; }

.hero {
  position: relative;
  overflow: hidden;
  padding: 26px;
  border-radius: 0;
  background: linear-gradient(135deg, rgba(11, 18, 32, 0.92), rgba(22, 34, 58, 0.86));
  box-shadow: var(--shadow);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.18);
  margin-bottom: 18px;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -80px -100px auto;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(94, 234, 212, 0.16), transparent 70%);
  pointer-events: none;
}

.hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-title { max-width: 760px; }

.hero-title h1 {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}

.hero-title p {
  color: var(--text-soft);
  line-height: 1.7;
  font-size: 14px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.hero-subtitle {
  margin-top: 12px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-hero-subtitle {
  margin: -8px 0 18px;
  padding: 0 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-light {
  background: rgba(255, 255, 255, 0.08);
  color: #dbeafe;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.badge-policy-grace {
  background: rgba(94, 234, 212, 0.14);
  color: #0f766e;
}

.badge-policy-enforced {
  background: rgba(96, 165, 250, 0.16);
  color: #1d4ed8;
}

.badge-status-active {
  background: rgba(34, 197, 94, 0.14);
  color: #15803d;
}

.badge-status-revoked {
  background: rgba(248, 113, 113, 0.14);
  color: #b91c1c;
}

.badge-status-disabled {
  background: rgba(148, 163, 184, 0.18);
  color: #475569;
}

.surface-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.stat-card {
  grid-column: span 3;
  padding: 18px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 16px 50px rgba(15, 23, 42, 0.08);
}

.stat-card span {
  display: block;
  color: var(--muted-dark);
  font-size: 13px;
  margin-bottom: 10px;
}

.stat-card strong {
  font-size: 28px;
  line-height: 1;
  color: #0f172a;
}

.detail-stats .stat-card strong {
  font-size: 26px;
}

.stat-card em {
  display: block;
  margin-top: 8px;
  color: #475569;
  font-style: normal;
  font-size: 13px;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.card {
  grid-column: span 12;
  border-radius: var(--radius);
  padding: 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(226, 232, 240, 0.96);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
}

.card h2 {
  font-size: 20px;
  margin-bottom: 8px;
  color: #0f172a;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.detail-card-header {
  flex-wrap: nowrap;
}

.detail-header-badges {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.detail-header-badges .badge {
  white-space: nowrap;
}

.machine-code-badge {
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #e2e8f0;
}

.card-header p {
  color: var(--muted-dark);
  font-size: 13px;
  line-height: 1.7;
}

.overview-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.overview-search-form {
  margin: 0;
}

.overview-search-box {
  position: relative;
  display: block;
  width: min(360px, 36vw);
}

.overview-search-box input[type="text"] {
  min-height: 38px;
  padding-right: 44px;
}

.search-icon-button {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 38px;
  min-height: 36px;
  padding: 0;
  background: transparent;
  box-shadow: none;
  color: #2563eb;
}

.search-icon-button:hover {
  transform: none;
  filter: none;
  background: #eff6ff;
}

.overview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.secondary-button, .danger-button {
  min-height: 38px;
  box-shadow: none;
}

.secondary-button {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.danger-button {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.select-cell {
  width: 58px;
  text-align: center;
  vertical-align: middle;
}

.select-cell input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
  cursor: pointer;
}

.data-table-wrap {
  overflow: auto;
  border-radius: 0;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 10%);
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 1024px;
}

th, td {
  padding: 12px 12px;
  font-size: 13px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #edf2f7;
  color: #1e293b;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eff6ff;
  color: #334155;
  font-weight: 700;
  white-space: nowrap;
}

.sort-header {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.sort-header:hover {
  transform: none;
  filter: none;
  color: #1d4ed8;
}

.sort-header span {
  color: #64748b;
  font-size: 11px;
}

.sort-header.is-active span {
  color: #1d4ed8;
}

.time-cell-wide {
  min-width: 162px;
}

.time-cell {
  white-space: nowrap;
}

.time-split {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.35;
}

.time-split span:first-child {
  font-weight: 700;
}

tr:last-child td { border-bottom: none; }

.table-link {
  color: #2563eb;
  font-weight: 700;
}

.machine-code-details {
  max-width: min(72ch, calc(100vw - 96px));
}

.machine-code-details summary {
  color: #2563eb;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  white-space: nowrap;
}

.machine-code-details summary::-webkit-details-marker {
  display: none;
}

.machine-code-details summary::after {
  content: "展开";
  display: inline-flex;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 0;
  background: #eff6ff;
  color: #2563eb;
  font-size: 11px;
  font-weight: 700;
}

.machine-code-details[open] summary {
  margin-bottom: 8px;
}

.machine-code-details[open] summary::after {
  content: "收起";
}

.machine-code-full {
  display: block;
  width: max-content;
  max-width: min(72ch, calc(100vw - 96px));
  max-height: calc(1.55em * 8);
  overflow: auto;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.55;
}

.ellipsis {
  color: #64748b;
}

.metric-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-inline strong {
  color: #0f172a;
  font-size: 17px;
  line-height: 1;
}

.metric-inline span, .metric-inline em {
  color: #64748b;
  font-size: 12px;
  font-style: normal;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.detail-item {
  padding: 12px;
  border-radius: 0;
  background: linear-gradient(180deg, #f8fbff, #ffffff);
  border: 1px solid #e2e8f0;
}

.detail-item span {
  display: block;
  color: #64748b;
  font-size: 12px;
  margin-bottom: 8px;
}

.detail-item strong {
  font-size: 15px;
  color: #0f172a;
  word-break: break-word;
}

.forms-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

form.inline, .control-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 0;
  background: linear-gradient(180deg, #f8fbff, #ffffff);
  border: 1px solid #e2e8f0;
}

.control-form h3 {
  font-size: 15px;
  margin-bottom: 2px;
  color: #0f172a;
}

.control-form p {
  color: #64748b;
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 4px;
}

label.block, .field { display: block; }

label.block span, .field span {
  display: block;
  margin-bottom: 7px;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

input[type="text"], input[type="password"], select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 0;
  border: 1px solid #dbe4f0;
  outline: none;
  background: #ffffff;
  font: inherit;
  color: #0f172a;
  transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease;
}

input[type="text"]:focus, input[type="password"]:focus, select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
}

button {
  min-height: 42px;
  border: none;
  border-radius: 0;
  padding: 0 14px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  color: #0f172a;
  background: linear-gradient(135deg, #5eead4, #60a5fa);
  box-shadow: 0 10px 24px rgba(96, 165, 250, 0.28);
  transition: transform .16s ease, filter .16s ease;
}

button:hover { transform: translateY(-1px); filter: brightness(1.02); }

.ghost-button {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: none;
}

.login-shell {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 24px 0;
}

.login-card {
  width: min(1080px, calc(100vw - 48px));
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  border-radius: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.22);
}

.login-card-minimal {
  width: min(420px, calc(100vw - 48px));
  display: block;
}

.login-showcase {
  padding: 34px 30px;
  background:
    radial-gradient(circle at 18% 20%, rgba(94, 234, 212, 0.24), transparent 28%),
    radial-gradient(circle at 80% 12%, rgba(96, 165, 250, 0.28), transparent 24%),
    linear-gradient(135deg, #08111f 0%, #11203a 48%, #0e1a2c 100%);
  color: #e5eefc;
  position: relative;
}

.login-showcase h1 {
  font-size: 34px;
  margin-bottom: 16px;
  letter-spacing: 0.02em;
}

.login-showcase p {
  color: #a9bad4;
  line-height: 1.8;
  font-size: 14px;
  max-width: 420px;
}

.showcase-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.showcase-metric {
  padding: 14px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
}

.showcase-metric span {
  display: block;
  color: #9db0cd;
  font-size: 12px;
  margin-bottom: 8px;
}

.showcase-metric strong {
  font-size: 24px;
  color: #f8fafc;
}

.login-form-panel {
  padding: 34px 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.login-form-inner { width: 100%; }

.login-form-inner h2 {
  font-size: 28px;
  color: #0f172a;
  margin-bottom: 18px;
  text-align: center;
}

.login-form-inner > p {
  color: #64748b;
  line-height: 1.7;
  margin-bottom: 18px;
}

.alert {
  padding: 10px 12px;
  border-radius: 0;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.7;
}

.alert-warning {
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid #fdba74;
}

.alert-danger {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fca5a5;
}

.footer-note {
  margin-top: 14px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.7;
}

code {
  padding: 2px 5px;
  border-radius: 0;
  background: rgba(148, 163, 184, 0.14);
  color: inherit;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
}

@media (max-width: 1120px) {
  .stat-card { grid-column: span 6; }
  .detail-grid, .forms-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .app-shell { width: min(100vw - 24px, 100%); margin: 16px auto 28px; }
  .hero { padding: 18px; border-radius: 0; }
  .login-card { grid-template-columns: 1fr; }
  .login-showcase, .login-form-panel { padding: 24px 20px; }
  .stat-card, .detail-grid > *, .forms-grid > * { grid-column: span 12; }
  .detail-grid, .forms-grid { grid-template-columns: 1fr; }
}
