/* VWS hub - page styles on top of the VWS design system (tokens only). */

.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.block { display: block; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-4 { margin-bottom: var(--sp-4); }
.gap-2 { gap: var(--sp-2); }
.inline-form { display: contents; }
.callout.ok { --c: var(--ok); } .callout.warn { --c: var(--warn); } .callout.err { --c: var(--err); } .callout.info { --c: var(--info); }

/* ---------- sign-in / setup pages ---------- */
.auth-body {
  min-height: 100vh; margin: 0; background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 15% -10%, color-mix(in oklab, var(--accent) 18%, transparent), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, color-mix(in oklab, var(--accent-2) 14%, transparent), transparent 60%);
}
.auth-wrap { width: min(440px, 100% - 32px); margin: 0 auto; padding: 8vh 0 40px; display: flex; flex-direction: column; gap: var(--sp-5); }
.auth-wrap:has(.wide-card) { width: min(560px, 100% - 32px); }
.auth-brand { display: flex; align-items: center; gap: var(--sp-3); }
.auth-card { padding: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4); }
.auth-card h1 { margin: 0; font-size: var(--fs-xl); }
.auth-card p { margin: 0; }
.auth-foot { text-align: center; font-size: var(--fs-xs); }
.center-form { display: flex; justify-content: center; }
.code-input { font-size: var(--fs-lg); letter-spacing: .25em; height: 48px; text-align: center; }

.steps { display: flex; gap: var(--sp-2); flex-wrap: wrap; font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em; }
.steps span { padding: 3px 8px; border-radius: var(--radius-pill); border: 1px solid var(--border); color: var(--text-3); }
.steps span.on { color: var(--accent-text); border-color: var(--accent); background: var(--accent-soft); }
.steps span.done { color: var(--ok); border-color: color-mix(in oklab, var(--ok) 40%, transparent); }

.setup-list { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: var(--sp-3); font-size: var(--fs-sm); }
.secret-box { display: flex; align-items: center; gap: var(--sp-2); margin-top: 6px; padding: 8px 10px; border-radius: var(--radius-md); background: var(--field); border: 1px dashed var(--border-strong); }
.secret-box code { flex: 1; font-size: var(--fs-md); letter-spacing: .08em; word-break: break-all; }

.codes { list-style: none; margin: 0; padding: var(--sp-4); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px var(--sp-4);
  border-radius: var(--radius-md); background: var(--field); border: 1px solid var(--border); font-size: var(--fs-md); }
@media (max-width: 420px) { .codes { grid-template-columns: 1fr; } }

