:root {
  color-scheme: light;
  --page: #f3f5f7;
  --surface: #fff;
  --ink: #142536;
  --muted: #4c6072;
  --border: #ccd6df;
  --accent: #174c86;
  --accent-hover: #103963;
  --danger: #962c29;
  --mono: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  font-family: system-ui, 'Noto Sans CJK TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  line-height: 1.55;
  color: var(--ink);
  background: var(--page);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; overflow-wrap: anywhere; }
h1, h2, h3, p, dl, dd { margin: 0; }
.shell { width: min(100% - 2rem, 88rem); margin-inline: auto; }
.masthead { background: #172b41; color: #fff; }
.masthead-inner, .page-head, .section-head, .account, .actions {
  display: flex; align-items: center; justify-content: space-between; gap: .65rem 1rem; flex-wrap: wrap;
}
.masthead-inner { min-height: 3.75rem; padding-block: .45rem; }
.wordmark { font-size: .94rem; font-weight: 700; }
.divider { color: #a9bed3; }
.account { font-size: .9rem; }
.account button { background: transparent; border-color: #7791aa; color: #fff; }
.account button:hover:not(:disabled) { background: #324b63; }
main { padding-block: clamp(1.5rem, 3vw, 2.5rem) 3rem; }
.page-head { margin-bottom: 1.65rem; align-items: end; }
h1 { font-size: clamp(1.65rem, 3.5vw, 2.4rem); line-height: 1.22; margin-bottom: .35rem; }
h2 { font-size: 1.23rem; line-height: 1.3; }
.muted { color: var(--muted); }
.section-head { margin-bottom: .35rem; }
.section-note { font-size: .9rem; margin-bottom: .9rem; }
#last-refresh { font-size: .85rem; font-variant-numeric: tabular-nums; }
.count { font: .88rem var(--mono); color: var(--muted); margin-inline-start: .3rem; }
button, .button, input, select { font: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 2.65rem;
  padding: .35rem .85rem; border: 1px solid #9caebf; border-radius: .35rem;
  color: var(--ink); background: var(--surface); text-decoration: none; cursor: pointer;
  font-size: .92rem; font-weight: 650;
}
button:hover:not(:disabled), .button:hover { background: #eaf0f6; }
button:disabled { opacity: .58; cursor: not-allowed; }
.primary { color: #fff; border-color: var(--accent); background: var(--accent); }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.danger { color: var(--danger); }
.primary.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.primary.danger:hover:not(:disabled) { background: #702320; }
:focus-visible { outline: 3px solid #2873bb; outline-offset: 3px; }
.masthead :focus-visible { outline-color: #b1d9ff; }
.notice { padding: 1rem 1.2rem; border: 1px solid var(--border); border-radius: .45rem; background: var(--surface); }
#session-panel > p:not(:last-child) { margin-bottom: .7rem; }
#password-form:not([hidden]) { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
#shared-password { min-width: 0; max-width: 100%; width: 11rem; padding: .45rem; }
#password-error:not(:empty) { flex-basis: 100%; color: var(--danger); }
.feedback:not(:empty) { margin-bottom: 1rem; color: var(--accent); }
.feedback.error:not(:empty) { padding: .65rem .85rem; background: #fff1ef; border-inline-start: 3px solid var(--danger); color: var(--danger); }
.hosts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: .8rem; }
.host-card { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: .45rem; }
.host-card > header, .host-body, .host-foot { padding: .8rem .9rem; }
.host-card h3 { font: 700 1rem/1.35 var(--mono); }
.host-card header p { font-size: .84rem; }
.host-body { flex: 1; border-top: 1px solid var(--border); }
.host-state { display: flex; align-items: flex-start; flex-direction: column; gap: .25rem; }
.sample-time, .sample-note, .gpu-metrics, .ram, .host-foot { font-size: .83rem; }
.sample-note { margin-top: .7rem; }
.badge { display: inline-block; background: #ebeff3; color: #3e5162; padding: .08rem .4rem; border-radius: .25rem; font-size: .79rem; font-weight: 700; }
.activity { background: #e2edf9; color: #164778; }
.quiet { background: #e5f0ec; color: #245b4b; }
.overdue { background: #fbeedc; color: #7a420c; }
.gpu-list { list-style: none; padding: 0; margin: .7rem 0 0; }
.gpu-list li + li { margin-top: .55rem; }
.gpu-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem .55rem; font: 650 .85rem var(--mono); }
.gpu-heading .badge { font-family: system-ui, 'Noto Sans CJK TC', sans-serif; }
.gpu-metrics { margin-top: .13rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ram { margin-top: .7rem; padding-top: .55rem; border-top: 1px solid var(--border); }
.ram dt { font-weight: 700; }
.ram dd { color: var(--muted); font-variant-numeric: tabular-nums; }
.host-foot { border-top: 1px solid var(--border); background: #f9fafc; border-radius: 0 0 .45rem .45rem; font-weight: 650; }
.usages { margin-top: 2rem; }
.switch { display: flex; background: var(--surface); border: 1px solid #9caebf; border-radius: .4rem; }
.switch button { border: 0; border-radius: 0; }
.switch button:first-child { border-radius: .35rem 0 0 .35rem; }
.switch button:last-child { border-radius: 0 .35rem .35rem 0; border-inline-start: 1px solid #9caebf; }
.switch button[aria-pressed='true'] { background: #dceafa; color: #143f6a; }
.usage-list:not(:empty) { background: var(--surface); border: 1px solid var(--border); border-radius: .45rem; }
.usage-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) 8rem; gap: .6rem 1.1rem; align-items: center; padding: .8rem 1rem; }
.usage-row + .usage-row { border-top: 1px solid var(--border); }
.usage-task { font-size: 1rem; white-space: pre-wrap; }
.usage-meta, .usage-times { font-size: .85rem; }
.usage-times > div { display: flex; gap: .15rem .5rem; flex-wrap: wrap; }
.usage-times dt { color: var(--muted); }
.usage-times dd { font-variant-numeric: tabular-nums; }
.row-actions { justify-content: flex-start; gap: .4rem; }
dialog { width: min(30rem, 100% - 2rem); max-height: calc(100% - 1.5rem); padding: 1.25rem; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: .55rem; }
dialog::backdrop { background: rgb(17 35 55 / .58); }
dialog h2 { margin-bottom: .85rem; }
fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
label { display: block; margin-top: .75rem; margin-bottom: .2rem; font-weight: 650; }
input, select { display: block; min-width: 0; width: 100%; min-height: 2.65rem; padding: .4rem .5rem; background: var(--surface); border: 1px solid #8295a7; border-radius: .3rem; color: var(--ink); }
.hint { font-size: .83rem; margin-top: .2rem; }
.dialog-actions { justify-content: flex-end; margin-top: 1rem; }
#dialog-error:not(:empty) { margin: .85rem 0 0; }
@media (max-width: 45rem) {
  .usage-row { grid-template-columns: minmax(0, 1fr); }
  .row-actions:empty { display: none; }
}
