:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f0f1f4; --border: #dfe2e8;
  --text: #171a21; --muted: #626a78; --accent: #1f5fd1; --accent-text: #ffffff;
  --ok: #17794a; --ok-bg: #e2f4ea; --bad: #b3261e; --bad-bg: #fbe6e4; --warn: #8a5a00; --warn-bg: #fdf0d2;
  --shadow: 0 1px 2px rgba(20, 24, 33, .06), 0 4px 16px rgba(20, 24, 33, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1217; --surface: #181c23; --surface-2: #20252e; --border: #2c323d;
    --text: #e8ebf0; --muted: #98a1b0; --accent: #6ea0ff; --accent-text: #0b1220;
    --ok: #62d596; --ok-bg: #143324; --bad: #ff8a80; --bad-bg: #3d1a18; --warn: #f0c060; --warn-bg: #3a2c0c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px;
  padding: 7px 13px; cursor: pointer; white-space: nowrap;
}
button:hover { background: var(--surface-2); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--bad); }
button.small { padding: 4px 10px; font-size: 13px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 8px 10px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 14px; }

/* login */
#login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
#login form {
  width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 26px; box-shadow: var(--shadow);
}
#login h1 { font-size: 20px; margin: 0 0 4px; }
#login p { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
#login button { width: 100%; padding: 10px; }
.error { color: var(--bad); font-size: 14px; margin: 10px 0 0; min-height: 20px; }

/* app */
header.top {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px;
  border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5;
}
header.top h1 { font-size: 17px; margin: 0; flex: 1; }
header.top h1 span { color: var(--muted); font-weight: 400; }
#refreshed { color: var(--muted); font-size: 13px; }
main { max-width: 1120px; margin: 0 auto; padding: 20px 16px 60px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.stat b { display: block; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.bad b { color: var(--bad); }
.stat.warn b { color: var(--warn); }

section.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  margin-bottom: 20px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; flex-wrap: wrap; }
.card-head h2 { font-size: 16px; margin: 0; flex: 1; }
.card-head input[type=search] { max-width: 240px; }
.card-body { padding: 0 16px 16px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }

.table-wrap { overflow-x: auto; border-top: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; }
td.actions button { margin-left: 4px; }
.mono { font-family: Consolas, "SF Mono", Menlo, monospace; font-size: 13.5px; }
.sub { color: var(--muted); font-size: 13px; }
.empty { padding: 26px 16px; color: var(--muted); text-align: center; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 600; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.dot.on { background: var(--ok); }

.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 180px; }
.files { list-style: none; margin: 14px 0 0; padding: 0; border: 1px solid var(--border); border-radius: 10px; }
.files li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.files li:last-child { border-bottom: 0; }
.files li .name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
progress { width: 100%; height: 8px; margin-top: 10px; }

dialog {
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text);
  padding: 22px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
dialog::backdrop { background: rgba(10, 12, 16, .5); }
dialog h3 { margin: 0 0 16px; font-size: 17px; }
dialog .buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }
.check input { width: auto; }

#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 9px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100vw - 32px); z-index: 20;
}
#toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  header.top { padding: 12px 16px; }
  #refreshed { display: none; }
  .card-head input[type=search] { max-width: none; flex-basis: 100%; order: 3; }
}
.w-version { width: 130px; }
.mt { margin-top: 14px; }
code { font-family: Consolas, "SF Mono", Menlo, monospace; font-size: .92em; }