/* ---------- signed-in pages ---------- */
.hub-tabs { height: auto; margin-bottom: var(--sp-4); border-bottom: 1px solid var(--border); }
.hub-tabs .grid-tab { padding: 10px var(--sp-3); text-decoration: none; color: var(--text-2); border-bottom: 2px solid transparent; }
.hub-tabs .grid-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.hub-tabs .grid-tab .icon { color: var(--warn); }
.card-head h2 { margin: 0; font-size: var(--fs-md); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.people li { display: flex; align-items: center; gap: var(--sp-3); padding: 10px 0; border-top: 1px solid var(--border); font-size: var(--fs-sm); min-width: 0; }
.people li:first-child { border-top: 0; }
.sessions { padding: 0 var(--sp-4) var(--sp-2); }
code.details { font-size: var(--fs-2xs); color: var(--text-2); word-break: break-all; }
a.user-chip { text-decoration: none; }

/* ---------- staff & permission pages ---------- */
.table td.wrap { white-space: normal; }
.ok-icon { color: var(--ok); vertical-align: -2px; }
.form-card { max-width: 720px; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--sp-4); margin: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.fieldset legend { padding: 0 6px; font-size: var(--fs-xs); color: var(--text-2); }
fieldset.bare { border: 0; padding: 0; margin: 0; min-width: 0; }
.field-row { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: flex-end; }
.field-row > .grow { flex: 1 1 180px; }
.field-row > .grow-2 { flex: 2 1 240px; }
.field-row > .select { flex: 1 1 150px; width: auto; }
.action-list { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.danger-zone { border-top: 1px solid var(--border); padding-top: var(--sp-4); margin-top: var(--sp-2); }
.danger-card { border-color: color-mix(in oklab, var(--err) 35%, var(--border)); }
.reauth-inline { display: flex; flex-direction: column; gap: var(--sp-3); }
.reauth-card { max-width: 480px; }
.card-foot { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }
a.group-card { text-decoration: none; color: inherit; transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
a.group-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.group-card h2 { display: flex; align-items: center; gap: 6px; }
.perm-matrix th.c, .perm-matrix td.c { text-align: center; width: 72px; }
.perm-matrix thead th.c { cursor: pointer; }
.perm-matrix td { height: auto; padding-top: 8px; padding-bottom: 8px; }
.perm-matrix .tool-desc { font-size: var(--fs-2xs); max-width: 460px; }
.perm-matrix .cat-row td { background: var(--surface-2); font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding-top: 6px; padding-bottom: 6px; }
.perm-matrix .super-only { opacity: .55; }
.perm-matrix .na { color: var(--text-3); }
.perm-matrix .check { justify-content: center; }
.breadcrumb a { color: inherit; text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }
.table-wrap:has(> .perm-matrix) { max-height: none; }

/* Authenticator QR: always dark-on-white with a quiet zone, whatever the theme */
.qr-box { width: min(220px, 100%); margin: 10px 0 4px; padding: 6px; background: #fff; border-radius: var(--radius-md); border: 1px solid var(--border); }
.qr-box svg { display: block; width: 100%; height: auto; }
.key-fallback { margin-top: 8px; font-size: var(--fs-sm); }
.key-fallback summary { cursor: pointer; color: var(--accent-text); }
.key-fallback[open] { display: flex; flex-direction: column; gap: 8px; }

/* servers */
a.server-card { text-decoration: none; color: inherit; transition: border-color var(--dur-fast) var(--ease); }
a.server-card:hover { border-color: var(--accent); }
.server-card h2 { display: flex; align-items: center; gap: 8px; }
.meter-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) 78px; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); }
.meter-row .val { text-align: right; }
.spark.wide { width: 100%; height: 34px; }
.small { font-size: var(--fs-xs); }
.status-cell { display: inline-flex; align-items: center; gap: 8px; }
.actions-cell .inline-form { display: inline-flex; gap: 4px; }
.table tbody tr[data-menu] { cursor: context-menu; }
.h1-bulb { vertical-align: middle; }
.page-head h1 .bulb.lg { vertical-align: middle; margin-right: 4px; }

/* Region sets */
.callout > form.inline-form { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; flex: none; }
.callout > span { flex: 1 1 auto; }
.kpi .kpi-value { font-size: var(--fs-xl); }
.mono { font-family: var(--font-mono, ui-monospace, monospace); }

/* Grid registry, owners, hosting */
fieldset.fieldset-plain { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.chip .inline-form { display: inline-flex; }
.chip-x { display: inline-flex; align-items: center; border: 0; background: transparent; color: inherit; padding: 0 0 0 2px; margin-right: -4px; cursor: pointer; opacity: .65; }
.chip-x:hover { opacity: 1; color: var(--err); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px var(--sp-3); }
.row > .grow { flex: 1 1 160px; width: auto; min-width: 0; }
.kpi .meter { margin-top: 2px; }
.chips-cell { white-space: normal; } .chips-cell .chip { margin: 2px 0; }

/* Grid access mode: applied-on-servers list */
.list-plain { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2, 8px); }
.list-plain > li.row { gap: var(--space-2, 8px); flex-wrap: wrap; }

/* Grid monitor: avatars */
.card-sub { margin: var(--space-4, 16px) var(--space-4, 16px) var(--space-2, 8px); }
#avatars .card-head { flex-wrap: wrap; gap: var(--space-2, 8px); }

/* Money: live search pickers */
.money-pick { position: relative; }
.money-results { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 320px; overflow-y: auto;
  background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: var(--radius-md); box-shadow: var(--shadow-3); padding: 4px; }
.money-result { display: flex; width: 100%; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 0; background: none; color: inherit;
  font: inherit; text-align: left; border-radius: 8px; cursor: pointer; }
.money-result:hover, .money-result.active { background: var(--accent-softer); }
.money-empty { padding: 8px 10px; color: var(--text-3); }
.money-issuer { align-items: center; padding: 4px 0; border-bottom: 1px solid var(--border); }
.kpi-value.small { font-size: 1rem; }
/* Transfer form: fields line up at the top and every field keeps one hint line, so choosing an avatar never moves the form */
.field-row.money-row { align-items: flex-start; }
.money-row .hint { display: block; min-height: 1.5em; }
.money-result:disabled { cursor: not-allowed; opacity: .55; }
.money-result:disabled:hover { background: none; }

/* Abuse reports: what the reporter wrote keeps its line breaks; the screenshot fits the card */
.abuse-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; font: inherit; padding: var(--sp-3, 12px); border: 1px solid var(--border, rgba(127,127,127,.25)); border-radius: var(--radius-sm, 6px); background: var(--surface-2, transparent); max-height: 32rem; overflow: auto; }
.abuse-note { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; }
.abuse-shot { display: block; max-width: 100%; height: auto; border-radius: var(--radius-sm, 6px); border: 1px solid var(--border, rgba(127,127,127,.25)); }

