:root {
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --mono: "Cascadia Mono", "Consolas", ui-monospace, monospace;
  --bg: #ffffff;
  --fg: #1d2433;
  --muted: #5f6b7d;
  --faint: #8c96a6;
  --accent: #4f5fe6;
  --accent-2: #7c4ddb;
  --glass: #ffffff;
  --glass-strong: #f6f7f9;
  --glass-border: #e4e7ec;
  --card: #ffffff;
  --card-border: #e4e7ec;
  --field: #ffffff;
  --field-border: #d9dde3;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  --danger: #e5484d;
  --ok: #22a06b;
  --warn: #e8913a;
  --blob-1: #9fc4a6;
  --blob-2: #b9d3ea;
  --blob-3: #e9e4d4;
  --blob-4: #7fa7c9;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #111418;
  --fg: #e6e9ef;
  --muted: #9aa4b5;
  --faint: #6b7588;
  --accent: #8190ff;
  --accent-2: #a78bfa;
  --glass: #181c22;
  --glass-strong: #1f242b;
  --glass-border: #2a3039;
  --card: #1f242b;
  --card-border: #2a3039;
  --field: #14181d;
  --field-border: #323944;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.25);
  --blob-1: #1d3b2c;
  --blob-2: #1c2f4a;
  --blob-3: #2c2a3e;
  --blob-4: #16324a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; color: var(--fg); background: var(--bg); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.backdrop { display: none; position: fixed; inset: -12%; z-index: -1; filter: blur(60px); background:
  radial-gradient(40% 45% at 15% 20%, var(--blob-2), transparent 70%),
  radial-gradient(35% 40% at 80% 15%, var(--blob-4), transparent 70%),
  radial-gradient(45% 45% at 70% 80%, var(--blob-1), transparent 70%),
  radial-gradient(40% 40% at 20% 85%, var(--blob-3), transparent 70%), var(--bg); }
.glass { background: var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--shadow); }
.ico { display: inline-grid; place-items: center; width: 16px; height: 16px; flex: none; }
.ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.app { height: 100vh; display: grid; grid-template-rows: auto 1fr; gap: 12px; padding: 12px; }

