/* P008: server page, Virtual machines tab, plus the frame pieces it needs (design: docs/ai/evidence/P008/design-fable.md).
   Tokens only (tokens.css), so dark mode follows. To be folded into docs/design components by P006. */
main { max-width: 1600px; margin: 0 auto; }

/* Page head: crumbs and the fact line. */
.crumbs a { color: var(--ink-2); } .crumbs .sep { margin: 0 6px; color: var(--ink-3); }
.pagehead { margin-bottom: 16px; }
.pagehead h1 { margin-bottom: 6px; }
.fact { color: var(--ink-2); margin: 0; }
.fact .late { color: var(--warn-ink); }
.tabs { margin-bottom: 24px; }
.tabs a { flex-direction: column; align-items: flex-start; gap: 0; }
.tabs a .lab { display: inline-flex; gap: 6px; align-items: baseline; }
.tabs a .n { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-3); }
.tabs a::after { content: attr(data-label); font-weight: 600; height: 0; visibility: hidden; overflow: hidden; display: block; }   /* reserve the bold width: tabs never shift */

/* Side menu footer: one user row. */
.side .user { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 4px 0 10px; }
.side .user .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-tint); color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.side .user .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.side .user form { margin: 0; padding: 0; display: block; }
.iconbtn { width: 32px; height: 32px; padding: 0; justify-content: center; border: none; background: none; color: var(--ink-3); border-radius: var(--radius-sm); }
.iconbtn:hover { background: var(--surface-sunken); color: var(--ink); }
.iconbtn svg { width: 18px; height: 18px; }

/* Tooltip: one floating element, positioned by script. */
#hvtip { position: fixed; z-index: 1000; max-width: 300px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--ink); color: var(--surface); font-size: 12px; line-height: 16px; font-weight: 500; box-shadow: var(--shadow-pop); pointer-events: none; opacity: 0; transition: opacity .15s ease-out; }
#hvtip.on { opacity: 1; }
.tip[data-tip] { cursor: help; }

/* Spinner, status text, icons, link-buttons. */
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); display: inline-block; flex: none; animation: hv-spin .8s linear infinite; }
@keyframes hv-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin, .btn.busy .ico { animation: none; } }
.ico { width: 16px; height: 16px; flex: none; }
.st { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.st.good { color: var(--good-ink); } .st.warn { color: var(--warn-ink); } .st.bad { color: var(--bad-ink); }
button.lb { border: none; background: none; height: auto; padding: 0; margin-left: 8px; color: var(--accent); font: 600 12px/16px var(--font-sans); cursor: pointer; }
button.lb:hover { background: none; text-decoration: underline; }
button.lb[disabled] { color: var(--ink-3); opacity: 1; text-decoration: none; cursor: default; }

/* Notice strip. */
.notice { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 16px; border-radius: var(--radius-md); margin-bottom: 12px; color: var(--ink); }
.notice.warn { background: var(--warn-tint); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); } .notice.warn .ico { color: var(--warn-ink); }
.notice.bad { background: var(--bad-tint); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); } .notice.bad .ico { color: var(--bad-ink); }
.notice.good { background: var(--good-tint); border: 1px solid color-mix(in srgb, var(--good) 40%, transparent); } .notice.good .ico { color: var(--good-ink); }
.notice .txt { flex: 1; min-width: 0; }