/* ---------- new avatars ---------- */
.donor-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); }
.donor-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: var(--sp-2); border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); cursor: pointer; transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.donor-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.donor-card input { position: absolute; opacity: 0; pointer-events: none; }
.donor-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.donor-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.donor-pic { display: grid; place-items: center; aspect-ratio: 3 / 4; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); color: var(--text-3); }
.donor-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.donor-name { font-weight: 600; font-size: var(--fs-sm); }
.donor-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donor-admin { display: flex; flex-direction: column; gap: var(--sp-3); }
.donor-row { display: flex; gap: var(--sp-4); align-items: flex-start; }
.donor-row > .donor-pic { flex: 0 0 120px; }
@media (max-width: 560px) { .donor-row { flex-direction: column; } .donor-row > .donor-pic { width: 140px; } }
.tos-box { border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--sp-2) var(--sp-3); }
.tos-box summary { cursor: pointer; font-weight: 600; }
.tos-text { max-height: 320px; overflow: auto; margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--text-2); }
.input.input-sm { height: 30px; width: 140px; font-size: var(--fs-xs); }
.err-text { color: var(--err); }

/* ---------- the sidebar logo is the way home ---------- */
a.app-brand { text-decoration: none; color: inherit; }
a.app-brand:hover .logo-mark { filter: brightness(1.08); }
a.app-brand:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Grid monitor: grid stats tiles, databases; monitoring setup */
.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1200px) { .cols-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .cols-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.grid-stats.is-stale .kpi-value { color: var(--text-3); }
#databases .card-head, #services .card-head { flex-wrap: wrap; gap: var(--space-2, 8px); }
.mon-help summary { cursor: pointer; color: var(--accent-text); }
.mon-help pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0; padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-sm, 6px); background: var(--surface-2); color: var(--text-2); }
.mon-help pre i { color: var(--accent-text); font-style: normal; }
.field-row.mon-row { align-items: flex-start; }

