:root {
  --bg: #0f1419;
  --panel: #1a222c;
  --line: #2c3846;
  --text: #e8eef4;
  --muted: #8a9aab;
  --accent: #3d8bfd;
  --ok: #3dd68c;
  --fail: #f07178;
  --warn: #e6b450;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font: 14px/1.45 "IBM Plex Sans", "Segoe UI", sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #1c3348 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.err { color: var(--fail); margin: 0; }
.note {
  margin: 0 1.25rem 1rem;
  padding: 0.75rem 1rem;
  background: #1e2a36;
  border-left: 3px solid var(--warn);
  color: #d7e0ea;
  font-size: 13px;
}

/* Login card — same structure as the editor (centered modal, password, remember) */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login form {
  width: min(360px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 12px;
}
.login h1 { margin: 0; font-size: 22px; }
.login .muted { font-size: 12px; margin: 0; }
.login input[type="password"] {
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1218;
  color: var(--text);
}
.login .remember { margin: 0; color: var(--muted); font-size: 13px; }
.login button, header button, .actions button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #243040;
  color: var(--text);
  padding: 8px 14px;
  font: inherit;
}
.login button, .actions .primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.actions .ghost, header .ghost { background: transparent; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 20, 25, 0.85);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 2;
}
header h1 { margin: 0; font-size: 1.15rem; font-weight: 600; flex: 1; }
.brand { font-weight: 700; letter-spacing: 0.02em; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.75rem;
  align-items: center;
  padding: 1rem 1.25rem;
}
.chk { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--muted); font-size: 13px; }
.resort-bak { display: inline-flex; gap: 0.4rem; align-items: center; }
.resort-bak select {
  min-width: 10rem;
  padding: 0.45rem 0.5rem;
  background: #0d1218;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.job { padding: 0 1.25rem 1rem; }
.job-bar {
  height: 8px;
  background: #243040;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.job-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.job-fill.ok { background: var(--ok); }
.job-fill.fail { background: var(--fail); }
.job-log {
  max-height: 220px;
  overflow: auto;
  background: #0d1218;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  font: 12px/1.4 ui-monospace, Menlo, monospace;
  white-space: pre-wrap;
}

.table-wrap {
  padding: 0 1.25rem 2rem;
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: rgba(26, 34, 44, 0.7);
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 0.45rem 0.55rem;
  text-align: right;
  white-space: nowrap;
}
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: #1a222c; }
th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: #1a222c; z-index: 1; }
th:first-child { z-index: 2; }
tr:hover td { background: #222c38; }
tr:hover td:first-child { background: #222c38; }
.num-warn { color: var(--warn); }
.num-bad { color: var(--fail); font-weight: 600; }
.num-ok { color: var(--ok); }

#status { padding: 0 1.25rem 1.5rem; }

/* Full-page boot spinner after password (while /api/table loads) */
.boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(15, 20, 25, 0.78);
  backdrop-filter: blur(4px);
}
.boot-card {
  display: grid;
  gap: 14px;
  justify-items: center;
  width: min(280px, 88vw);
  padding: 28px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}
.boot-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #2c3846;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: boot-spin 0.7s linear infinite;
}
.boot-label {
  margin: 0;
  font-size: 14px;
  color: var(--text);
  text-align: center;
}
@keyframes boot-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 720px) {
  header h1 { flex-basis: 100%; order: 2; }
}
