:root {
  color-scheme: light dark;
  --bg: #f3f4f8; --surface: #ffffff; --surface-2: #eceef5; --text: #171a26; --muted: #5d6479;
  --border: #d9dce8; --accent: #4b5dff; --accent-text: #ffffff; --ok: #1f9d55; --warn: #c77d00; --off: #8a90a6; --danger: #d03a3a;
  --radius: 14px; --gutter: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121522; --surface: #1b1f31; --surface-2: #252a40; --text: #eceef7; --muted: #9aa1ba;
    --border: #2d3350; --accent: #7a88ff; --accent-text: #0e1020; --ok: #3ddc84; --warn: #ffb74d; --off: #6c7390; --danger: #ff6b6b;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; padding-bottom: env(safe-area-inset-bottom); }
#app { max-width: 760px; margin: 0 auto; padding: 0 var(--gutter) 40px; }
.boot { text-align: center; color: var(--muted); margin-top: 30vh; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(12px + env(safe-area-inset-top)) 0 12px; }
.brand { font-weight: 700; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; font-size: 1.15rem; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; }
h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 0 0 12px; }
.auth { max-width: 380px; margin: 12vh auto 0; }
.auth h1 { font-size: 1.5rem; text-align: center; margin-bottom: 4px; }
.auth p.muted { text-align: center; margin: 0 0 18px; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; min-height: 46px;
}
input:focus-visible, button:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); padding: 10px 14px; min-height: 44px; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 600; }
button.danger { color: var(--danger); }
button.link { background: none; border: none; color: var(--accent); padding: 6px 8px; min-height: 36px; }
button:disabled { opacity: .55; cursor: default; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; } .grow { flex: 1; min-width: 0; }
.error { color: var(--danger); margin: 10px 0 0; min-height: 1.2em; }
.notice { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin-top: 10px; font-size: .92rem; }
.notice.warn { border-left: 4px solid var(--warn); }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 0 14px; padding-bottom: 2px; border-bottom: 1px solid var(--border); }
.tabs button { background: none; border: none; border-bottom: 3px solid transparent; border-radius: 0; color: var(--muted); padding: 10px 12px; white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
/* PC cards */
.pc { display: grid; grid-template-columns: 1fr; gap: 12px; }
.pc .head { display: flex; align-items: center; gap: 10px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--off); flex: none; }
.dot.online { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 25%, transparent); }
.dot.waking { background: var(--warn); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .dot.waking { animation: none; } }
.pc .name { font-size: 1.2rem; font-weight: 650; overflow-wrap: anywhere; }
.pc .sub { color: var(--muted); font-size: .9rem; }
.wake { width: 100%; min-height: 64px; font-size: 1.25rem; font-weight: 700; border-radius: 14px; }
.wake.done { background: color-mix(in srgb, var(--ok) 22%, var(--surface)); color: var(--text); border-color: var(--ok); }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
/* admin */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; font-size: .88rem; margin: 8px 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; margin: 0; font-size: .95rem; color: var(--text); min-height: 34px; }
.check input { width: 20px; height: 20px; flex: none; }
pre.cmd { background: #0d1020; color: #d7dcf5; padding: 12px; border-radius: 10px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; font: .85rem/1.5 ui-monospace, Menlo, Consolas, monospace; margin: 8px 0; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.tag { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.tag.ok { color: var(--ok); } .tag.bad { color: var(--danger); }
dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 18px; width: min(92vw, 380px); }
dialog::backdrop { background: rgba(0,0,0,.5); }
#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(120px); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; transition: transform .25s; max-width: 90vw; z-index: 10; }
#toast.show { transform: translateX(-50%) translateY(0); }