/* Live instance log (same look as the agent console's log view) */
.logs-card { display: flex; flex-direction: column; }
.log-tools { flex-wrap: wrap; gap: var(--sp-2); }
.logview { height: calc(100vh - 330px); min-height: 280px; overflow: auto; padding: var(--sp-2) var(--sp-3); background: var(--surface-0);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Consolas, monospace); font-size: 12px; line-height: 1.55; }
.ll { white-space: pre-wrap; word-break: break-word; padding: 0 4px; border-radius: 3px; }
.ll:hover { background: var(--surface-2); }
.ll.l-warn .lm { color: var(--warn); }
.ll.l-error { background: var(--err-soft); }
.ll.l-error .lm { color: var(--err); }
.log-foot { display: flex; justify-content: space-between; align-items: center; padding: 6px var(--sp-4); font-size: var(--fs-xs); }

/* Virtual console: the same log view with a command bar */
.logs-card.is-console .logview { height: calc(100vh - 400px); }
.ll.l-cmd .lm { color: var(--accent-text); font-weight: var(--fw-semibold); }
.console-bar { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--border); background: var(--surface-1); }
.console-bar .input { flex: 1 1 auto; min-width: 0; }
.console-prompt { color: var(--accent-text); white-space: nowrap; font-size: 12px; }
@media (max-width: 600px) { .console-prompt { display: none; } }

/* Live stats: the small text under a value stays clear of its graph */
#live-stats .kpi:has(.spark) .kpi-meta { padding-right: 104px; display: block; }
#live-stats .kpi .kpi-meta { min-height: 1.4em; }
/* RAM watch: bar against the limit + "used / limit MB" */
.ram-cell { display: inline-grid; grid-template-columns: 72px auto; align-items: center; gap: var(--sp-2); }
.ram-val { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ram-attention .card-head h2 { display: inline-flex; align-items: center; gap: 8px; }
.ram-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); }
.ram-facts > div { display: flex; flex-direction: column; gap: 2px; }
.ram-facts b { font-size: var(--fs-xl); font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .ram-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ram-chart-wrap { position: relative; }
.ram-chart { display: block; width: 100%; height: auto; overflow: visible; }
.ram-chart .grid { stroke: var(--border); stroke-width: 1; }
.ram-chart .ax { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.ram-chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ram-chart .thr { stroke-width: 1.5; stroke-dasharray: 5 4; }
.ram-chart .thr.warn { stroke: var(--warn); } .ram-chart .thr.err { stroke: var(--err); }
.ram-chart .thr-label { fill: var(--text-2); font-size: 11px; }
.ram-chart .cross { stroke: var(--text-3); stroke-width: 1; }
.ram-chart .dot { fill: var(--accent); stroke: var(--surface-1); stroke-width: 2; }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 6px 8px; font-size: var(--fs-xs); color: var(--text); box-shadow: var(--shadow-2); white-space: nowrap; transform: translate(-50%, -110%); }
.chart-tip b { font-variant-numeric: tabular-nums; }
nav.seg { display: inline-flex; gap: 4px; }
.ram-chart [hidden] { display: none; }
.diag-read { display: flex; flex-direction: column; gap: 6px; }
.diag-read li { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-sm); }
.diag-read .bulb { margin-top: 5px; flex: none; }
.snap-table { table-layout: fixed; width: 100%; }
.snap-table th:first-child, .snap-table td.type { width: auto; }
.snap-table th.num, .snap-table td.num { width: 110px; }
.snap-table td.type { white-space: normal; overflow-wrap: anywhere; }
.maint-on { border-color: var(--info); }
.maint-form { flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.maint-form .input { flex: 1 1 280px; min-width: 200px; }
.maint-form .select { width: auto; }
/* Grid monitor: paged instance list */
.inst-filter { margin-left: var(--sp-3); }
.inst-filter .chip { margin-left: 4px; }
.inst-search .input { width: 220px; }
th.sort-link a { color: inherit; text-decoration: none; white-space: nowrap; }
th.sort-link a:hover { color: var(--text); }
th.sort-link.is-sorted a { color: var(--text); }
.pager { display: flex; align-items: center; gap: var(--sp-2); padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
.icon.flip { transform: scaleX(-1); }
