/* Flat, high contrast. No gradients, no shadows. One accent for the one main action. */
:root { --ink: #111; --line: #E3E7EC; --paper: #fff; --accent: #1447E6; --good: #0A7A35; --bad: #B42318; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 15px/1.4 "Helvetica Neue", Helvetica, Arial, sans-serif; color: var(--ink); background: var(--paper); }
button, input { font: inherit; color: inherit; }
button { border: 1px solid var(--ink); background: var(--paper); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
button.main { background: var(--accent); border-color: var(--accent); color: #fff; }
button:disabled { cursor: not-allowed; border-color: var(--line); }
input { border: 1px solid var(--ink); border-radius: 8px; padding: 10px 12px; width: 100%; background: var(--paper); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--ink); margin-right: 8px; }
.dot.on { background: var(--good); border-color: var(--good); }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 340px; display: grid; gap: 14px; }
.login h1 { font-size: 28px; margin: 0 0 6px; }
.login label { display: grid; gap: 6px; font-weight: 600; }
.error { color: var(--bad); font-weight: 600; min-height: 1.4em; margin: 0; }

/* app: top bar, canvas with nodes, side panel */
.app { height: 100%; display: grid; grid-template-rows: auto 1fr; }
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; }
.pill { margin: 0 auto; display: flex; align-items: center; border: 1px solid var(--ink); border-radius: 999px; min-width: min(520px, 50vw); }
.pill > * { padding: 8px 16px; }
.pill .pick { flex: 1; min-width: 0; font: inherit; font-weight: 600; color: var(--ink); border: 0; background: none; border-radius: 999px 0 0 999px; opacity: 1; }
.pill .state { border-left: 1px solid var(--line); white-space: nowrap; }
.work { display: grid; grid-template-columns: 1fr 320px; min-height: 0; }
.center { display: grid; grid-template-rows: 1fr auto; min-height: 0; min-width: 0; }
.canvas { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 56px; padding: 24px 16px; overflow: auto;
  background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 22px 22px; }
#links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#links path { fill: none; stroke: var(--ink); stroke-width: 2; }
#links path.idle { stroke-dasharray: 4 6; }
#machine, .models, .hint { position: relative; }
.models { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; }
.models:empty, .hint:empty { display: none; }
.card { width: 280px; border: 2px solid var(--ink); border-radius: 14px; background: var(--paper); overflow: hidden; }
.card.on { border-color: var(--good); }
.card.pick { outline: 3px solid var(--accent); outline-offset: 2px; }
.card header { text-align: center; padding: 6px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.card .body { padding: 14px 16px; display: grid; gap: 6px; }
.card .name { font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.card button { margin-top: 6px; }
.row { display: flex; justify-content: space-between; gap: 12px; }
.row > :last-child { text-align: right; overflow-wrap: anywhere; }
.meter { display: flex; height: 10px; border: 1px solid var(--ink); border-radius: 5px; overflow: hidden; }
.meter i { background: var(--ink); border-right: 1px solid var(--paper); }
.hint { margin: 0; background: var(--paper); padding: 2px 8px; text-align: center; }
.side { border-left: 1px solid var(--line); padding: 16px; overflow: auto; display: grid; gap: 22px; align-content: start; }
.side section { display: grid; gap: 6px; }
.side h2 { font-size: 15px; margin: 0 0 4px; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side li { padding: 8px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.side time { display: block; font-size: 13px; }
#panels { display: grid; gap: 22px; }
#panels:empty { display: none; }
dialog { border: 2px solid var(--ink); border-radius: 14px; padding: 22px; width: min(560px, calc(100vw - 32px)); color: var(--ink); background: var(--paper); }
dialog::backdrop { background: rgba(17, 17, 17, 0.55); }
dialog h2 { margin: 0 0 12px; font-size: 20px; }
dialog ol { padding-left: 20px; }
.code { border: 1px solid var(--ink); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.4 ui-monospace, Menlo, Consolas, monospace; margin: 0; }
.actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); margin: 0; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 600; max-width: calc(100vw - 32px); }
.card.model { cursor: pointer; width: 250px; }
.card header .dot { margin-right: 6px; }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.search { display: flex; gap: 8px; margin-bottom: 12px; }
.results { display: grid; gap: 0; max-height: 50vh; overflow: auto; }
.result { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.result .error, .card .error { min-height: 0; }
.label { font-weight: 600; margin: 10px 0 4px; }
dialog .row { padding: 3px 0; align-items: center; }
dialog a { color: var(--accent); }
.pill .copy { border: 0; border-left: 1px solid var(--line); border-radius: 0 999px 999px 0; background: none; white-space: nowrap; font-weight: 600; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.buttons button { padding: 6px 10px; }
.side p { margin: 0; }
#dock { border-top: 1px solid var(--line); padding: 12px 16px; display: grid; gap: 10px; }
.dock-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; flex-wrap: wrap; }
.numbers { font-weight: 400; }
.answer { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 22vh; overflow: auto; min-height: 1.4em; }
#dock .search { margin: 0; }
input:disabled { border-color: var(--line); }
@media (max-width: 760px) { .work { grid-template-columns: 1fr; overflow: auto; } .side { border-left: 0; border-top: 1px solid var(--line); } .pill { min-width: 0; } }
