:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #697782;
  --line: #d9e0e6;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --warn: #9a5b00;
  --bad: #a93232;
  --good: #167044;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.login-shell {
  align-items: center;
  display: flex;
  min-height: 100vh;
  padding: 24px;
}

.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  margin: 0 auto;
  padding: 22px;
  width: min(420px, 100%);
}

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

.top-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.user-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  padding: 6px 10px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 17px;
  margin-bottom: 10px;
}

.hint,
#latest-run,
.path {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 7px;
  min-height: 38px;
  padding: 8px 13px;
  cursor: pointer;
}

button:hover {
  border-color: #aebbc5;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button.primary,
form button {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

button.primary:hover,
form button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

button.primary.is-running,
button.primary.is-running:hover {
  background: #11181c;
  border-color: #11181c;
  color: #dce7ea;
  opacity: 1;
}

input[type="file"],
input[type="text"],
input[type="password"],
select,
.search input,
.upload input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  padding: 8px 10px;
}

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

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  padding: 13px;
}

.metric strong {
  display: block;
  font-size: 24px;
  line-height: 1.1;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

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

.panel {
  padding: 16px;
}

.upload,
.search,
.stack-form {
  display: grid;
  gap: 8px;
  margin: 14px 0 10px;
}

.upload,
.search {
  grid-template-columns: minmax(0, 1fr) auto;
}

.primary {
  margin-top: 12px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
}

.check input {
  width: 16px;
  height: 16px;
}

.run-led {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 8px;
  margin-top: 12px;
  min-height: 24px;
}

.run-led strong {
  font-size: 13px;
}

.led-dot {
  background: #96a1aa;
  border-radius: 50%;
  display: inline-block;
  height: 10px;
  width: 10px;
}

.run-led.status-running .led-dot {
  animation: led-pulse 1.2s ease-in-out infinite;
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(22, 112, 68, 0.14);
}

.run-led.status-ok .led-dot {
  background: var(--good);
}

.run-led.status-failed .led-dot {
  background: var(--bad);
}

@keyframes led-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(22, 112, 68, 0.12);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(22, 112, 68, 0.22);
  }
}

.path {
  overflow-wrap: anywhere;
}

.run-monitor {
  border: 1px solid var(--line);
  border-radius: 7px;
  margin-top: 12px;
  overflow: hidden;
}

.monitor-head {
  align-items: center;
  background: #eef3f4;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 8px 10px;
}

.monitor-head strong {
  font-size: 13px;
}

.monitor-head span {
  color: var(--muted);
  font-size: 12px;
}

.progress-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.progress-track {
  background: #e6ecef;
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

.progress-bar {
  background: var(--accent);
  border-radius: inherit;
  height: 100%;
  transition: width 180ms ease, background 180ms ease;
  width: 0%;
}

.progress-bar.status-ok {
  background: var(--good);
}

.progress-bar.status-failed {
  background: var(--bad);
}

.progress-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.run-error {
  background: #fff4f4;
  border: 1px solid #e6b6b6;
  border-radius: 7px;
  color: var(--bad);
  font-size: 13px;
  line-height: 1.45;
  padding: 10px;
}

.run-monitor details {
  color: var(--muted);
  font-size: 13px;
}

.run-monitor summary {
  cursor: pointer;
}

.run-monitor pre {
  background: #11181c;
  color: #dce7ea;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  margin: 8px 0 0;
  max-height: 260px;
  overflow: auto;
  padding: 10px;
  white-space: pre-wrap;
}

.results,
.runs {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.row {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: #fbfcfd;
}

.row strong {
  display: block;
  margin-bottom: 4px;
}

.row small,
.row p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.evidence-month {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafb;
  overflow: hidden;
}

.evidence-month summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  list-style: none;
  padding: 10px 12px;
}

.evidence-month summary::-webkit-details-marker {
  display: none;
}

.evidence-month summary::before {
  color: var(--accent-dark);
  content: "›";
  font-size: 18px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 120ms ease;
}

.evidence-month[open] summary::before {
  transform: rotate(90deg);
}

.evidence-month summary strong {
  flex: 1;
}

.evidence-month summary span,
.evidence-day-heading span {
  color: var(--muted);
  font-size: 12px;
}

.evidence-day {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  padding: 10px;
}

.evidence-day-heading {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.evidence-day-heading strong {
  font-size: 13px;
}

.evidence-day-items {
  display: grid;
  gap: 8px;
}

.evidence-row {
  background: white;
}

.file-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.file-links a {
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--accent-dark);
  font-size: 12px;
  padding: 6px 8px;
  text-decoration: none;
}

.file-links a:hover {
  border-color: var(--accent);
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.user-actions input {
  min-width: 180px;
}

.status-ok {
  color: var(--good);
}

.status-failed {
  color: var(--bad);
}

.status-running {
  color: var(--warn);
}

@media (max-width: 820px) {
  .metrics,
  .grid.two,
  .upload,
  .search {
    grid-template-columns: 1fr;
  }

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