:root {
  --bg: #0d1218;
  --bg2: #111821;
  --panel: #151d27;
  --panel2: #1a2430;
  --panel3: #202c3a;
  --line: #243142;
  --line2: #2e3e52;
  --text: #e4ebf2;
  --muted: #94a3b4;
  --dim: #66768a;
  --accent: #3fc1c9;
  --accent-2: #7fe0c8;
  --accent-ink: #062126;
  --gold: #f2c94c;
  --ok: #3ecf8e;
  --warn: #f0b429;
  --err: #f2545b;
  --info: #5aa9ff;
  --term: #0a0f14;
  --radius: 10px;
  --radius-s: 7px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --mono: "JetBrains Mono", "Cascadia Mono", "Consolas", "Menlo", ui-monospace, monospace;
  --sans: "Inter", "Segoe UI", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
svg:not([width]) { width: 16px; height: 16px; flex: none; }
svg.tiny { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(63, 193, 201, .35); }

/* ── 起動 ─────────────────────────── */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-mark { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 上の帯 ───────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  height: 56px; padding: 0 22px;
  background: rgba(13, 18, 24, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; color: var(--text); font-size: 16px; }
.brand:hover { text-decoration: none; }
.brand img { width: 26px; height: 26px; }
.brand small { color: var(--dim); font-weight: 500; font-size: 11px; }
.nav { display: flex; gap: 4px; margin-left: 10px; }
.nav a {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: var(--radius-s);
  color: var(--muted); font-weight: 500;
}
.nav a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--panel2); color: var(--text); }
.topbar .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.who .avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--panel3); color: var(--accent-2); font-weight: 700; font-size: 12px; }

main { max-width: 1320px; margin: 0 auto; padding: 26px 22px 60px; }

/* ── 見出し ───────────────────────── */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: .01em; }
.head p { margin: 4px 0 0; color: var(--muted); }
.head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 13px; margin: 0 0 8px; color: var(--muted); font-weight: 600; text-transform: none; }

