:root {
  --bg: #f5f6f8; --surface: #fff; --text: #1f2430; --muted: #6a7282; --border: #dde1e8;
  --primary: #2563eb; --primary-dark: #1d4ed8; --danger: #c62828; --ok: #1b7f4b; --warn-bg: #fff4d6; --warn-text: #7a5400;
  --error-bg: #fde8e8; --error-text: #8a1c1c; --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c; --surface: #1c2027; --text: #e7eaf0; --muted: #98a1b2; --border: #2e343e;
    --primary: #5b8cff; --primary-dark: #7ba0ff; --danger: #ff7b7b; --ok: #5fd39a; --warn-bg: #3a2f10; --warn-text: #f2d48a;
    --error-bg: #3b1c1c; --error-text: #ffb4b4;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.6;
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif; font-size: 16px; }
a { color: var(--primary); }
h1 { font-size: 1.5rem; margin: 0 0 .75rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.container { max-width: 1080px; margin: 0 auto; padding: 1.25rem 16px 3rem; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; padding: .6rem 16px;
  background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; flex: 1; }
.nav a, .userbox a { text-decoration: none; }
.nav a:hover, .userbox a:hover { text-decoration: underline; }
.userbox { display: flex; align-items: center; gap: .75rem; font-size: .9rem; flex-wrap: wrap; }
.who { color: var(--muted); }

.banner { padding: .6rem 16px; font-size: .95rem; }
.banner.warn, .alert.warn { background: var(--warn-bg); color: var(--warn-text); }
.alert { padding: .65rem .9rem; border-radius: var(--radius); margin: 0 0 1rem; }
.alert.error { background: var(--error-bg); color: var(--error-text); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 0 0 1rem; }
.card.narrow { max-width: 440px; margin: 2rem auto; }
.card.highlight { border-color: var(--primary); }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .5rem; }
.page-head.tight { margin-bottom: .25rem; }
.page-head h1, .page-head h2 { margin: 0; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.note { color: var(--warn-text); background: var(--warn-bg); display: inline-block; padding: 0 .4rem; border-radius: 4px; font-size: .8rem; margin-top: .15rem; }
.empty { color: var(--muted); padding: .75rem 0; }

label { display: block; font-size: .9rem; color: var(--muted); }
label.check { display: inline-flex; align-items: center; gap: .4rem; color: var(--text); margin-right: 1rem; }
input[type=text], input[type=password], input[type=search], select {
  width: 100%; margin-top: .25rem; padding: .5rem .6rem; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.stack { display: flex; flex-direction: column; gap: .9rem; }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem; }
.row.spaced { margin-top: 1rem; }
.row > label { flex: 0 1 auto; }
.grow { flex: 1 1 14rem; }
.inline { display: inline; margin: 0; }
.checks { display: flex; flex-wrap: wrap; }

button, .button { display: inline-block; font: inherit; font-size: .92rem; padding: .45rem .9rem; cursor: pointer; text-decoration: none;
  color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
button:hover, .button:hover { border-color: var(--primary); }
button.primary, .button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover, .button.primary:hover { background: var(--primary-dark); }
button.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
button.small { padding: .2rem .55rem; font-size: .82rem; }
button.link { border: 0; background: none; padding: 0; color: var(--primary); }
.stack button.primary { align-self: flex-start; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: .25rem 0; }
table { border-collapse: collapse; width: 100%; background: var(--surface); }
th, td { padding: .5rem .75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; background: var(--bg); position: sticky; top: 0; }
td.num, th:not(:first-child) { text-align: right; }
table.list th:not(:first-child) { text-align: left; }
table.list td.num { text-align: left; }
td.num { font-variant-numeric: tabular-nums; }
td.total { font-weight: 700; }
td.na { color: var(--muted); }
td.time { color: var(--muted); font-variant-numeric: tabular-nums; }
td.actions { white-space: normal; }
td.actions form + form, td.actions a + a { margin-left: .4rem; }
.src { display: block; font-size: .7rem; font-weight: 400; color: var(--muted); }
table.list td { white-space: normal; }
table.list td.mono { white-space: nowrap; }
table.data tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg) 55%, transparent); }

.latest { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin: 1rem 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem; }
.tile.total-tile { border-color: var(--primary); }
.tile-label { font-size: .85rem; color: var(--muted); }
.tile-value { font-size: 2.1rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; padding: .05rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
  background: var(--border); color: var(--muted); }
.badge.running { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.error { background: var(--error-bg); color: var(--error-text); }
.status { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
.status dt { color: var(--muted); }
.status dd { margin: 0; }
.steps { padding-left: 1.2rem; }
#initial-password { font-size: 1.3rem; letter-spacing: .06em; padding: .3rem .6rem; background: var(--bg); border-radius: 6px; user-select: all; }

@media (max-width: 640px) {
  h1 { font-size: 1.3rem; }
  .tile-value { font-size: 1.7rem; }
  .card.narrow { margin: 1rem auto; }
}
