:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #697386;
  --line: rgba(25, 36, 60, 0.12);
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --accent: #246bfd;
  --accent-soft: #eaf1ff;
  --danger: #d92d4d;
  --success: #169b62;
  font-family: Inter, "Microsoft YaHei UI", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 1100px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(223, 235, 255, 0.78), rgba(246, 241, 249, 0.68) 50%, rgba(235, 249, 243, 0.72)),
    #eef2f7;
}
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.hidden { display: none !important; }

.loginView {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 460px;
  align-items: center;
  gap: 80px;
  max-width: 1180px;
  margin: auto;
  padding: 70px;
}
.loginBrand { display: flex; align-items: center; gap: 20px; }
.loginBrand strong { display: block; font-size: 34px; }
.loginBrand span:last-child { display: block; margin-top: 8px; color: var(--muted); }
.brandMark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, #121a2f, #2b6cff 70%, #27a36b);
  font-weight: 800;
  box-shadow: 0 12px 32px rgba(36, 107, 253, 0.2);
}
.loginBrand .brandMark { width: 72px; height: 72px; font-size: 28px; }
.loginPanel {
  display: grid;
  gap: 18px;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 24px 70px rgba(30, 43, 70, 0.14);
  backdrop-filter: blur(26px);
}
.loginPanel header p, .contentBand header p, .topbar p, .dialogPanel header p {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}
.loginPanel h1, .contentBand h2, .topbar h1, .dialogPanel h2 { margin: 0; letter-spacing: 0; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(36, 107, 253, 0.11);
}
.formMessage { min-height: 18px; margin: -4px 0; color: var(--danger); font-size: 13px; }
.primaryButton {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  color: white;
  background: linear-gradient(135deg, #1a2238, #246bfd);
  font-weight: 700;
}

.appShell { min-height: 100vh; display: grid; grid-template-columns: 224px 1fr; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 224px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(247, 249, 253, 0.82);
  backdrop-filter: blur(24px);
}
.sidebarBrand { display: flex; align-items: center; gap: 12px; padding: 24px 20px; }
.sidebarBrand strong, .sidebarBrand span:last-child { display: block; }
.sidebarBrand span:last-child { margin-top: 2px; color: var(--muted); font-size: 11px; }
.sidebar nav { display: grid; gap: 5px; padding: 10px; }
.navButton {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: #4e596d;
  background: transparent;
  text-align: left;
}
.navButton:hover { background: rgba(36, 107, 253, 0.07); }
.navButton.active { color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.navIcon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid currentColor;
  border-radius: 5px;
  font-size: 11px;
}
.sidebar footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.iconButton {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.76);
}

.workspace { grid-column: 2; min-width: 0; padding: 26px 34px 50px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.topbar h1 { font-size: 25px; }
.serviceState { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.serviceState span { width: 8px; height: 8px; border-radius: 50%; background: #32c276; box-shadow: 0 0 0 4px rgba(50, 194, 118, 0.12); }
.view { display: none; }
.view.active { display: block; }
.metricStrip {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  backdrop-filter: blur(20px);
}
.metricStrip article { padding: 24px; border-right: 1px solid var(--line); }
.metricStrip article:last-child { border-right: 0; }
.metricStrip span { display: block; color: var(--muted); font-size: 13px; }
.metricStrip strong { display: block; margin-top: 12px; font-size: 30px; }
.contentBand {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  backdrop-filter: blur(20px);
}
.contentBand > header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.contentBand h2 { font-size: 18px; }
.quickActions { display: grid; grid-template-columns: repeat(3, 1fr); }
.quickActions button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 90px;
  padding: 18px 22px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  text-align: left;
}
.quickActions button:last-child { border-right: 0; }
.quickActions button:hover { background: rgba(255, 255, 255, 0.68); }
.quickActions span { color: var(--accent); font-size: 12px; }

.tableBand { overflow: hidden; }
.tableToolbar { gap: 20px; }
.filters { display: flex; align-items: center; gap: 8px; }
.filters input { width: 240px; }
.filters select { width: 150px; }
.filters button, .tableBand button, .dialogActions button, .generatorForm button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
}
.tableScroll { overflow: auto; max-height: calc(100vh - 185px); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 13px 16px; border-bottom: 1px solid rgba(25, 36, 60, 0.08); text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; color: var(--muted); background: rgba(247, 249, 252, 0.96); font-size: 12px; }
td small { display: block; margin-top: 3px; color: var(--muted); }
.statusBadge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 4px; background: #edf1f6; color: #596477; font-size: 12px; }
.statusBadge.success { color: #08784a; background: #e5f8ef; }
.statusBadge.danger { color: #b4233f; background: #fde9ee; }
.statusBadge.warning { color: #9b6311; background: #fff3dc; }
.tableAction { color: var(--accent) !important; background: transparent !important; border-color: rgba(36, 107, 253, 0.22) !important; }

.cardGenerator { margin-top: 0; }
.securityHint, .securityNotice { color: #9b6311; font-size: 12px; }
.generatorForm { display: grid; grid-template-columns: 180px 150px 130px minmax(220px, 1fr) 120px; align-items: end; gap: 12px; padding: 18px 22px 22px; }
.generatorForm .wideField { min-width: 0; }
.dangerButton { color: var(--danger) !important; border-color: rgba(217, 45, 77, 0.26) !important; }

dialog { padding: 0; border: 0; border-radius: 8px; background: transparent; box-shadow: 0 30px 90px rgba(18, 28, 48, 0.28); }
dialog::backdrop { background: rgba(19, 27, 43, 0.4); backdrop-filter: blur(7px); }
.dialogPanel { width: 500px; display: grid; gap: 16px; padding: 24px; background: #f9fbfe; }
.dialogPanel header { display: flex; align-items: center; justify-content: space-between; }
.dialogStatus { padding: 13px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--muted); font-size: 13px; }
.dialogActions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }
.dialogActions .primaryButton { color: white; border: 0; background: linear-gradient(135deg, #1a2238, #246bfd); }
.codeDialogPanel { width: 680px; }
.codeDialogPanel textarea { height: 300px; resize: none; font-family: Consolas, monospace; line-height: 1.55; }
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: 6px;
  color: white;
  background: #172033;
  box-shadow: 0 12px 36px rgba(20, 31, 52, 0.25);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 180ms ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1250px) {
  .generatorForm { grid-template-columns: 160px 140px 120px 1fr; }
  .generatorForm button { grid-column: 4; }
}
