:root {
  color-scheme: light;
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #111827;
  --muted: #64748b;
  --line: #d9e1ec;
  --brand: #1769e0;
  --brand-dark: #0f4fb7;
  --teal: #0f9f8f;
  --amber: #b7791f;
  --red: #c24141;
  --green: #168a52;
  --code: #121826;
  --shadow: 0 18px 40px rgba(30, 41, 59, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(23, 105, 224, 0.08), transparent 38%),
    linear-gradient(310deg, rgba(15, 159, 143, 0.1), transparent 34%),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1fr) 420px;
}

.login-hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--teal));
}

.hero-copy {
  width: min(760px, 100%);
}

.hero-copy h1 {
  margin: 0 0 18px;
  font-size: clamp(2.6rem, 7vw, 5.4rem);
  line-height: 1;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.8;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 760px;
}

.stat-tile,
.metric-card,
.panel,
.table-panel,
.login-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.stat-tile {
  padding: 18px;
}

.stat-tile strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1.6rem;
}

.stat-tile span,
.metric-label,
.meta,
.muted {
  color: var(--muted);
}

.login-side {
  display: flex;
  align-items: center;
  padding: 24px;
  background: rgba(255, 255, 255, 0.5);
}

.login-card {
  width: 100%;
  padding: 28px;
}

.login-card h2 {
  margin: 0 0 18px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field label {
  color: #334155;
  font-size: 0.86rem;
  font-weight: 700;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.textarea {
  min-height: 116px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.12);
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  font-weight: 750;
}

.button.primary {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
}

.button.primary:hover {
  background: var(--brand-dark);
}

.button.danger {
  border-color: rgba(194, 65, 65, 0.3);
  color: var(--red);
}

.button.full {
  width: 100%;
}

.error {
  margin: 12px 0 0;
  color: var(--red);
  font-size: 0.9rem;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 28px;
}

.nav button {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  color: #334155;
  background: transparent;
  text-align: left;
  font-weight: 750;
}

.nav button.active,
.nav button:hover {
  color: var(--brand);
  background: rgba(23, 105, 224, 0.09);
}

.sidebar-footer {
  position: absolute;
  right: 16px;
  bottom: 18px;
  left: 16px;
  display: grid;
  gap: 10px;
}

.content {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-pill,
.status,
.tag {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.mode-pill {
  color: #075985;
  background: #e0f2fe;
}

.status.ok {
  color: var(--green);
  background: #e9f8ef;
}

.status.warn {
  color: var(--amber);
  background: #fff7df;
}

.status.off {
  color: var(--red);
  background: #fff0f0;
}

.tag {
  color: #475569;
  background: #eef2f7;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  padding: 18px;
  box-shadow: none;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 1.6rem;
  letter-spacing: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
}

.panel,
.table-panel {
  padding: 18px;
  box-shadow: none;
}

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

.panel-header h2,
.table-panel h2 {
  margin: 0;
  font-size: 1rem;
}

.bars {
  display: flex;
  height: 220px;
  align-items: end;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-top: 12px;
}

.bar {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 8px;
  align-items: end;
  text-align: center;
}

.bar-fill {
  min-height: 8px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--brand), var(--teal));
}

.bar span {
  color: var(--muted);
  font-size: 0.78rem;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #475569;
  font-size: 0.78rem;
  text-transform: uppercase;
}

td {
  color: #1f2937;
  font-size: 0.92rem;
}

.mono,
pre,
code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

pre {
  overflow: auto;
  margin: 0;
  border-radius: 8px;
  padding: 14px;
  color: #e5e7eb;
  background: var(--code);
}

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

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--surface-soft);
}

.secret-box {
  display: grid;
  gap: 10px;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 14px;
  background: #ecfdf5;
}

.playground {
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(0, 1.28fr);
  gap: 18px;
}

.output {
  display: grid;
  gap: 14px;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 22px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
}

@media (max-width: 1040px) {
  .login-screen,
  .shell,
  .grid-2,
  .playground {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .sidebar-footer {
    position: static;
    margin-top: 24px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .login-hero,
  .content {
    padding: 18px;
  }

  .login-side {
    padding: 18px;
  }

  .hero-stats,
  .metrics,
  .form-grid,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