/* header */
.top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 18px; min-width: 0; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: 0.06em; font-size: 16px; padding-right: 6px; }
.logo .ico { width: 24px; height: 24px; }
.views { display: flex; gap: 4px; }
.view-btn { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px; border: 0; background: transparent; white-space: nowrap; }
.view-btn[aria-selected="true"] { background: var(--glass-strong); color: var(--accent); font-weight: 600; box-shadow: var(--shadow); }
.pill { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-size: 16px; text-align: center; }
.search { flex: 1; min-width: 160px; display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 36px; border-radius: 12px; background: var(--field); border: 1px solid var(--field-border); color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--fg); }
kbd { font-family: var(--font); font-size: 16px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--field-border); color: var(--faint); white-space: nowrap; }
.tools { display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--field-border); background: var(--field); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--field-border); background: var(--field); white-space: nowrap; }
.btn:hover, .icon-btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.btn.primary { border: 0; color: #fff; background: linear-gradient(90deg, var(--accent-2), var(--accent)); font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.small { height: 28px; padding: 0 10px; font-size: 16px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.paused { color: var(--warn); }
.switch { display: flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 32px; height: 18px; border-radius: 999px; background: var(--faint); position: relative; transition: background 0.15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.mode { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 10px; font-size: 16px; line-height: 1.3; white-space: nowrap; }
.mode::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.mode.server { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.mode.offline { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.mode.demo { color: #d6336c; background: color-mix(in srgb, #d6336c 12%, transparent); }

/* main */
main { display: grid; grid-template-columns: 220px 360px minmax(0, 1fr); gap: 12px; min-height: 0; }
main.no-detail { grid-template-columns: 220px minmax(0, 1fr); }
main.no-detail #detail { display: none; }
main:has(#rail[hidden]) { grid-template-columns: 360px minmax(0, 1fr); }
main.no-detail:has(#rail[hidden]) { grid-template-columns: minmax(0, 1fr); }
#view { overflow: auto; display: flex; flex-direction: column; gap: 12px; padding-bottom: 12px; min-height: 0; min-width: 0; }

.lane { border-radius: 18px; padding: 8px 12px 12px; --lane: var(--accent); background: var(--glass-strong); }
.lane-head { display: flex; align-items: center; gap: 8px; padding: 5px 8px; margin: 0 -4px 8px; border-radius: 12px; background: linear-gradient(90deg, color-mix(in srgb, var(--lane) 18%, transparent), transparent 55%); }
.lane-bar { width: 5px; height: 18px; border-radius: 3px; background: var(--lane); }
.lane-title { font-weight: 700; font-size: 16px; }
.lane-add { width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--muted); }
.lane-add:hover { background: var(--glass-strong); color: var(--fg); }
.lane-count { margin-left: auto; padding: 2px 10px; border-radius: 999px; background: var(--glass-strong); color: var(--muted); font-size: 16px; font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; min-height: 48px; border-radius: 12px; }
@media (min-width: 1500px) { .cards { grid-template-columns: repeat(auto-fill, minmax(210px, 240px)); } }
.cards.drop-end::after { content: ""; min-height: 64px; border: 2px dashed var(--accent); border-radius: 12px; }
.empty-lane { grid-column: 1 / -1; display: grid; place-items: center; min-height: 48px; color: var(--faint); font-size: 16px; border: 1px dashed var(--field-border); border-radius: 12px; }

.card { position: relative; display: flex; gap: 10px; align-items: flex-start; min-height: 76px; padding: 10px 36px 10px 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--card-border); box-shadow: var(--shadow); cursor: pointer; transition: transform 0.12s, box-shadow 0.12s; }
.card:hover { transform: translateY(-1px); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.card.dragging { opacity: 0.4; }
.card.drop-before { box-shadow: -4px 0 0 0 var(--accent), var(--shadow); }
.card-main { min-width: 0; flex: 1; }
.card-title { font-size: 16px; line-height: 1.5; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.card-num { position: absolute; top: 6px; right: 7px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; background: color-mix(in srgb, var(--fg) 7%, transparent); color: var(--muted); font-size: 16px; line-height: 22px; text-align: center; }
.card-assignee { position: absolute; bottom: 7px; right: 7px; color: var(--muted); }
.card-flags { position: absolute; right: 8px; top: 28px; display: flex; flex-direction: column; gap: 3px; align-items: center; }
.card-flags .bm { color: var(--warn); }
.card-flags .bm svg { fill: currentColor; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 0 var(--accent-2); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } .card { transition: none; } }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 16px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.muted { background: color-mix(in srgb, var(--fg) 7%, transparent); color: var(--muted); }
.chip button { border: 0; background: none; padding: 0; color: inherit; line-height: 1; }

.kind { --kc: #5b6cf0; flex: none; width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; color: var(--kc); background: color-mix(in srgb, var(--kc) 14%, var(--card)); }
.kind .ico { width: 20px; height: 20px; }
.kind.big { width: 64px; height: 76px; border-radius: 12px; }
.kind.big .ico { width: 30px; height: 30px; }
.k-doc { --kc: #5b6cf0; } .k-code { --kc: #3b82f6; } .k-chart { --kc: #4f63e6; } .k-download { --kc: #c9822e; }
.k-audio { --kc: #8b5cf6; } .k-screen { --kc: #2563eb; } .k-graph { --kc: #7c3aed; } .k-gauge { --kc: #b7791f; }
.k-search { --kc: #9333ea; } .k-warning { --kc: #e5484d; } .k-calendar { --kc: #0891b2; } .k-idea { --kc: #d69e2e; }

/* detail */
#detail { border-radius: 20px; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.d-scroll { flex: 1; overflow: auto; padding: 16px 16px 8px; min-height: 0; }
.d-head { display: flex; gap: 12px; align-items: flex-start; }
.d-title-wrap { flex: 1; min-width: 0; }
.d-title { margin: 2px 0 4px; font-size: 16px; line-height: 1.5; font-weight: 700; overflow-wrap: anywhere; cursor: text; border-radius: 6px; }
.d-title:hover { background: color-mix(in srgb, var(--fg) 5%, transparent); }
.d-title-input { width: 100%; resize: none; font-size: 16px; font-weight: 700; line-height: 1.5; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--accent); background: var(--field); outline: 0; }
.d-sub { color: var(--faint); font-size: 16px; }
.d-actions { display: flex; flex-direction: column; gap: 2px; }
.mini { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.mini:hover { background: color-mix(in srgb, var(--fg) 7%, transparent); color: var(--fg); }
.mini.on { color: var(--warn); }
.mini.on svg { fill: currentColor; }
.mini.danger:hover { color: var(--danger); }
.fields { display: grid; grid-template-columns: 96px 1fr; gap: 8px 10px; align-items: center; margin: 16px 0; }
.f-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 16px; }
.input, .select, .textarea { width: 100%; min-height: 30px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--field-border); background: var(--field); outline: 0; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.textarea { resize: vertical; line-height: 1.6; }
.status-select { display: flex; align-items: center; gap: 6px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tag-editor { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 30px; }
.tag-editor input { flex: 1; min-width: 80px; border: 0; background: transparent; outline: 0; padding: 4px 2px; }
.muted { color: var(--muted); }

.tabs-box { border-radius: 14px; background: var(--glass-strong); border: 1px solid var(--glass-border); overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--field-border); }
.tab { flex: 1; padding: 9px 4px; border: 0; background: transparent; color: var(--muted); font-size: 16px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.composer { border-radius: 10px; border: 1px solid var(--field-border); background: var(--field); padding: 8px; }
.composer textarea { width: 100%; border: 0; outline: 0; resize: vertical; min-height: 54px; background: transparent; line-height: 1.6; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.counter { font-size: 16px; color: var(--faint); }
.counter.over { color: var(--danger); }
.note { padding: 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--card-border); }
.note-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.note-author { font-weight: 700; font-size: 16px; }
.note-time { color: var(--faint); font-size: 16px; }
.note-head .spacer { flex: 1; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; }
.avatar { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.avatar.user { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.avatar .ico { width: 13px; height: 13px; }
.row { display: flex; gap: 6px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.file { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--card-border); }
.file-path { font-family: var(--mono); font-size: 16px; overflow-wrap: anywhere; }
.html-frame { width: 100%; height: 280px; border: 1px solid var(--field-border); border-radius: 10px; background: #fff; }
.hist { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--field-border); }
.hist:last-child { border-bottom: 0; }
.hist-detail { color: var(--muted); overflow-wrap: anywhere; }
.req { padding: 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--card-border); display: flex; flex-direction: column; gap: 6px; }
.req-status { font-size: 16px; padding: 1px 8px; border-radius: 999px; }
.req-status.open { background: color-mix(in srgb, var(--accent-2) 14%, transparent); color: var(--accent-2); }
.req-status.claimed { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.req-status.done { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.req-status.cancelled { background: color-mix(in srgb, var(--fg) 8%, transparent); color: var(--muted); }
.empty { color: var(--faint); text-align: center; padding: 16px 0; }
.d-foot { display: grid; grid-template-columns: 1fr 1.3fr; gap: 8px; padding: 10px 16px 16px; }
.d-foot .btn { height: 40px; }
.placeholder { flex: 1; display: grid; place-content: center; gap: 12px; text-align: center; color: var(--muted); padding: 24px; }


/* machine rail */
#rail { border-radius: 20px; padding: 10px; overflow: auto; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.rail-title { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px 8px; font-weight: 700; font-size: 16px; color: var(--muted); letter-spacing: 0.04em; }
.rail-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 12px; background: transparent; text-align: left; }
.rail-item:hover { background: color-mix(in srgb, var(--fg) 5%, transparent); }
.rail-item.active { background: var(--glass-strong); box-shadow: var(--shadow); }
.rail-icon { position: relative; flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--accent); }
.rail-icon .state-dot { position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border: 2px solid var(--card); }
.rail-text { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.rail-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-sub { font-size: 16px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* machine state */
.st-waiting { --st: var(--warn); }
.st-running { --st: var(--accent); }
.st-idle { --st: var(--ok); }
.st-paused { --st: #d6336c; }
.st-offline, .st-ended { --st: var(--faint); }
.state-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--st, var(--faint)); flex: none; }
.st-waiting .state-dot { animation: pulse-warn 1.6s infinite; box-shadow: 0 0 0 0 var(--warn); }
@keyframes pulse-warn { 70% { box-shadow: 0 0 0 5px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .st-waiting .state-dot { animation: none; } }
.state-chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; font-size: 16px; font-weight: 600; color: var(--st); background: color-mix(in srgb, var(--st) 13%, transparent); white-space: nowrap; }
.pill.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }

/* dashboard */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 16px; text-align: left; }
button.kpi:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.kpi-label { font-size: 16px; color: var(--muted); }
.kpi-value { font-size: 26px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 16px; color: var(--faint); }
.kpi.warn .kpi-value { color: var(--warn); }
.dash-section h2, .pane-col h2 { margin: 0 0 10px; font-size: 16px; }
.section-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin: 4px 2px 10px; }
.section-head h2 { margin: 0; }
.pad { padding: 14px; border-radius: 18px; }
.machine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.machine { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 16px; cursor: pointer; border-left: 4px solid var(--st); }
.machine:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.machine-head { display: flex; align-items: center; gap: 8px; }
.machine-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--accent); flex: none; }
.machine-icon.big { width: 44px; height: 44px; border-radius: 12px; }
.machine-icon.big .ico { width: 22px; height: 22px; }
.machine-name { font-weight: 700; font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.machine-sub { font-size: 16px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.machine-status { font-size: 16px; }
.machine-work { display: flex; gap: 6px; align-items: center; font-size: 16px; color: var(--accent); min-width: 0; }
.machine-work span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.machine-foot { display: flex; gap: 6px; align-items: center; margin-top: auto; padding-top: 4px; font-size: 16px; color: var(--muted); }
.machine-foot > span:first-child { flex: 1; }
.session { display: grid; grid-template-columns: 10px auto minmax(0, 1fr) auto; gap: 6px; align-items: center; font-size: 16px; padding: 5px 6px; margin: 0 -6px; width: calc(100% + 12px); border: 0; border-radius: 8px; background: transparent; text-align: left; }
button.session:hover { background: color-mix(in srgb, var(--fg) 6%, transparent); }
.session-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.session-state { font-weight: 600; color: var(--st); }
.session-cwd { font-family: var(--mono); font-size: 16px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-time { font-size: 16px; color: var(--faint); }
.session-msg { grid-column: 2 / -1; font-size: 16px; color: var(--warn); }
.dash-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.mini-list { display: flex; flex-direction: column; gap: 6px; }
.mini-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; border: 1px solid var(--card-border); background: var(--card); text-align: left; }
.mini-card:hover { border-color: var(--accent); }
.mini-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kind.small { width: 28px; height: 28px; border-radius: 8px; }
.kind.small .ico { width: 15px; height: 15px; }
.activity { display: flex; flex-direction: column; max-height: 520px; overflow: auto; }
.link { border: 0; background: none; padding: 0; color: var(--accent); text-align: left; font-weight: 600; }
.link:hover { text-decoration: underline; }
.small { font-size: 16px; }
.card-machine { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 16px; color: var(--muted); min-width: 0; }
.card-machine .ico { width: 12px; height: 12px; }
.card-machine.working { color: var(--accent); font-weight: 600; }

/* machine pane */
.machine-pane { display: flex; flex-direction: column; gap: 12px; }
.pane-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; flex-wrap: wrap; }
.pane-title { flex: 1; min-width: 200px; }
.pane-title h1 { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pane-actions { display: flex; gap: 8px; align-items: center; }
.pane-grid { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 12px; align-items: start; }
.pane-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.info-value { overflow-wrap: anywhere; }
.pane-col .req { margin-bottom: 8px; }

/* login */
body.login-mode .app { display: none; }
#login { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; z-index: 40; overflow: auto; }
.login-box { width: min(400px, 100%); border-radius: 22px; padding: 28px 28px 24px; display: flex; flex-direction: column; gap: 18px; background: var(--card); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 12px 32px rgba(15, 23, 42, 0.08); }
.login-box .logo { justify-content: center; font-size: 16px; }
.login-steps { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; }
.login-steps li { flex: 1; display: flex; align-items: center; gap: 8px; padding-top: 8px; border-top: 3px solid var(--field-border); font-size: 16px; color: var(--faint); }
.login-steps li span { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; font-weight: 700; background: var(--field-border); color: var(--muted); }
.login-steps li.on { border-color: var(--accent); color: var(--fg); font-weight: 600; }
.login-steps li.on span { background: var(--accent); color: #fff; }
.login-steps li.done { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--muted); }
.login-step { display: flex; flex-direction: column; gap: 14px; }
.login-step h1 { margin: 0; font-size: 20px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-label { font-size: 16px; font-weight: 600; color: var(--muted); }
.login-input { position: relative; display: block; }
.login-input .input { height: 42px; padding: 0 12px; font-size: 16px; border-radius: 10px; }
.login-input .eye { position: absolute; right: 6px; top: 7px; }
.login-input .eye + .input, .login-input .input[name="password"] { padding-right: 42px; }
.login-lead { margin: 0; color: var(--muted); line-height: 1.7; }
.login-who { display: flex; align-items: center; gap: 6px; margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--field); border: 1px solid var(--field-border); }
.login-who strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.input.otp { height: 58px; text-align: center; font-family: var(--mono); font-size: 30px; letter-spacing: 0.4em; padding: 0 0 0 0.4em; border-radius: 12px; }
.input.otp::placeholder { color: color-mix(in srgb, var(--faint) 50%, transparent); }
.period-row { display: flex; align-items: center; gap: 8px; margin: -4px 0 0; font-size: 16px; color: var(--muted); }
.period { width: 18px; height: 18px; flex: none; }
.period svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.period circle { fill: none; stroke-width: 4; }
.period-bg { stroke: var(--field-border); }
.period-fg { stroke: var(--accent); stroke-dasharray: 30; stroke-dashoffset: calc(30 - var(--left, 30)); transition: stroke-dashoffset 0.3s linear; }
.login-error { margin: 0; min-height: 1.2em; color: var(--danger); font-size: 16px; line-height: 1.6; }
.login-error:empty { display: none; }
.login-submit { height: 44px; font-size: 16px; }
.login-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; }
.login-actions .btn { height: 44px; }
.login-first { align-self: flex-start; font-weight: 500; font-size: 16px; }
.login-box.enroll { width: min(440px, 100%); }
.enroll-steps { margin: 0; padding-left: 1.4em; color: var(--muted); line-height: 1.7; display: flex; flex-direction: column; gap: 4px; }
.qr { align-self: center; width: min(240px, 70vw); padding: 0; border-radius: 12px; border: 1px solid var(--card-border); overflow: hidden; background: #fff; }
.qr svg { display: block; width: 100%; height: auto; }
.setup-key-box { border: 1px solid var(--field-border); border-radius: 10px; padding: 10px 12px; }
.setup-key-box summary { cursor: pointer; font-size: 16px; color: var(--accent); font-weight: 600; }
.setup-key-box[open] { display: flex; flex-direction: column; gap: 8px; }
.setup-key { font-family: var(--mono); font-size: 16px; letter-spacing: 0.04em; padding: 8px 10px; border-radius: 8px; background: var(--glass-strong); overflow-wrap: anywhere; user-select: all; }
.login-lock { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.login-lock .ico { width: 28px; height: 28px; }


/* add machine */
.rail-add { margin-top: 6px; border-top: 1px dashed var(--field-border); border-radius: 0 0 12px 12px; padding-top: 10px; }
.rail-add .rail-icon { background: transparent; border: 1px dashed var(--field-border); color: var(--muted); }
.dlg.install { width: 100%; }
.install-code { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--glass-strong); }
.install-code code { font-family: var(--mono); font-size: 18px; letter-spacing: 0.08em; user-select: all; overflow-wrap: anywhere; }
.cmd { border: 1px solid var(--field-border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.cmd-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cmd-text { margin: 0; font-family: var(--mono); font-size: 16px; white-space: pre-wrap; word-break: break-all; background: var(--glass-strong); padding: 8px 10px; border-radius: 8px; user-select: all; }

.pairing-section { border: 2px solid color-mix(in srgb, var(--warn) 55%, transparent); }
.pairing { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; padding: 12px 0; border-top: 1px dashed var(--field-border); }
.pairing:first-of-type { border-top: 0; }
.pairing-main { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 8px; }
.pairing-main .login-field { max-width: 320px; }
.pairing-meta { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; font-size: 16px; }
.pairing-meta dt { color: var(--muted); }
.pairing-meta dd { margin: 0; overflow-wrap: anywhere; }
.pairing-actions { display: flex; gap: 8px; }

/* session control */
.session-title { font-size: inherit; color: var(--fg); font-weight: 700; }
.permission { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-top: 1px dashed var(--field-border); }
.permission:first-of-type { border-top: 0; }
.permission-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.permission-actions { display: flex; gap: 8px; align-items: center; }
.permission-actions .input { flex: 1; min-width: 0; }
.file-pick { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 16px; color: var(--muted); flex-wrap: wrap; }
.timeline { display: flex; flex-direction: column; max-height: 70vh; overflow: auto; }
.tl { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--card-border); }
.tl-icon { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: color-mix(in srgb, var(--fg) 6%, transparent); color: var(--muted); }
.tl-icon .ico { width: 13px; height: 13px; }
.tl-UserPromptSubmit .tl-icon, .tl-InstructionQueued .tl-icon, .tl-InstructionDelivered .tl-icon { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.tl-PermissionRequest .tl-icon, .tl-PermissionAsked .tl-icon, .tl-Notification .tl-icon { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.tl-PermissionDenied .tl-icon, .tl-StopQueued .tl-icon, .tl-StopDelivered .tl-icon { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.tl-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tl-head { display: flex; gap: 8px; align-items: baseline; }
.tl-label { font-weight: 600; font-size: 16px; }
.tl-prompt { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; max-height: 16em; overflow: auto; }
.tl-code { margin: 0; font-family: var(--mono); font-size: 16px; white-space: pre-wrap; word-break: break-all; background: var(--glass-strong); padding: 6px 8px; border-radius: 6px; max-height: 12em; overflow: auto; }

/* session board */
.session-board { display: flex; flex-direction: column; gap: 12px; }
.session-card { padding-right: 12px; min-height: 84px; }
.session-kind { --kc: var(--lane); }
.session-activity { font-size: 16px; color: var(--muted); line-height: 1.5; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.session-ago { color: var(--faint); font-weight: 400; }
.lane-hint { font-size: 16px; }
.lane-permission { border-color: color-mix(in srgb, #e5484d 45%, transparent); }

/* session list */
.session-filter { flex-wrap: wrap; }
.session-filter .input { width: 280px; max-width: 100%; }
.session-table { display: flex; flex-direction: column; }
.st-row { display: grid; grid-template-columns: 96px minmax(0, 3fr) minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr) 64px; gap: 12px; align-items: center; padding: 10px 8px; border: 0; border-bottom: 1px solid var(--card-border); background: transparent; text-align: left; font-size: 16px; width: 100%; }
button.st-row:hover { background: color-mix(in srgb, var(--fg) 5%, transparent); }
.st-head { font-size: 16px; color: var(--muted); font-weight: 600; }
.st-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-title > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
@media (max-width: 860px) {
  .st-row { grid-template-columns: 80px minmax(0, 1fr); }
  .st-row > :nth-child(n + 3) { display: none; }
}

.remote-chip { margin-left: 6px; font-size: 16px; padding: 0 6px; vertical-align: middle; }
.remote-note { margin: -4px 4px 0; }

.local-perms { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.local-perm { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 16px; }
.local-perm code { font-family: var(--mono); background: var(--glass-strong); padding: 1px 6px; border-radius: 4px; overflow-wrap: anywhere; }

/* jobs */
.job-list { display: flex; flex-direction: column; }
.job-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 6px; border: 0; border-bottom: 1px solid var(--card-border); background: transparent; text-align: left; width: 100%; }
.job-row:hover { background: color-mix(in srgb, var(--fg) 5%, transparent); }
.job-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.job-title > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-log { display: flex; flex-direction: column; gap: 6px; max-height: 75vh; overflow: auto; }
.jl { padding: 6px 8px; border-radius: 8px; font-size: 16px; }
.jl-text { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.jl-tool { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.jl-tool .tl-code { flex-basis: 100%; }
.jl-result summary { cursor: pointer; font-size: 16px; color: var(--muted); }
.jl-result.is-error summary { color: var(--danger); }
.jl-error { color: var(--danger); display: flex; gap: 6px; align-items: center; }
.jl-system { color: var(--faint); font-size: 16px; }

/* attention */
.attention { border: 2px solid color-mix(in srgb, var(--warn) 55%, transparent); }
.attention-list { display: flex; flex-direction: column; }
.attention-item { display: grid; grid-template-columns: 12px minmax(0, 1fr) 20px; gap: 10px; align-items: center; padding: 10px 8px; border: 0; border-bottom: 1px solid var(--card-border); background: transparent; text-align: left; width: 100%; }
.attention-item:last-child { border-bottom: 0; }
.attention-item:hover { background: color-mix(in srgb, var(--fg) 5%, transparent); }
.attention-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.attention-body > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attention-label { font-size: 16px; font-weight: 600; color: var(--st); }
.attention-title { font-size: 16px; }
.attention-go { color: var(--faint); transform: rotate(180deg); }

/* report */
.report-box { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 4px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 9%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
.report-label { font-size: 16px; font-weight: 700; color: var(--warn); }
.report-box .tl-prompt { max-height: none; font-size: 16px; }
.report-actions { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.attention-report { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; font-size: 16px; color: var(--fg); max-height: 9em; overflow: hidden; }
.attention-body > .attention-report { white-space: pre-wrap; text-overflow: clip; overflow: hidden; }
.attention-item { align-items: start; }
.mini-card { align-items: start; }
.mini-title-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mini-title-wrap .mini-title { flex: none; }
.mini-report { font-size: 16px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; white-space: normal; }

/* attention: 横に間延びさせない */
.attention { max-width: 760px; }
.attention .section-head { flex-wrap: wrap; }
.attention-item { padding: 8px 6px; }
.attention-report { max-height: 6.5em; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.attention-title { white-space: normal; overflow-wrap: anywhere; }
.dash-section.pairing-section, .permission-section { max-width: 760px; }

/* 読みやすさ: 文字を大きく、幅を絞る */
body { font-size: 16px; }
.hint, .note-time, .rail-sub, .card-machine, .session, .muted.small, .small, .kpi-label, .kpi-sub, .machine-sub, .session-cwd, .session-time, .st-head, .job-row, .jl, .jl-system, .tl-label, .attention-label, .attention-report, .mini-report, .permission-head .note-time { font-size: 16px; }
.tl-code, .cmd-text, .file-path, .setup-key, code { font-size: 16px; }
.card-title { font-size: 16px; }
.lane-title, .dash-section h2, .pane-col h2, .attention-title { font-size: 16px; }
.pane-title h1 { font-size: 22px; }
.kpi-value { font-size: 28px; }
#view { max-width: none; }
.pane-grid { grid-template-columns: minmax(280px, 420px) minmax(0, 1fr); }

/* popovers, dialog, toast */
.popover { position: fixed; z-index: 30; border-radius: 14px; padding: 14px; width: 300px; background: var(--glass-strong); }
.popover h3 { margin: 0 0 10px; font-size: 16px; }
.pop-grid { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: center; }
.legend-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
dialog { border-radius: 18px; padding: 0; width: min(620px, calc(100vw - 32px)); color: var(--fg); background: var(--glass-strong); }
dialog::backdrop { background: rgba(15, 23, 42, 0.28); backdrop-filter: blur(2px); }
.dlg { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.dlg h2 { margin: 0; font-size: 16px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; }
.hint { font-size: 16px; color: var(--muted); line-height: 1.6; margin: 0; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { padding: 9px 14px; border-radius: 10px; background: #1d2433; color: #fff; box-shadow: var(--shadow); font-size: 16px; max-width: calc(100vw - 32px); }
.toast.error { background: var(--danger); }

/* narrow screens */
@media (max-width: 1400px) {
  main { grid-template-columns: 180px 340px minmax(0, 1fr); }
  main.no-detail { grid-template-columns: 180px minmax(0, 1fr); }
  .pane-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1180px) {
  .top { flex-wrap: wrap; }
  .search { order: 5; flex-basis: 100%; }
  main, main.no-detail, main:has(#rail[hidden]), main.no-detail:has(#rail[hidden]) { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  #rail { flex-direction: row; overflow-x: auto; padding: 6px; }
  #rail .rail-title, #rail .hint { display: none; }
  #rail .rail-item { width: auto; flex: none; max-width: 220px; }
  #detail { position: fixed; top: 12px; bottom: 12px; left: 12px; width: min(400px, calc(100vw - 24px)); z-index: 20; background: var(--glass-strong); }
  .switch-label, #legend-btn, #reset-btn { font-size: 0; gap: 0; padding: 0 10px; }
  .search kbd { display: none; }
}
@media (max-width: 860px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100vh; padding: 8px 16px 16px; }
  .top { flex-wrap: wrap; }
  .logo span:last-child { display: none; }
  .search { order: 5; flex-basis: 100%; }
  .tools { flex-wrap: wrap; }
  .mode { display: none; }
  main, main.no-detail { grid-template-columns: minmax(0, 1fr); }
  #view { overflow: visible; }
  .view-btn { padding: 7px 8px; }
  #detail { inset: 8px; width: auto; }
  .cards { grid-template-columns: minmax(0, 1fr); }
}

/* セッション画面は1列で上から読む */
.session-pane .pane-grid { grid-template-columns: minmax(0, 1fr); }
.session-pane .pane-col:first-child { order: 2; }

/* home: 1列 */
.home { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.home-box { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--card-border); box-shadow: var(--shadow); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--field-border); background: var(--field); }
.chip-btn.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 600; }
.textarea.composer { font-size: 16px; line-height: 1.6; }
.home-section { display: flex; flex-direction: column; gap: 10px; }
.home-section h2 { margin: 0; font-size: 18px; }
.inbox-item { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--card-border); border-left: 5px solid var(--st); box-shadow: var(--shadow); }
.inbox-head { display: flex; align-items: center; gap: 8px; }
.inbox-label { font-weight: 700; color: var(--st); flex: 1; }
.inbox-title { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.inbox-title .link { font-size: inherit; }
.inbox-body { white-space: pre-wrap; line-height: 1.7; overflow-wrap: anywhere; max-height: 14em; overflow: auto; padding: 10px 12px; border-radius: 10px; background: var(--glass-strong); }
.inbox-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.inbox-actions .textarea { flex: 1 1 320px; }
.progress-list { display: flex; flex-direction: column; gap: 6px; }
.progress-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--card-border); background: var(--card); text-align: left; }
.progress-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-foot { text-align: center; }

.ctx { display: flex; flex-direction: column; gap: 4px; }
.ctx-label { font-size: 16px; font-weight: 700; color: var(--muted); }
.link.small { align-self: flex-start; }

.settings summary { cursor: pointer; font-weight: 700; font-size: 17px; }
.settings[open] { display: flex; flex-direction: column; gap: 12px; }
.settings > section { box-shadow: none; }

/* 会話の板 */
main { grid-template-columns: 220px 460px minmax(0, 1fr); }
.conv .card-title { -webkit-line-clamp: 2; }
.conv-sub { margin-top: 4px; font-size: 16px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.conv-foot { margin-top: 6px; font-size: 16px; color: var(--faint); }
.card.conv { min-height: 96px; padding-right: 12px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
@media (min-width: 1500px) { .cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }
.conv-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.conv-action { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.conv-history { margin-top: 12px; }
#detail .d-scroll { padding: 16px; }

.d-foot.d-foot-col { grid-template-columns: 1fr; gap: 8px; }

/* 視線は左(マシン)→真ん中(一覧)→右(詳細)。詳細は右に開く */
#rail { order: 1; }
#view { order: 2; }
#detail { order: 3; }
main { grid-template-columns: 220px minmax(0, 1fr) 460px; }
main.no-detail { grid-template-columns: 220px minmax(0, 1fr); }
main:has(#rail[hidden]) { grid-template-columns: minmax(0, 1fr) 460px; }
main.no-detail:has(#rail[hidden]) { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1400px) {
  main { grid-template-columns: 180px minmax(0, 1fr) 400px; }
  main.no-detail { grid-template-columns: 180px minmax(0, 1fr); }
}
@media (max-width: 1180px) {
  main, main.no-detail, main:has(#rail[hidden]), main.no-detail:has(#rail[hidden]) { grid-template-columns: minmax(0, 1fr); }
  #detail { position: fixed; top: 12px; bottom: 12px; right: 12px; left: auto; width: min(460px, calc(100vw - 24px)); }
}

/* 右の詳細の幅(ドラッグで変更) */
:root { --detail-w: 520px; }
main { grid-template-columns: 220px minmax(0, 1fr) var(--detail-w); }
main:has(#rail[hidden]) { grid-template-columns: minmax(0, 1fr) var(--detail-w); }
@media (max-width: 1400px) { main { grid-template-columns: 180px minmax(0, 1fr) var(--detail-w); } }
#detail { position: relative; }
.detail-grip { position: absolute; left: 0; top: 0; bottom: 0; width: 12px; cursor: col-resize; border-radius: 20px 0 0 20px; touch-action: none; }
.detail-grip::after { content: ""; position: absolute; left: 4px; top: 50%; width: 4px; height: 48px; margin-top: -24px; border-radius: 2px; background: var(--field-border); }
.detail-grip:hover, .detail-grip:active { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.detail-grip:hover::after, .detail-grip:active::after { background: var(--accent); }
@media (max-width: 1180px) { #detail { width: min(var(--detail-w), calc(100vw - 24px)); } }

/* マシンの画面: 左に板、右に「頼む」と設定 */
.machine { display: flex; flex-direction: column; gap: 12px; }
.machine-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 12px; align-items: start; }
.machine-board, .machine-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.machine-side .home-section h2 { margin: 0; font-size: 18px; }
@media (max-width: 1500px) { main:not(.no-detail) .machine-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1100px) { .machine-grid { grid-template-columns: minmax(0, 1fr); } }

/* 左の一覧: マシンをドラッグで並べ替える */
.rail-machine { cursor: grab; }
.rail-machine.dragging { opacity: 0.4; cursor: grabbing; }
.rail-machine.drop-before { box-shadow: 0 -3px 0 0 var(--accent); }
.rail-machine.drop-after { box-shadow: 0 3px 0 0 var(--accent); }
@media (max-width: 1180px) {
  .rail-machine.drop-before { box-shadow: -3px 0 0 0 var(--accent); }
  .rail-machine.drop-after { box-shadow: 3px 0 0 0 var(--accent); }
}

.composer-policy { gap: 6px; font-size: 16px; color: var(--muted); white-space: nowrap; }
.composer-policy .select { min-width: 0; }

/* Markdown の描画 */
.md { white-space: normal; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md-p { margin: 0 0 10px; line-height: 1.7; overflow-wrap: anywhere; }
.md-h { margin: 14px 0 6px; font-size: 17px; font-weight: 700; line-height: 1.4; }
.md-list { margin: 0 0 10px; padding-left: 24px; line-height: 1.7; }
.md-list li { margin: 2px 0; overflow-wrap: anywhere; }
.md-code { margin: 0 0 10px; font-family: var(--mono); font-size: 16px; white-space: pre-wrap; word-break: break-all; background: var(--glass-strong); padding: 8px 10px; border-radius: 8px; }
.md code { font-family: var(--mono); font-size: 16px; background: color-mix(in srgb, var(--fg) 8%, transparent); padding: 1px 5px; border-radius: 5px; }
.md-code code { background: transparent; padding: 0; }
.md-quote { margin: 0 0 10px; padding: 4px 12px; border-left: 3px solid var(--field-border); color: var(--muted); }
.md-table { border-collapse: collapse; margin: 0 0 10px; font-size: 16px; max-width: 100%; }
.md-table th, .md-table td { border: 1px solid var(--field-border); padding: 4px 10px; text-align: left; vertical-align: top; }
.md-table th { background: var(--glass-strong); font-weight: 700; }
.md a { color: var(--accent); text-decoration: underline; overflow-wrap: anywhere; }
.md hr { border: 0; border-top: 1px solid var(--field-border); margin: 10px 0; }

/* ツールの実行と結果、コードは端末風(黒地に白、Courier)で本文と分ける */
:root { --term-bg: #121417; --term-fg: #e8e8e8; --term-dim: #a9b0b8; --term-name: #ffd479; --term-err: #ff8a80; --term-font: "Courier New", Courier, "Cascadia Mono", monospace; }
.tl-code, .md-code { background: var(--term-bg); color: var(--term-fg); font-family: var(--term-font); }
.jl-tool, .jl-result { background: var(--term-bg); color: var(--term-fg); font-family: var(--term-font); }
.jl-tool .ico { color: var(--term-dim); }
.jl-tool strong { color: var(--term-name); }
.jl-tool .tl-code, .jl-result .tl-code { padding: 4px 0 0; border-radius: 0; }
.jl-result summary { color: var(--term-dim); }
.jl-result.is-error summary, .jl-result.is-error .tl-code { color: var(--term-err); }
.jl-error { font-family: var(--term-font); }
.tl-PreToolUse .tl-body strong, .tl-PermissionRequest .tl-body strong, .tl-PermissionAsked .tl-body strong { font-family: var(--term-font); }

/* 指示(人)と応答(Claude)の色分け */
.ctx-ask .inbox-body { border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card)); }
.ctx-ask .ctx-label { color: var(--accent); }
.ctx-reply .inbox-body { border-left: 4px solid #22a06b; background: var(--card); border-top: 1px solid var(--card-border); border-right: 1px solid var(--card-border); border-bottom: 1px solid var(--card-border); }
.ctx-reply .ctx-label { color: #1a8a58; }
.ctx-fail .inbox-body { border-left: 4px solid var(--danger); background: color-mix(in srgb, var(--danger) 6%, var(--card)); }
.ctx-fail .ctx-label { color: var(--danger); }
.tl-UserPromptSubmit .tl-prompt, .tl-InstructionQueued .tl-prompt, .tl-InstructionDelivered .tl-prompt { border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card)); padding: 8px 10px; border-radius: 0 8px 8px 0; }
.jl-text { background: var(--card); border-left: 4px solid #22a06b; border-radius: 0 8px 8px 0; }
/* マシンの画面: 頼む、設定、マシン情報は押したときだけ */
.machine-tools { margin-left: auto; }
.machine-tool-col { display: flex; flex-direction: column; gap: 12px; }
.machine-tool h2 { margin: 0 0 8px; font-size: 18px; }
