:root {
  color-scheme: light;
  --bg: #f7f8f3;
  --ink: #101828;
  --muted: #667085;
  --line: #d9ded3;
  --panel: #ffffff;
  --accent: #155eef;
  --accent-ink: #ffffff;
  --positive: #087443;
  --negative: #b42318;
  --warn-bg: #fff7d6;
  --warn-ink: #7a4b00;
  --shadow: 0 14px 36px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

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

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

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

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.05;
}

h2 {
  font-size: 20px;
}

.icon-button,
.text-button,
.primary-button,
.tab {
  border: 0;
  cursor: pointer;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 22px;
}

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

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px;
  background-repeat: no-repeat;
  background-size: 5px 5px;
}

.primary-button {
  min-height: 46px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
}

.error-text {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--negative);
  font-size: 14px;
}

.hidden {
  display: none !important;
}

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

.status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-strip > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--muted);
}

.status-dot.ok {
  background: var(--positive);
}

.status-dot.warn {
  background: #f79009;
}

.text-button {
  background: transparent;
  color: var(--accent);
  font-weight: 800;
}

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

.metric-card {
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric-card.span-2 {
  grid-column: span 2;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
  font-size: 24px;
  line-height: 1.05;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eaeee3;
}

.tab {
  min-height: 40px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tab.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 2px 10px rgba(16, 24, 40, 0.08);
}

.warnings {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 13px;
  font-weight: 700;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.filters {
  display: grid;
  grid-template-columns: minmax(108px, 0.7fr) minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.list {
  display: grid;
  gap: 10px;
}

.row-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.row-head,
.row-grid {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.row-head strong {
  font-size: 18px;
}

.row-head span,
.row-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.row-grid strong {
  font-size: 14px;
}

.positive {
  color: var(--positive);
}

.negative {
  color: var(--negative);
}

.empty-state {
  padding: 24px 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.log-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.log-card pre {
  max-height: 60vh;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

@media (min-width: 560px) {
  .metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .metric-card.span-2 {
    grid-column: span 2;
  }
}