/* Toolbar and edit bar share one 52 px slot. */
.vmbar { display: flex; align-items: center; gap: 12px; height: 52px; margin-bottom: 12px; }
.vmbar .age { margin-left: auto; font-size: 12px; line-height: 16px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.vmbar .age.warn { color: var(--warn-ink); } .vmbar .age.bad { color: var(--bad-ink); } .vmbar .age.good { color: var(--good-ink); }
.btn.busy .ico { animation: hv-spin .8s linear infinite; }
.btn[disabled], button[disabled] { opacity: .5; cursor: default; }
.editbar { position: sticky; top: 0; z-index: 5; padding: 0 16px; border-radius: var(--radius-md); background: var(--accent-tint); border: 1px solid var(--accent); }
.editbar.warn { background: var(--warn-tint); border-color: var(--warn); } .editbar.bad { background: var(--bad-tint); border-color: var(--bad); }
.editbar .msg { display: inline-flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.editbar .msg b { font-weight: 600; }
.editbar .count { color: var(--ink-2); }
.editbar .right { margin-left: auto; display: flex; gap: 8px; flex: none; }
.editbar .offline { color: var(--warn-ink); }

/* The VM table. */
.vmcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-card); overflow: hidden; }
.vmcard.editing { border-color: var(--accent); }
table.vms { table-layout: fixed; border: none; box-shadow: none; border-radius: 0; }
table.vms th { height: 40px; vertical-align: bottom; padding: 10px 16px; white-space: nowrap; }
table.vms th .tip { margin-left: 4px; }
table.vms td { height: 64px; vertical-align: top; padding: 12px 16px; }
table.vms th:first-child, table.vms td:first-child { padding-left: 20px; }
table.vms th:last-child, table.vms td:last-child { padding-right: 20px; }
table.vms tbody tr:hover td { background: var(--surface-sunken); }
table.vms thead tr:hover th { background: var(--surface); }
table.vms .l1 { display: flex; align-items: center; gap: 6px; height: 20px; white-space: nowrap; min-width: 0; }
table.vms .l1 > .pill { margin: -1px 0; }
table.vms .l2 { display: flex; align-items: center; gap: 6px; height: 16px; margin-top: 4px; font-size: 12px; line-height: 16px; color: var(--ink-3); white-space: nowrap; min-width: 0; }
table.vms .cut { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
table.vms a.vmname, table.vms .vmname { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
table.vms .off { color: var(--ink-3); }
table.vms td.num .l1 { justify-content: flex-end; color: var(--ink-2); }
table.vms .capw { color: var(--ink-2); } table.vms .prob { color: var(--warn-ink); font-weight: 600; } table.vms .prob.bad { color: var(--bad-ink); } table.vms .okp { color: var(--good-ink); font-weight: 600; }
table.vms .ago { color: var(--ink-3); }
table.vms .copy { color: var(--ink-2); } table.vms .copy svg { width: 12px; height: 12px; color: var(--good); } table.vms .copy.no { color: var(--bad-ink); } table.vms .copy.no svg { color: var(--bad); }
table.vms .gs { color: var(--ink-2); } table.vms .gs svg { width: 14px; height: 14px; color: var(--good); }
table.vms .gn { color: var(--warn-ink); } table.vms .gn svg { width: 14px; height: 14px; color: var(--warn); }
table.vms .lock { width: 12px; height: 12px; }
table.vms .mini { width: 80px; height: 4px; border-radius: var(--radius-pill); background: var(--run-tint); overflow: hidden; flex: none; } table.vms .mini > i { display: block; height: 100%; background: var(--run); }
table.vms tr.changed td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
table.vms tr.fresh td { animation: hv-fade 1.5s ease-out; }
@keyframes hv-fade { from { background: var(--accent-tint); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { table.vms tr.fresh td { animation: none; } }
table.vms .pending { color: var(--run-ink); } table.vms .was { color: var(--ink-3); } table.vms .needafter { color: var(--warn-ink); }
table.vms .busyline { color: var(--ink-2); } table.vms .busyline.bad { color: var(--bad-ink); } table.vms .busyline.warn { color: var(--warn-ink); } table.vms .busyline.good { color: var(--good-ink); }
.vmcard .ed { display: none; } .vmcard.editing .ed { display: flex; } .vmcard.editing .vw { display: none; }
.vmcard.editing a.vmname { pointer-events: none; }
.vmcard .empty { padding: 24px 20px; color: var(--ink-2); display: flex; align-items: center; gap: 12px; }
.vmcard tr.nomatch td { color: var(--ink-3); }

/* Switch: a real checkbox with role="switch". */
input.sw { appearance: none; -webkit-appearance: none; width: 36px; height: 20px; max-width: none; padding: 0; margin: 0; border: none; border-radius: var(--radius-pill); background: var(--line-strong); position: relative; cursor: pointer; transition: background .12s; flex: none; }
input.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-card); transition: transform .12s; }
input.sw:checked, input.sw.on { background: var(--accent); } input.sw:checked::after, input.sw.on::after { transform: translateX(16px); }
input.sw.offx { background: var(--line-strong); } input.sw.offx::after { transform: none; }
input.sw:disabled { opacity: .5; cursor: default; }
input.sw:focus { outline: none; border-color: transparent; } input.sw:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Row editor (guest account), directly under its VM row. */
table.vms tr.opened td { background: var(--surface-sunken); border-bottom-color: transparent; } table.vms tr.opened td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
table.vms tr.editor td { height: auto; padding: 16px 20px; background: var(--surface-sunken); box-shadow: inset 3px 0 0 var(--accent); }
table.vms tr.editor:hover td { background: var(--surface-sunken); }
.ged { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ged .ttl { font-weight: 600; align-self: center; min-width: 240px; display: inline-flex; gap: 6px; align-items: center; }
.ged label { margin: 0 0 4px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-2); }
.ged .f1 input { width: 280px; } .ged .f2 { position: relative; } .ged .f2 input { width: 240px; padding-right: 36px; }
.ged .eye { position: absolute; right: 4px; bottom: 4px; width: 26px; height: 26px; }
.ged .btns { margin-left: auto; display: flex; gap: 8px; }
.ged input.badf { border-color: var(--bad); }
.ged .status { flex-basis: 100%; display: flex; align-items: center; gap: 8px; min-height: 16px; font-size: 12px; line-height: 16px; color: var(--ink-3); margin-top: -4px; }
.ged .status.bad { color: var(--bad-ink); } .ged .status.warn { color: var(--warn-ink); }

/* Dialog: the native element. */
dialog.hv { width: 480px; max-width: calc(100vw - 32px); border: none; border-radius: var(--radius-md); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); padding: 24px; }
dialog.hv::backdrop { background: color-mix(in srgb, var(--ink) 40%, transparent); }
dialog.hv h3 { margin: 0 0 8px; font-size: 17px; line-height: 24px; font-weight: 600; }
dialog.hv p { margin: 0 0 8px; color: var(--ink-2); }
dialog.hv ul { margin: 0 0 8px; padding-left: 18px; color: var(--ink); }
dialog.hv label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 12px 0 0; color: var(--ink); }
dialog.hv label.check input { margin-top: 3px; }
dialog.hv .btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

