:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #141820;
  --muted: #6b7280;
  --line: #dde2ea;
  --accent: #1677ff;
  --accent-strong: #0958d9;
  --ok: #168a4a;
  --warn: #b45309;
  --bad: #c21f32;
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

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

button {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  font-weight: 700;
}

button.secondary {
  background: #eef3ff;
  color: var(--accent-strong);
}

button.danger {
  background: #fff0f0;
  color: var(--bad);
}

button.ghost {
  background: transparent;
  color: var(--accent-strong);
  padding: 0 8px;
}

button:disabled {
  opacity: .45;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 42px;
  padding: 9px 11px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.splash {
  padding: 40px 20px;
  color: var(--muted);
  text-align: center;
}

.auth-shell {
  min-height: 100svh;
  display: grid;
  align-content: center;
  padding: 24px 18px;
}

.auth-card,
.panel,
.item,
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.auth-card {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.brand {
  display: grid;
  gap: 4px;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.brand p,
.muted {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.app-shell {
  min-height: 100svh;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 16px;
  background: rgba(246, 247, 249, .92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.content {
  display: grid;
  gap: 12px;
  padding: 12px;
}

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

.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.metric strong {
  display: block;
  font-size: 22px;
  line-height: 1.15;
}

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

.panel {
  padding: 12px;
  display: grid;
  gap: 12px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-title h2 {
  margin: 0;
  font-size: 16px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row > * {
  min-width: 0;
}

.row button {
  flex: 0 0 auto;
}

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

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

.item {
  padding: 11px;
  display: grid;
  gap: 7px;
}

.item-hit {
  border-color: #f5b84b;
  background: #fffaf0;
}

.item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.item-head > *:first-child {
  min-width: 0;
}

.item-title {
  font-weight: 800;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.ok {
  background: #e8f7ef;
  color: var(--ok);
}

.badge.warn {
  background: #fff7ed;
  color: var(--warn);
}

.badge.hit {
  background: #fff0c2;
  color: #8a5200;
}

.badge.bad {
  background: #fff0f0;
  color: var(--bad);
}

.switch {
  position: relative;
  display: inline-flex;
  width: 48px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd5e1;
}

.switch span::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform .18s ease;
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  min-height: calc(62px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--line);
}

.tabs button {
  min-height: 62px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  padding: 6px 2px;
  font-size: 12px;
}

.tabs button.active {
  color: var(--accent-strong);
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(78px + env(safe-area-inset-bottom));
  z-index: 50;
  background: #101828;
  color: #fff;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
  box-shadow: 0 12px 28px rgba(16, 24, 40, .2);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, .42);
  display: grid;
  align-items: end;
}

.modal-card {
  max-height: 88svh;
  overflow: auto;
  border-radius: 8px 8px 0 0;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.check-list {
  display: grid;
  gap: 8px;
  max-height: 210px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
}

.check-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: start;
  color: var(--text);
  font-size: 14px;
}

.check-row input {
  width: 20px;
  min-height: 20px;
}

@media (min-width: 720px) {
  .auth-shell,
  .app-shell {
    max-width: 520px;
    margin: 0 auto;
  }
}