/* ── ボタン ───────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--line2); border-radius: var(--radius-s);
  background: var(--panel2); color: var(--text);
  font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover:not(:disabled) { background: var(--panel3); border-color: #3a4d64; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: #5ad0d6; border-color: #5ad0d6; }
.btn.ok { background: rgba(62, 207, 142, .14); border-color: rgba(62, 207, 142, .45); color: #7ee8b5; }
.btn.ok:hover:not(:disabled) { background: rgba(62, 207, 142, .24); }
.btn.warn { background: rgba(240, 180, 41, .12); border-color: rgba(240, 180, 41, .45); color: #f6cd6a; }
.btn.warn:hover:not(:disabled) { background: rgba(240, 180, 41, .22); }
.btn.danger { background: rgba(242, 84, 91, .12); border-color: rgba(242, 84, 91, .45); color: #ff8d92; }
.btn.danger:hover:not(:disabled) { background: rgba(242, 84, 91, .22); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--panel2); color: var(--text); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 34px; padding: 0; }
.btn.sm.icon { width: 28px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.sm svg { width: 14px; height: 14px; }
.btn .spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .8s linear infinite; }

/* ── 入力 ─────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.field .hint { color: var(--dim); font-size: 12px; }
.field .hint.err { color: var(--err); }
.input, select.input, textarea.input {
  width: 100%; height: 36px; padding: 0 11px;
  background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--radius-s);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 90px; padding: 9px 11px; resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(63, 193, 201, .15); }
.input:disabled { opacity: .55; }
.input-unit { position: relative; }
.input-unit .input { padding-right: 52px; }
.input-unit span { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--dim); font-size: 12px; pointer-events: none; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; user-select: none; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.check b { display: block; font-weight: 600; }
.check small { color: var(--dim); display: block; font-size: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }

/* ── 板 ───────────────────────────── */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 16px; }
.split > .card + .card, .grid2 > .card + .card, .side > .card + .card { margin-top: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card .card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card .card-head h2 { margin: 0; }
.card .card-body { padding: 18px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.gold { color: var(--gold); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.empty { padding: 42px 18px; text-align: center; color: var(--dim); }
.empty svg { width: 34px; height: 34px; opacity: .6; margin-bottom: 8px; }
.note { padding: 11px 14px; border-radius: var(--radius-s); background: var(--panel2); border: 1px solid var(--line2); color: var(--muted); font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.note svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.note.warn { border-color: rgba(240, 180, 41, .4); background: rgba(240, 180, 41, .07); color: #f3d38a; }
.note.err { border-color: rgba(242, 84, 91, .4); background: rgba(242, 84, 91, .07); color: #ffadb0; }
.note.ok { border-color: rgba(62, 207, 142, .4); background: rgba(62, 207, 142, .07); color: #a7efcb; }
.note b { color: var(--text); }

/* ── 札 ───────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 650; background: var(--panel3); color: var(--muted); white-space: nowrap; }
.badge svg { width: 12px; height: 12px; }
.badge.mc { background: rgba(126, 211, 33, .12); color: #a6e264; }
.badge.bot { background: rgba(114, 137, 218, .16); color: #a9b8f5; }
.badge.admin { background: rgba(242, 201, 76, .14); color: var(--gold); }
.badge.ok { background: rgba(62, 207, 142, .14); color: #7ee8b5; }
.badge.err { background: rgba(242, 84, 91, .14); color: #ff8d92; }
.badge.warn { background: rgba(240, 180, 41, .14); color: #f6cd6a; }
.status { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.running { background: var(--ok); box-shadow: 0 0 0 3px rgba(62, 207, 142, .18); }
.dot.starting, .dot.stopping { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.dot.offline { background: #4d5b6d; }
.dot.crashed { background: var(--err); }
.dot.task { background: var(--info); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ── 一覧の札（ダッシュボード） ─────── */
.node-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { color: var(--dim); font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat .k svg { width: 14px; height: 14px; }
.stat .v { font-size: 20px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.stat .sub { color: var(--dim); font-size: 12px; margin-top: 2px; }
.servers { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.srv {
  display: block; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; transition: border-color .12s, transform .12s, background .12s;
}
.srv:hover { text-decoration: none; border-color: var(--line2); background: #17202b; transform: translateY(-1px); }
.srv .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.srv .name { font-weight: 650; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv .meta { display: flex; align-items: center; gap: 10px; margin: 8px 0 14px; color: var(--dim); font-size: 12.5px; flex-wrap: wrap; }
.srv .meta .mono { color: var(--muted); }
.bars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.bar .k { display: flex; justify-content: space-between; color: var(--dim); font-size: 11.5px; margin-bottom: 5px; }
.bar .k b { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.track { height: 5px; border-radius: 3px; background: var(--panel3); overflow: hidden; }
.track i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .4s; }
.track i.hot { background: var(--warn); }
.track i.full { background: var(--err); }

/* ── サーバーの画面 ───────────────── */
.server-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.server-head h1 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.server-head .meta { display: flex; gap: 14px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; align-items: center; }
.copy { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line); cursor: pointer; font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.copy svg { width: 13px; height: 13px; color: var(--dim); }
.copy:hover { border-color: var(--line2); }
.power { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a { display: flex; align-items: center; gap: 7px; padding: 10px 14px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a svg { width: 15px; height: 15px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }

.console-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; }
.term {
  background: var(--term); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden; height: calc(100vh - 290px); min-height: 380px;
}
.term .out { flex: 1; overflow-y: auto; padding: 12px 14px; font: 12.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; color: #d6dde5; }
.term .out .ln { min-height: 1.55em; }
.term .out .ln.k-reef { color: var(--accent-2); }
.term .out .ln.k-err { color: #ff9a9e; }
.term .out .ln.k-cmd { color: var(--gold); }
.term .out .ln.k-install { color: #9fb2c8; }
.term .in { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding: 8px 10px; background: #0d141b; }
.term .in span { color: var(--accent); font-family: var(--mono); font-weight: 700; }
.term .in input { flex: 1; height: 32px; background: transparent; border: 0; outline: none; font: 13px var(--mono); }
.term .in input:disabled { opacity: .5; }
.term .bar-top { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px 6px 14px; border-bottom: 1px solid var(--line); background: #0d141b; color: var(--dim); font-size: 12px; }
.term .scroll-note { position: relative; }
.side { display: flex; flex-direction: column; gap: 14px; }
.meter .k { display: flex; justify-content: space-between; align-items: baseline; color: var(--dim); font-size: 12px; font-weight: 600; }
.meter .v { font-size: 18px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.meter .v small { color: var(--muted); font-size: 12px; font-weight: 500; }
.meter canvas { width: 100%; height: 56px; display: block; margin-top: 8px; }

/* ANSI */
.a-b { font-weight: 700; } .a-d { opacity: .7; } .a-i { font-style: italic; } .a-u { text-decoration: underline; }
.f0 { color: #3b4452; } .f1 { color: #ff6b6b; } .f2 { color: #5fd38d; } .f3 { color: #f5c451; } .f4 { color: #5aa9ff; } .f5 { color: #d38df5; } .f6 { color: #4fd1d9; } .f7 { color: #d6dde5; }
.f8 { color: #66768a; } .f9 { color: #ff8f8f; } .f10 { color: #8ff0b0; } .f11 { color: #ffe08a; } .f12 { color: #8cc4ff; } .f13 { color: #e7b3ff; } .f14 { color: #8deff2; } .f15 { color: #ffffff; }

/* ── 表 ───────────────────────────── */
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; color: var(--dim); font-size: 12px; font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.clickable { cursor: pointer; }
.tbl tbody tr:hover td { background: rgba(255, 255, 255, .018); }
.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.tbl td.act { text-align: right; white-space: nowrap; }
.tbl td.act .btn + .btn { margin-left: 4px; }
.tbl .fname { display: flex; align-items: center; gap: 10px; }
.tbl .fname svg { width: 17px; height: 17px; color: var(--dim); flex: none; }
.tbl .fname svg.dir { color: var(--accent); }
.tbl input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }

/* ── ファイル ─────────────────────── */
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-family: var(--mono); font-size: 13px; }
.crumbs a { color: var(--muted); padding: 2px 6px; border-radius: 5px; }
.crumbs a:hover { background: var(--panel2); color: var(--text); text-decoration: none; }
.crumbs span { color: var(--dim); }
.drop { position: relative; }
.drop.over::after { content: attr(data-drop); position: absolute; inset: 0; display: grid; place-items: center; background: rgba(63, 193, 201, .12); border: 2px dashed var(--accent); border-radius: var(--radius); color: var(--accent-2); font-weight: 650; font-size: 15px; z-index: 5; }
.editor { display: flex; border: 1px solid var(--line2); border-radius: var(--radius-s); background: var(--term); overflow: hidden; }
.editor .gutter { padding: 10px 8px 10px 12px; text-align: right; color: #3f4d5e; font: 13px/1.55 var(--mono); user-select: none; white-space: pre; overflow: hidden; min-width: 44px; background: #0b1117; }
.editor textarea { flex: 1; min-height: 480px; height: calc(100vh - 330px); border: 0; outline: none; resize: none; background: transparent; padding: 10px 12px; font: 13px/1.55 var(--mono); color: #dbe3ea; white-space: pre; overflow: auto; tab-size: 4; }
.editor.short textarea { min-height: 260px; height: 320px; }
.editor.err { border-color: rgba(242, 84, 91, .6); }
.progress { height: 4px; background: var(--panel3); border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* ── 鍵の表（config.toml） ───────── */
.kv { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
.kv > div { padding: 8px 14px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv .key { color: var(--muted); }
.kv .val.secret { color: var(--gold); }
.kv .val.empty { color: var(--err); font-family: var(--sans); }

/* ── 作る画面 ─────────────────────── */
.modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mode { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line2); background: var(--bg2); cursor: pointer; text-align: left; transition: border-color .12s, background .12s; }
.mode:hover { border-color: #3a4d64; }
.mode.on { border-color: var(--accent); background: rgba(63, 193, 201, .07); box-shadow: 0 0 0 3px rgba(63, 193, 201, .1); }
.mode .ic { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.mode .ic svg { width: 22px; height: 22px; }
.mode .ic.mc { background: rgba(126, 211, 33, .14); color: #a6e264; }
.mode .ic.bot { background: rgba(114, 137, 218, .18); color: #a9b8f5; }
.mode b { display: block; font-size: 15px; }
.mode small { color: var(--dim); display: block; margin-top: 2px; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.presets button { height: 24px; padding: 0 9px; border-radius: 6px; border: 1px solid var(--line2); background: var(--panel2); color: var(--muted); cursor: pointer; font-size: 12px; }
.presets button:hover { color: var(--text); border-color: #3a4d64; }
.presets button.on { border-color: var(--accent); color: var(--accent-2); }
.summary-line { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.summary-line b { color: var(--text); }

/* ── 小窓 ─────────────────────────── */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(4, 8, 12, .62); display: grid; place-items: center; padding: 20px; animation: fade .12s ease-out; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; box-shadow: var(--shadow); animation: rise .16s ease-out; }
.modal.wide { width: min(780px, 100%); }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal header h2 { margin: 0; font-size: 16px; }
.modal .body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--bg2); border-radius: 0 0 14px 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.985); } }

/* ── 知らせ ───────────────────────── */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line2); box-shadow: var(--shadow); animation: rise .16s ease-out; font-size: 13.5px; }
.toast svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.toast.ok svg { color: var(--ok); }
.toast.err { border-color: rgba(242, 84, 91, .5); }
.toast.err svg { color: var(--err); }
.toast.warn svg { color: var(--warn); }
.toast.hide { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }

/* ── ログイン ─────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(1200px 500px at 10% -10%, rgba(63, 193, 201, .13), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, rgba(127, 224, 200, .08), transparent 60%), var(--bg); }
.login .box { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; padding: 30px 28px; box-shadow: var(--shadow); }
.login .brand { justify-content: center; font-size: 22px; margin-bottom: 6px; }
.login .brand img { width: 36px; height: 36px; }
.login p.lead { text-align: center; color: var(--muted); margin: 0 0 24px; font-size: 13px; }
.login form { display: flex; flex-direction: column; gap: 14px; }
.login .btn { height: 40px; }
.login .foot { text-align: center; color: var(--dim); font-size: 12px; margin-top: 18px; }

/* ── 小物 ─────────────────────────── */
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.code-big { font: 700 30px/1 var(--mono); letter-spacing: .18em; color: var(--gold); padding: 16px; text-align: center; background: var(--bg2); border: 1px dashed var(--line2); border-radius: var(--radius); }
.kbd { font-family: var(--mono); font-size: 12px; padding: 1px 6px; border-radius: 5px; background: var(--panel3); border: 1px solid var(--line2); color: var(--muted); }
.pill-tabs { display: inline-flex; padding: 3px; gap: 3px; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; }
.pill-tabs button { height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 550; }
.pill-tabs button.on { background: var(--panel3); color: var(--text); }
.danger-zone { border-color: rgba(242, 84, 91, .35); }
.danger-zone h2 { color: #ff9a9e; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.hr { height: 1px; background: var(--line); margin: 4px 0; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.act-item { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--line); align-items: baseline; }
.act-item:last-child { border-bottom: 0; }
.act-item .when { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.act-item .what b { font-weight: 600; }
.act-item .what .detail { color: var(--dim); font-size: 12.5px; font-family: var(--mono); word-break: break-all; }
.act-item .src { color: var(--dim); font-size: 12px; white-space: nowrap; }

/* ── 幅の決まった入力（スマホでは広げる） ── */
.w-search { width: 240px; }
.w-sm { width: 160px; }
.w-md { width: 240px; }
.w-narrow { max-width: 260px; }
.node-strip.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.status, .tbl td.num { white-space: nowrap; }
.tabs.more-right { -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); }
.tabs.more-left { -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%); mask-image: linear-gradient(90deg, transparent, #000 18%); }
.tabs.more-left.more-right { -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); }

@media (max-width: 1000px) {
  .console-wrap { grid-template-columns: 1fr; }
  .side { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .node-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  /* 上の帯 */
  .topbar { padding: 0 12px; padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); gap: 8px; }
  .nav { margin-left: 0; }
  .nav a { padding: 8px 10px; }
  .nav a span { display: none; }
  .who { gap: 6px; }
  .who .name, .who .badge, .brand small { display: none; }
  main { padding: 16px 14px calc(48px + env(safe-area-inset-bottom)); }

  /* iPhone は 16px より小さい入力に触れると勝手に拡大するので、入力の字は 16px */
  .input, select.input, textarea.input, .term .in input, .editor textarea { font-size: 16px; }
  .input { height: 42px; }
  .btn { height: 40px; }
  .btn.sm { height: 34px; }
  .btn.sm.icon, .btn.icon { width: 38px; }

  /* 見出し */
  .head { margin-bottom: 16px; }
  .head h1 { font-size: 20px; }
  .head .actions { width: 100%; flex-wrap: nowrap; }
  .head .actions .w-search { flex: 1; width: auto; min-width: 0; }
  .head .actions .btn span { white-space: nowrap; }

  /* サーバーの画面の頭: 電源の札は 4 つを 1 段に */
  .server-head { gap: 12px; margin-bottom: 14px; }
  .server-head > div:first-child { width: 100%; }
  .server-head h1 { font-size: 20px; }
  .power { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; width: 100%; }
  .power .btn { padding: 0 4px; gap: 4px; font-size: 13px; }

  /* タブ: 横に流し、端をぼかして続きがあると分かるように */
  .tabs { margin-left: -14px; margin-right: -14px; padding: 0 10px; margin-bottom: 14px; }
  .tabs a { padding: 11px 10px; font-size: 13.5px; }

  /* 板と並び */
  .card { padding: 14px; }
  .card .card-head { padding: 12px 14px; }
  .card .card-body { padding: 14px; }
  .card .card-head > .row { width: 100%; }
  .card .card-head > .row .btn span { display: none; }
  .card .card-head > .row .btn { padding: 0 12px; }
  .card > .row:not(.between) > .input, .card > .row:not(.between) > .w-sm, .card > .row:not(.between) > .w-md { flex: 1 1 100%; width: 100%; }
  .card > .row:not(.between) > .btn { flex: 1 1 auto; }
  .row.between > h2 { flex: 1; min-width: 0; }
  .crumbs { width: 100%; }
  .grid2, .grid3, .grid4, .perm-grid { grid-template-columns: 1fr; }
  .node-strip { gap: 10px; }
  .node-strip.three { grid-template-columns: 1fr; }
  .stat { padding: 12px 14px; }
  .stat .v { font-size: 18px; }
  .w-narrow { max-width: none; }
  .w-md, .w-sm { width: 100%; }
  .field .row { flex-wrap: wrap; }
  .field .row > .input { flex: 1 1 100%; }
  .list-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .list-row > .btn, .list-row > select { width: 100%; }
  .row.between { gap: 10px; }

  /* 作る画面のモード: 2 つを横に・小さく */
  .modes { grid-template-columns: 1fr 1fr; gap: 8px; }
  .mode { flex-direction: column; gap: 8px; padding: 12px; }
  .mode .ic { width: 36px; height: 36px; }
  .mode b { font-size: 14px; }
  .mode small { font-size: 11.5px; }

  /* 一覧 */
  .servers { grid-template-columns: 1fr; gap: 10px; }
  .srv { padding: 14px; }
  .bars { gap: 10px; }
  .act-item { grid-template-columns: 1fr; gap: 2px; padding: 10px 14px; }
  .tbl .hide-sm { display: none; }
  .tbl th, .tbl td { padding: 10px 12px; }
  .tbl .fname { min-width: 0; }
  .tbl .fname b, .tbl .fname a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; display: inline-block; vertical-align: middle; }

  /* コンソール: 使用量を上に小さく 3 つ・コンソールは画面の残り */
  .console-wrap { gap: 10px; }
  .side { order: -1; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .side .card { padding: 10px 10px 8px; }
  .meter .k { font-size: 11px; }
  .meter .k .lim { display: none; }
  .meter .v { font-size: 14px; }
  .meter .v small { display: none; }
  .meter canvas { height: 26px; margin-top: 4px; }
  .term { height: calc(100dvh - 330px); min-height: 300px; }
  .term .out { padding: 10px; font-size: 12px; }
  .term .bar-top { padding: 6px 10px; }

  /* 直す欄 */
  .editor textarea { min-height: 320px; height: 60vh; }
  .editor.short textarea { min-height: 240px; height: 45vh; }
  .editor .gutter { min-width: 34px; padding-left: 6px; }

  /* 小窓は画面いっぱいに・下の札はいつも見える */
  .modal-back { padding: 0; place-items: stretch; }
  .modal, .modal.wide { width: 100%; max-height: none; height: 100%; height: 100dvh; border-radius: 0; border: 0; display: flex; flex-direction: column; overflow: hidden; }
  .modal header { padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top)); }
  .modal .body { flex: 1; overflow-y: auto; padding: 14px; -webkit-overflow-scrolling: touch; }
  .modal footer { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-radius: 0; }
  .modal footer .btn { flex: 1; }

  /* 知らせは下いっぱいに */
  #toasts { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: none; }
  .login .box { padding: 24px 18px; }
}
@media (max-width: 400px) {
  .power .btn svg { display: none; }
  .power .btn { font-size: 12.5px; }
  .tabs a svg { display: none; }
}

/* v1.3.0: ダッシュボード・連携の帯・SFTP・ログインの 2 段目 */
canvas.chart { width: 100%; height: 160px; display: block; margin-top: 12px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--dim); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sec-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.sec-list > div { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sec-list .badge { height: 19px; font-size: 11px; }
.srv.locked { cursor: default; opacity: .82; }
.srv.locked:hover { transform: none; background: var(--panel); border-color: var(--line); }
.link-banner { margin-bottom: 18px; align-items: center; }
.link-banner b { display: block; margin-bottom: 2px; }
.link-banner .btn { flex: none; }
.copy.big { font-size: 16px; padding: 10px 14px; justify-content: space-between; width: 100%; letter-spacing: .04em; color: var(--gold); }
.copy.wrap { white-space: normal; word-break: break-all; text-align: left; width: 100%; justify-content: space-between; line-height: 1.5; padding: 8px 10px; }
.copy.wrap svg { flex: none; }
.code-input { font: 700 24px/1 var(--mono); letter-spacing: .4em; text-align: center; height: 52px; }
.sftp-ep { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.sftp-ep > div:nth-last-child(-n+2) { border-bottom: 0; }
.tbl td.ua { white-space: nowrap; }
.list-row.clickable { cursor: pointer; }
.list-row.clickable:hover b { color: var(--accent-2); }
@media (max-width: 720px) {
  canvas.chart { height: 130px; }
  .link-banner { flex-wrap: wrap; }
  .link-banner .btn { width: 100%; justify-content: center; }
  .copy.big { font-size: 15px; }
  .sftp-ep { grid-template-columns: 1fr; }
  .sftp-ep > .key { border-bottom: 0; padding-bottom: 0; }
}
.hint.wait { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.hint.wait .spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--accent); border-top-color: transparent; animation: spin .8s linear infinite; }
@media (max-width: 720px) {
  /* 狭い幅では行を折り返す（右端の札が札の枠で切れて押せなくならないように） */
  .tbl.stack-sm thead { display: none; }
  .tbl.stack-sm tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 11px 12px; border-bottom: 1px solid var(--line); }
  .tbl.stack-sm tr:last-child { border-bottom: 0; }
  .tbl.stack-sm td { display: block; padding: 0; border: 0; min-width: 0; }
  .tbl.stack-sm td:first-child { flex: 1 1 100%; }
  .tbl.stack-sm td.num { text-align: left; }
  .tbl.stack-sm td.act { margin-left: auto; }
  .tbl.stack-sm td.hide-sm { display: none; }
  .tbl.stack-sm tbody tr:hover td { background: none; }
}
