:root {
  --bg: #f5f6f8; --card: #fff; --ink: #1d232b; --muted: #6b7480; --line: #dde1e6;
  --accent: #1f5fae; --accent-ink: #fff; --head: #18324f;
  --bad: #b42318; --bad-bg: #fde8e6; --warn: #8a5a00; --warn-bg: #fff4d6;
  --ok: #18794e; --ok-bg: #e3f5ea; --info: #1f5fae; --info-bg: #e5effa; --gap: #fff9c4;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 15px; margin: 24px 0 8px; }
.muted { color: var(--muted); font-weight: normal; }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

header.top { display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 48px; background: var(--head); color: #fff; position: sticky; top: 0; z-index: 10; }
header.top a { color: #cfdbe8; }
header.top .brand { color: #fff; font-weight: 600; }
header.top nav { display: flex; gap: 4px; flex: 1; }
header.top nav a { padding: 6px 10px; border-radius: 4px; }
header.top nav a.on, header.top nav a:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
header.top .who { font-size: 12px; color: #cfdbe8; }
main { padding: 16px 20px 40px; max-width: 1800px; margin: 0 auto; }

.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 12px; margin-bottom: 12px; }

button, .btn { font: inherit; padding: 6px 12px; border: 1px solid var(--line); background: #fff; border-radius: 4px; cursor: pointer; color: var(--ink); display: inline-block; }
button:hover, .btn:hover { border-color: var(--accent); text-decoration: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
input, select, textarea { font: inherit; padding: 5px 7px; border: 1px solid var(--line); border-radius: 4px; background: #fff; width: 100%; }
label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
label.inline { flex-direction: row; align-items: center; gap: 4px; color: var(--ink); font-size: 13px; }
label.inline input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px; margin: 0; }
legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
.grow { flex: 1; min-width: 220px; }

.flash { padding: 8px 12px; border-radius: 4px; margin-bottom: 12px; background: var(--info-bg); color: var(--info); }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--bad-bg); color: var(--bad); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }

.login { max-width: 320px; margin: 12vh auto; display: flex; flex-direction: column; gap: 12px; }
.login h1 { text-align: center; margin-bottom: 8px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 6px; padding: 12px; display: flex; flex-direction: column; color: var(--ink); }
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile .n { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--muted); font-size: 12px; }
.tile.bad { border-left-color: var(--bad); } .tile.bad .n { color: var(--bad); }
.tile.warn { border-left-color: #d99a00; } .tile.warn .n { color: var(--warn); }
.tile.info { border-left-color: var(--info); }
.tile.zero .n { color: var(--muted); }

.scroll { overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
.scroll.tall { max-height: calc(100vh - 160px); }
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
table.grid th, table.grid td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.grid thead th { background: #eef1f4; font-weight: 600; white-space: nowrap; }
table.grid.sticky thead th { position: sticky; top: 0; z-index: 1; cursor: pointer; }
table.grid tbody tr:hover { background: #f7f9fb; }
table.num { width: auto; min-width: 60%; }
table.num td { text-align: right; min-width: 64px; font-variant-numeric: tabular-nums; }
table.num tr.total { font-weight: 600; background: #f3f5f7; }
td.gap, label.gap input { background: var(--gap); }
td.no { color: var(--bad); }
tr.closed td { color: var(--muted); }
td.old { color: var(--muted); }
td.new { font-weight: 500; }

.badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 10px; margin-left: 4px; vertical-align: middle; font-weight: 500; }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--info-bg); color: var(--info); }
.src { font-size: 11px; padding: 1px 6px; border-radius: 3px; background: #eef1f4; }
.src.manual { background: var(--info-bg); color: var(--info); }
.src.sync { background: var(--ok-bg); color: var(--ok); }
.src.import { background: var(--warn-bg); color: var(--warn); }
.status { font-weight: 600; }
.status.ok { color: var(--ok); } .status.partial { color: var(--warn); } .status.failed { color: var(--bad); } .status.running { color: var(--info); }

.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { padding: 4px 10px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); font-size: 12px; color: var(--ink); }
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip.plain { background: transparent; }
.filters .frow, .frow { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters details { margin-top: 10px; }
.filters summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 8px; }
.colpick { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; }
.filters .frow:last-child { margin-top: 10px; }
.bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; position: sticky; top: 48px; z-index: 5; }
.bulk select, .bulk input { width: auto; }
.bulk input.grow { flex: 1; }

.editform fieldset { margin-bottom: 12px; }
.egrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.egrid label span { display: flex; justify-content: space-between; }
i.sys { font-style: normal; font-size: 10px; color: var(--ok); background: var(--ok-bg); padding: 0 4px; border-radius: 3px; }
small.srcval { color: var(--info); }
.mism { border-color: var(--info); }
.mism table { margin: 8px 0; }
pre.log { background: #11161c; color: #d6dde4; padding: 12px; border-radius: 6px; overflow: auto; font-size: 12px; max-height: 70vh; }

@media (max-width: 700px) {
  header.top { height: auto; flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
  main { padding: 12px 16px 40px; }
}

.bgbanner { background: var(--bad); color: #fff; text-align: center; padding: 4px; font-size: 12px; font-weight: 600; }
.role { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; background: rgba(255,255,255,.15); padding: 1px 6px; border-radius: 3px; }
.btn.big { display: block; text-align: center; padding: 10px; font-size: 15px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.center { text-align: center; }
fieldset.plainset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.plainset[disabled] input, fieldset.plainset[disabled] select, fieldset.plainset[disabled] textarea { background: #f7f8fa; color: var(--ink); }
.danger { border-color: var(--bad); margin-top: 24px; }
.danger button { border-color: var(--bad); color: var(--bad); }
form.inline { display: inline; }
button.small { padding: 2px 8px; font-size: 12px; }
tr.warnrow td { background: var(--warn-bg); }
.narrow { max-width: 640px; }
.editform.narrow label { margin-bottom: 10px; }
pre.code { background: #f3f5f7; padding: 8px; border-radius: 4px; overflow: auto; font-size: 12px; }
select.auto, .bulk select { width: auto; }
label.req > span::after { content: " *"; color: var(--bad); }
.linkform { margin-top: 10px; align-items: center; }
.linkform span { font-size: 13px; }
code { background: #eef1f4; padding: 0 4px; border-radius: 3px; }

/* ---------- machine record (v2.1) ---------- */
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.95em; }
.m-card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px 20px; margin-bottom: 16px; min-width: 0; }
.m-cardhead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.m-cardhead h2 { margin: 0; font-size: 16px; }
.m-head { padding: 20px; }
.m-headrow { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: flex-start; justify-content: space-between; }
.m-title { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1 1 360px; }
.m-namerow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.m-namerow h1 { font-size: 26px; letter-spacing: -0.01em; }
.m-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 13px; }
.m-record { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.m-record a { overflow-wrap: anywhere; }
.btn-mini { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; font-size: 12px; min-height: 28px; }
.btn-mini .ico { width: 14px; height: 14px; }
.tagkey { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; color: #7b8592; background: #f1f3f6; padding: 0 5px; border-radius: 3px; font-weight: 400; }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: #eef1f4; color: #3d4a59; }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-bad { background: var(--bad-bg); color: var(--bad); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-info { background: var(--info-bg); color: var(--info); }
.chip-closed { background: #eef1f4; color: var(--muted); }
.m-score { display: flex; flex-direction: column; gap: 6px; min-width: 240px; flex: 0 1 300px; }
.m-score-top { display: flex; justify-content: space-between; font-size: 13px; gap: 12px; }
.m-score-top span { color: var(--muted); font-variant-numeric: tabular-nums; }
.m-bar { width: 100%; height: 8px; border-radius: 4px; overflow: hidden; display: block; }
.bar-bg { fill: #e7ebf0; } .bar-met { fill: #18794e; } .bar-fail { fill: #b42318; } .bar-warn { fill: #c98a00; }
.m-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.dot-fail { background: #b42318; } .dot-warn { background: #c98a00; } .dot-none { background: #a3acb8; }
.m-actions { display: flex; gap: 8px; align-items: center; }
.m-tiles { border-top: 1px solid #e7ebf0; margin-top: 16px; padding-top: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 20px; }
.m-tile { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.m-tile > div { display: flex; flex-direction: column; min-width: 0; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.m-tile > .ico { width: 34px; height: 34px; padding: 8px; border-radius: 8px; background: #eaf1fa; color: var(--accent); box-sizing: border-box; }
.lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #6b7684; }
.val { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.sub { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.m-disks { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.m-disklist { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 44px; }
.m-disk { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; flex: 0 1 220px; min-width: 180px; }
.m-disk-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.txt-bad { color: var(--bad); }
.banner { display: flex; gap: 10px; align-items: flex-start; border-radius: 6px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }
.banner.warn { background: var(--warn-bg); color: #6b4700; border: 1px solid #f0d58a; }
.banner .ico { margin-top: 1px; }
.m-grid { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.m-grid > .m-card, .m-grid > .m-side { margin-bottom: 0; }
.m-controls { flex: 999 1 560px; }
.m-side { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.m-side .m-card { margin-bottom: 0; }
table.ctl td { padding-top: 9px; padding-bottom: 9px; }
.ctl-name { font-weight: 500; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.pill i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.pill-met { background: var(--ok-bg); color: #136b44; } .pill-met i { background: #18794e; }
.pill-fail { background: var(--bad-bg); color: #a01f15; } .pill-fail i { background: #b42318; }
.pill-warn { background: #fff1cc; color: #6b4700; } .pill-warn i { background: #c98a00; }
.pill-none { background: #eef1f4; color: #4a5563; } .pill-none i { background: #8a93a0; }
.pill-excluded { background: #f3f5f7; color: #6b7480; } .pill-excluded i { background: #c3cad3; }
.ctl-none { color: #8a93a0; } .ctl-fail { color: #a01f15; } .ctl-warn { color: #6b4700; }
.m-patches { border-top: 1px solid #e7ebf0; margin-top: 12px; padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.m-patches h3 { margin: 0; font-size: 14px; }
.m-patchcols { display: flex; flex-wrap: wrap; gap: 12px; }
.m-patchcols label { flex: 1 1 260px; min-width: 0; font-weight: 600; font-size: 12px; }
.m-patchcols textarea { font-size: 12px; line-height: 1.5; resize: vertical; }
.patch-crit { color: #a01f15; } .patch-crit textarea { border-color: #f2c4bf; background: #fef6f5; color: var(--ink); }
.patch-info { color: #4a5563; } .patch-info textarea { background: #f7f9fb; color: var(--ink); }
.m-dl { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.m-dl > div { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.m-dl dt { color: var(--muted); font-size: 13px; }
.m-dl dd { margin: 0; text-align: right; font-weight: 500; font-size: 13px; min-width: 0; }
.m-edit .m-dl > div { flex-direction: column; align-items: stretch; gap: 3px; }
.m-edit .m-dl dd { text-align: left; }
.unset { color: #8a93a0; font-style: italic; font-weight: 400; }
.unset-req { color: #a01f15; font-style: italic; }
.m-sub { border-top: 1px solid #eef1f4; margin-top: 12px; padding-top: 10px; margin-bottom: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #6b7684; }
.m-notes { margin: 0 0 6px; font-size: 13px; white-space: pre-line; }
.m-life { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; flex-wrap: wrap; }
.m-editgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; border-top: 1px solid #e7ebf0; margin-top: 12px; padding-top: 12px; }
.m-editgrid.one { grid-template-columns: 1fr; border: 0; margin: 0; padding: 0; }
.m-savebar { position: sticky; bottom: 0; z-index: 4; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 16px 0; box-shadow: 0 -4px 12px rgba(24, 50, 79, 0.08); }
.m-savebar input.grow { flex: 1; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid #e7ebf0; margin: -6px -8px 12px; padding: 0 8px; }
.tab { border: 0; border-bottom: 2px solid transparent; background: none; padding: 10px; min-height: 44px; border-radius: 0; color: var(--muted); }
.tab.on { border-bottom-color: var(--accent); color: var(--ink); font-weight: 600; }
.tab:hover { border-color: transparent; border-bottom-color: #9fb6d3; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.keybox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--ok-bg); border: 1px solid #b7e1c9; padding: 12px; border-radius: 6px; }
.keybox code { font-size: 13px; overflow-wrap: anywhere; background: #fff; padding: 4px 8px; }
.api pre.code { white-space: pre-wrap; }

.lblrow { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
header.top nav { flex-wrap: wrap; }
@media (max-width: 700px) { header.top nav { flex: 1 1 100%; } .m-disklist { padding-left: 0; } }