@media (max-width: 1699px) { table.vms th, table.vms td { padding-left: 12px; padding-right: 12px; } table.vms .rel { display: none; } }
#hvtip { white-space: pre-line; }
[hidden] { display: none !important; }
.vmcard:not(.editing) table.vms .ed { display: none; }
.vmcard.editing table.vms .vw { display: none; }
.vmcard.editing table.vms .viewonly { display: none; }
/* Column widths: regular from 1700 px wide windows, compact below (design 1.3). The VM column takes the rest. */
table.vms { min-width: 1060px; }
table.vms col.c2 { width: 116px; } table.vms col.c3 { width: 208px; } table.vms col.c4 { width: 316px; } table.vms col.c5 { width: 128px; } table.vms col.c6 { width: 108px; } table.vms col.c7 { width: 304px; }
@media (max-width: 1699px) { table.vms col.c2 { width: 96px; } table.vms col.c3 { width: 172px; } table.vms col.c4 { width: 256px; } table.vms col.c5 { width: 108px; } table.vms col.c6 { width: 92px; } table.vms col.c7 { width: 200px; } }
.vmcard { overflow-x: auto; }
@media (max-width: 1699px) { table.vms th:last-child { white-space: normal; } }
/* Review r1: an edited row doesn't keep claiming its old state; the age slot can hold a Withdraw link. */
.vmcard.editing tr.changed .statecell .l2 > :not(.busyline) { visibility: hidden; }
.vmbar .age .lb { margin-left: 4px; }
.ged .status { max-width: 1000px; white-space: normal; }
