:root {
  color-scheme: light;
  --bg: #f8fafc;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #dbe3ef;
  --navy: #1e3a8a;
  --blue: #2563eb;
  --gold: #b45309;
  --green: #15803d;
  --red: #b91c1c;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Fira Sans", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

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

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--navy);
  color: #fff;
  padding: 0 16px;
  cursor: pointer;
  transition: background 180ms ease, box-shadow 180ms ease;
}

button:hover {
  background: #1d4ed8;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.2);
}

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

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: #0f172a;
  color: #e2e8f0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--navy);
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.panel h3 {
  margin: 0;
}

.settings-group h4 {
  margin: 0;
  color: #1e293b;
  font-size: 15px;
}

.brand h1 {
  font-size: 18px;
}

.brand p,
.notice span,
.panel-head span,
.muted {
  color: var(--muted);
}

.sidebar nav {
  display: grid;
  gap: 8px;
  margin-top: 32px;
}

.sidebar a {
  border-radius: 6px;
  color: #dbeafe;
  padding: 10px 12px;
  text-decoration: none;
}

.sidebar a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.notice {
  display: grid;
  gap: 8px;
  margin-top: 32px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 16px;
}

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

.hidden {
  display: none;
}

.login-panel,
.panel,
.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-panel {
  max-width: 720px;
  margin: 10vh auto;
  padding: 24px;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.stat {
  display: grid;
  gap: 6px;
  padding: 18px;
}

.stat span {
  color: var(--muted);
}

.stat strong {
  font-size: 28px;
}

.panel {
  margin-bottom: 16px;
  padding: 18px;
}

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

.summary-list {
  display: grid;
  gap: 12px;
}

.summary-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.summary-item code,
.output {
  font-family: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.summary-item code {
  overflow-wrap: break-word;
}

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

.form-grid.dense {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #334155;
  font-size: 14px;
  font-weight: 600;
}

.wide {
  grid-column: span 2;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

.check input {
  width: auto;
  min-height: auto;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

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

th {
  color: #475569;
  font-size: 13px;
}

td {
  overflow-wrap: break-word;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 10px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 700;
}

.badge.success {
  background: #dcfce7;
  color: var(--green);
}

.badge.error {
  background: #fee2e2;
  color: var(--red);
}

.run-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
}

.settings-form {
  display: grid;
  gap: 16px;
}

.settings-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.settings-group h4 {
  grid-column: 1 / -1;
}

.settings-group .wide {
  grid-column: span 2;
}

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

.output {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  color: #dbeafe;
  padding: 14px;
  white-space: pre-wrap;
}

@media (max-width: 960px) {
  .shell {
    grid-template-columns: 1fr;
  }

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

  .sidebar nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .stats-grid,
  .form-grid,
  .form-grid.dense,
  .run-form,
  .settings-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .content,
  .sidebar {
    padding: 16px;
  }

  .sidebar nav,
  .stats-grid,
  .form-grid,
  .form-grid.dense,
  .run-form,
  .settings-group {
    grid-template-columns: 1fr;
  }

  .wide,
  .settings-group .wide {
    grid-column: auto;
  }

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