:root {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1c1f24;
  --muted: #6b7280;
  --border: #e2e4e8;
  --accent: #2563eb;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --danger-bg: #fde8e8;
  --forced-bg: #fef3c7;
  --info-bg: #e0edff;
}

* { box-sizing: border-box; }

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

header.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

header.topbar h1 {
  font-size: 18px;
  margin: 0;
  margin-right: auto;
}

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

.cell-box input {
  font-size: 16px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 160px;
}

button {
  font-size: 15px;
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button:hover { filter: brightness(1.08); }
button:disabled { opacity: .5; cursor: not-allowed; }

.cell-status {
  font-size: 14px;
  color: var(--muted);
}
.cell-status.active { color: var(--ok); font-weight: 600; }

.logout-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 20;
}
.login-screen[hidden] { display: none; }

.login-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  width: 90%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-box h1 {
  font-size: 18px;
  margin: 0 0 8px;
}

.login-box input {
  font-size: 16px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 16px;
}

main {
  padding: 24px;
  max-width: 1000px;
  margin: 0 auto;
}

.scan-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.scan-panel input {
  width: 100%;
  font-size: 20px;
  padding: 12px;
  border: 2px solid var(--accent);
  border-radius: 6px;
  margin-top: 6px;
}

.hint {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

th {
  background: rgba(0,0,0,.03);
  font-weight: 600;
}

tr.status-pending td { color: var(--muted); }
tr.status-error td { color: var(--danger); }
tr.status-not-found td { color: var(--warn); }

tr.flag-blocked {
  background: var(--danger-bg);
}

tr.flag-forced {
  background: var(--forced-bg);
}

tr.flag-info {
  background: var(--info-bg);
}

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.status-pill.pending { background: #e5e7eb; color: #374151; }
.status-pill.ok { background: #dcfce7; color: #15803d; }
.status-pill.info { background: #dbeafe; color: #1d4ed8; }
.status-pill.blocked { background: #fee2e2; color: #b91c1c; }
.status-pill.forced { background: #fef3c7; color: #92400e; }
.status-pill.not-found { background: #fef3c7; color: #92400e; }
.status-pill.error { background: #fee2e2; color: #b91c1c; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --panel: #1e2126;
    --text: #e7e9ec;
    --muted: #9aa1ab;
    --border: #2c3038;
    --danger-bg: #3a1c1c;
    --forced-bg: #3a2f14;
    --info-bg: #1a2a42;
  }
  th { background: rgba(255,255,255,.04); }
}
