/* Dashboard skin. Buttons use #016769. Links use #3fa3a5. Status green, yellow, and red are not accents. */

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/poppins-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/poppins-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/poppins-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --view-as-offset: 0px;
  --bg: #0b1214;
  --card: #132024;
  --card-border: #24383c;
  --text: #e8ece9;
  --muted: #9fb0b0;
  --link: #3fa3a5;
  --teal: #016769;
  --teal-ink: #e8ece9;
  --danger: #e07a6a;
  --warn: #e2c15a;
  --ok: #3ddc97;
  --offline: #8a9692;
  --font: "Segoe UI", system-ui, sans-serif;
  --heading: "Poppins", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 14px;
  --radius-control: 8px;
  --space: 16px;
  --control: 40px;
  --hint: #c5d4d3;
}

* { box-sizing: border-box; }

html.view-as { --view-as-offset: 44px; }

html, body { max-width: 100%; }

body {
  margin: 0;
  padding-top: var(--view-as-offset);
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}

h1, h2, h3, h4, .stat, .machine-name {
  font-family: var(--heading);
  font-weight: 600;
}

h1:not(.sr-only), h2, h3 {
  scroll-margin-top: calc(76px + var(--view-as-offset));
}

h1:not(.sr-only) {
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 4px 0 16px;
}

h4 {
  font-size: 15px;
  line-height: 1.3;
  margin: 20px 0 8px;
  color: var(--text);
}

.view-as-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  min-height: var(--view-as-offset);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--warn);
  color: #1a1404;
  font-size: 14px;
  padding: 8px 16px;
}

.view-as-banner .ghost { color: #1a1404; border-color: #1a1404; }

a { color: var(--link); text-decoration-color: var(--link); }
a:hover { text-decoration: underline; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button, .button {
  background: var(--teal);
  color: var(--text);
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

button.ghost, a.ghost {
  background: transparent;
  border: 1px solid var(--card-border);
}

/* Three button styles: primary (teal fill, the default), secondary (.ghost outline)
   and destructive (.danger, only for Revoke, Delete and Remove). */
button.ghost, a.ghost, a.ghost:visited { color: var(--text); }
a.ghost:hover { text-decoration: none; border-color: var(--muted); }
/* A link styled as a secondary button: no underline, same 40px box as a ghost button. */
a.ghost, a.ghost:visited, a.ghost:hover, a.ghost:focus-visible {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 12px;
  box-sizing: border-box;
}

button.danger, button.outline-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

button.nav-link, button.text-button, button.token-pill, button.icon-copy {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 0;
}

button.nav-link {
  padding: 8px 2px 6px;
  border-bottom: 2px solid transparent;
  font-size: 14px;
}

a.nav-link, a.nav-link:visited {
  display: inline-block;
  padding: 8px 2px 6px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}
a.nav-link:hover, button.nav-link:hover { color: var(--text); text-decoration: none; }

button.nav-link.on, a.nav-link.on, a.nav-link.on:visited {
  color: var(--text);
  border-bottom-color: var(--teal);
}

button.text-button {
  padding: 0;
  color: inherit;
  text-align: left;
}
button.text-button.link { color: var(--link); font-size: inherit; }
button.text-button.link:hover { text-decoration: underline; }

button.icon-copy {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  margin-left: 6px;
  vertical-align: middle;
  color: var(--muted);
  border-radius: 8px;
}
button.icon-copy:hover { color: var(--text); background: #1c2a2e; }

button.token-pill {
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 6px 12px;
}

button:disabled { opacity: 0.5; cursor: default; }

input, select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-control);
  padding: 8px 10px;
  color: var(--text);
}

/* One control height for text inputs, selects and form buttons. */
:where(.wrap) input:where(:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"])),
:where(.wrap) select {
  height: var(--control);
  padding: 0 12px;
}
:where(.wrap) button:where(:not(.nav-link):not(.text-button):not(.token-pill):not(.icon-copy):not(.copy):not(.sort-head)),
:where(.wrap) a.button {
  height: var(--control);
  padding: 0 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%239fb0b0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

label { display: block; margin: 12px 0; }

label span, .field-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}

.stack-label {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin: 0 0 12px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.webhook-fields { align-items: flex-start; }
.webhook-fields .stack-label { flex: 1 1 220px; margin: 0; }
.webhook-fields .hint { margin: 4px 0 0; }

.stack-label > span,
.inline-form > label > span,
.inline-filter > span,
.route-scope > span,
.admin-field > span {
  margin: 0;
}

.switch span:last-child {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 12px var(--space) 64px; }

.topbar, .top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  position: sticky;
  top: var(--view-as-offset);
  z-index: 20;
  background: var(--bg);
  padding: 10px 0 12px;
  margin-bottom: 8px;
}

.wordmark { height: 28px; width: auto; max-width: 100%; display: block; }

/* Desktop: logo, nav and account tools stay one row. The menu button is for narrow screens. */
.nav-toggle { display: none; }
.topbar-main, .topbar-panel { display: contents; }

.nav { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; min-width: 0; }

.top-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
}

.account-cluster {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 32px;
}

.top-tools .ghost,
.top-tools a.ghost,
.top-tools .pill,
.top-tools .token-pill {
  height: 32px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
}

.tool-divider {
  width: 1px;
  height: 20px;
  background: var(--card-border);
  flex: none;
}

.grow { flex: 1; min-width: 0; }

.who {
  color: var(--muted);
  font-size: 14px;
  max-width: 28ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill, .token-pill {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pill {
  font-family: var(--heading);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(159, 176, 176, 0.14);
  color: var(--text);
}
.pill.warn { color: #f0d48a; background: rgba(226, 193, 90, 0.16); }

.token-pill { display: inline-flex; align-items: center; gap: 8px; }
.token-pill .dot { background: var(--teal); }

/* One section rhythm: 32px between sections, 12px from a heading to its content. */
.section, h2.section, h3.section {
  font-family: var(--heading);
  font-weight: 600;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: none;
  color: #eef2f2;
  margin: 32px 0 12px;
  scroll-margin-top: calc(84px + var(--view-as-offset));
}
h4.section, .admin h3.section, .card h4.section {
  font-size: 15px;
  margin: 24px 0 8px;
}

.block { margin-top: 32px; }
.block .section, .home-top .section, .side-col .section { margin-top: 0; }
.card h3 { margin: 0 0 12px; font-size: 16px; }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.sub {
  color: var(--muted);
  font-size: 13px;
  margin: -6px 0 10px;
}

.home-top { margin-top: 8px; }

/* The top row and the machine detail row share one grid layout. */
.home-top, .gpu-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  min-width: 0;
}

@media (min-width: 960px) {
  .home-top, .gpu-layout { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}

.side-col, .stack {
  display: grid;
  gap: 24px;
  align-content: start;
  min-width: 0;
}
.stack > .section { margin-bottom: -12px; }

.settings-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px 32px;
  align-items: start;
}
.settings-card form { margin: 0; }
.settings-card .switch { margin-top: 16px; }
.settings-password .stack-label { margin: 0; width: 100%; max-width: 360px; }
.settings-password input { width: 100%; max-width: 360px; }

.machine-col { min-width: 0; }

/* Overview machine list: one row per machine, columns shared by every row. */
.card.machine-list { padding: 4px 0; }
.machine-head, .machine-row {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.25fr) 116px 36px;
  align-items: center;
  column-gap: 16px;
  padding: 0 18px;
}
.machine-head {
  padding-top: 8px;
  padding-bottom: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.machine-row { margin: 0; padding-top: 12px; padding-bottom: 12px; border-top: 1px solid var(--card-border); }
.m-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.m-main .dot { width: 10px; height: 10px; }
.machine-row .dot.online { background: var(--ok); }
.machine-row .dot.busy, .machine-row .dot.paused { background: var(--warn); }
.machine-row .dot.offline { background: #E5484D; }
.m-text { min-width: 0; }
.m-name { font-family: var(--heading); font-weight: 600; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.os-mark { display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; font-size: 12px; font-weight: 500; vertical-align: middle; }
.os-mark .os-apple { display: block; }
.m-name button.text-button { font-size: inherit; text-align: left; }
.m-sub { margin: 2px 0 0; font-size: 12.5px; overflow-wrap: anywhere; }
.m-state.offline { color: #f08a8d; }
.m-hw { min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.hw-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-load, .hw-pending { color: var(--muted); font-size: 12.5px; }
.hw-pending { font-style: italic; }
.m-share { display: flex; justify-content: flex-start; }
.switch.compact .switch-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.m-menu { display: flex; justify-content: flex-end; }
.row-menu { position: relative; }
.row-menu[open] { z-index: 30; }
.machine-card { position: relative; }
.machine-card:has(.row-menu[open]) { z-index: 4; }
.row-menu summary {
  list-style: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu summary:hover, .row-menu[open] summary { background: #1c2a2e; color: var(--text); }
.row-menu summary:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.row-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  min-width: 150px;
  display: grid;
  padding: 4px;
  background: #0f1a1d;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.wrap .row-menu-list button {
  all: unset;
  box-sizing: border-box;
  display: block;
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.wrap .row-menu-list button:hover, .wrap .row-menu-list button:focus-visible { background: #1c2a2e; }
.wrap .row-menu-list button:focus { outline: none; }
.wrap .row-menu-list button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.wrap .row-menu-list button.danger-item {
  margin-top: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  color: var(--danger);
  font-weight: 600;
  text-align: left;
  justify-content: flex-start;
}
.row-menu-list .menu-sep { height: 1px; margin: 4px 8px; background: var(--card-border); }
.machine-row .share-confirm { grid-column: 1 / -1; margin-top: 10px; }

@media (max-width: 720px) {
  .topbar { align-items: flex-start; row-gap: 8px; }
  .nav { width: 100%; }
  .account-cluster { height: auto; flex-wrap: wrap; max-width: 100%; }
  .tool-divider { display: none; }
  .machine-head { display: none; }
  .machine-row {
    grid-template-columns: minmax(0, 1fr) 40px;
    grid-template-areas: "main menu" "hw hw" "share share";
    row-gap: 8px;
    padding: 12px 14px;
  }
  .machine-list > .machine-row:first-of-type { border-top: 0; }
  .card.machine-list { padding: 0; }
  .m-main { grid-area: main; }
  .m-menu { grid-area: menu; }
  .m-hw { grid-area: hw; padding-left: 22px; }
  .m-share { grid-area: share; padding-left: 22px; }
  .switch.compact .switch-text { position: static; width: auto; height: auto; clip: auto; font-size: 14px; }
}

.main-col { display: flex; flex-direction: column; min-width: 0; }
.main-col > .pair-card { margin: 24px 0 0; }
/* The share note sits right under the machine list it explains. */
.main-col > .share-note { margin: 12px 0 0; }
.share-note p { margin: 8px 0 0; }
.credit-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.credit-stats .stat { margin-bottom: 8px; }


.grid { display: grid; gap: 12px; }
.cards { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
  max-width: 100%;
}

.machine-name { font-size: 16px; line-height: 1.3; margin: 0 0 8px; }
a.agent-link { color: inherit; font-weight: 600; text-decoration: none; }
a.agent-link:hover { text-decoration: underline; }

.name-edit { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: 100%; }
.name-input { width: 16ch; max-width: 100%; font-weight: 600; }
.pencil { color: var(--muted); font-size: 13px; }

.fee-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px 24px; margin: 12px 0 16px; }
.fee-stats .stat { font-size: 28px; margin: 0; }
.fee-stats .field-label { margin: 0 0 4px; }
.referral-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 20px; }
.referral-stats .field-label { font-size: 14px; color: var(--hint); }
.referral-stats .stat { font-size: 32px; }
.fee-pager { justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
th.num, td.num { text-align: right; white-space: nowrap; }

.stat {
  font-size: 40px;
  line-height: 1.05;
  margin: 0 0 12px;
  font-variant-numeric: tabular-nums;
}

.hint { color: var(--hint); font-size: 13px; line-height: 1.45; margin: 4px 0 0; }
.hint.key-hint { margin-bottom: 12px; }
.hint.name-error { flex-basis: 100%; color: var(--danger); margin: 0; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 14px;
}

.status.online { color: var(--ok); }
.status.paused { color: var(--warn); }
.status.offline { color: var(--muted); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--offline); flex: none; }
.dot.online { background: var(--ok); }
.dot.paused, .dot.failed { background: var(--warn); }
.dot.failed { background: var(--danger); }
.dot.offline { background: var(--offline); }

.load { margin-top: 14px; }
.bar {
  height: 8px;
  border-radius: 999px;
  background: #1c2a2e;
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--teal);
  border-radius: inherit;
}

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }
.machine-actions { margin-top: 14px; }
.actions { margin-top: 12px; }
.back { margin: 8px 0 0; }
.crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 0; font-size: 14px; }
.crumb a { font-weight: 600; }
.crumb-sep { color: var(--hint); }

.pair-step .inline-form { margin-top: 4px; }

.table-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--card-border); vertical-align: middle; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.03); }
tbody tr.picked td, tbody tr.picked:hover td { background: #182428; }
td.nowrap, .nowrap { white-space: nowrap; }
.idcell.short { max-width: none; vertical-align: middle; }
tr[data-action="open-user"] { cursor: pointer; }
tr.picked td { background: #182428; }
.idcell {
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
  display: inline-block;
  max-width: 18ch;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}
th {
  font-family: var(--heading);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  vertical-align: bottom;
}

.agents, .activity { list-style: none; margin: 0; padding: 0; }
.agents li, .activity li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--card-border);
  min-width: 0;
}
.agents li:last-child, .activity li:last-child { border-bottom: 0; padding-bottom: 0; }
.agents li:first-child, .activity li:first-child { padding-top: 0; }
.act-memo { margin: 0; font-weight: 400; font-synthesis: none; }
.act-amt {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.banner {
  background: #162226;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-control);
  padding: 12px 14px;
  margin: 0;
}
.banner p { margin: 0 0 8px; }
.banner p:last-child { margin-bottom: 0; }
.banner.error { border-color: var(--danger); }
.banner.warn {
  border-color: rgba(226, 193, 90, 0.5);
  background: rgba(226, 193, 90, 0.08);
}
.banner.warn button { margin-top: 12px; }
.banner.plan-thanks h2 { font-size: 18px; line-height: 1.3; margin: 0 0 6px; }
.banner.plan-thanks a.button,
.banner.plan-thanks a.button:visited,
.banner.plan-thanks a.button:hover {
  color: var(--text);
  text-decoration: none;
  margin-top: 12px;
}

.secret {
  font-family: var(--mono);
  font-size: 13px;
  word-break: break-all;
  background: var(--bg);
  border-radius: 8px;
  padding: 10px;
}

pre.copy {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg);
  border-radius: 8px;
  padding: 10px;
  margin: 8px 0;
  max-width: 100%;
}

.check { display: flex; gap: 8px; align-items: flex-start; }
.check input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  flex: none;
  margin: 2px 0 0;
  padding: 0;
  border: 1.5px solid var(--hint);
  border-radius: 5px;
  background: var(--bg);
  cursor: pointer;
  display: grid;
  place-content: center;
}
.check input::before {
  content: "";
  width: 10px;
  height: 10px;
  background: var(--teal-ink);
  clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 22%, 86% 8%, 38% 72%);
  transform: scale(0);
}
.check input:checked { background: var(--teal); border-color: var(--teal); }
.check input:checked::before { transform: scale(1); }
.check input:focus { outline: none; }
.check input:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* Key permissions as toggle chips. */
fieldset.chips { border: 0; padding: 0; margin: 12px 0; display: flex; flex-wrap: wrap; gap: 8px; }
fieldset.chips legend { padding: 0; margin-bottom: 8px; }
.chip { position: relative; margin: 0; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.chip span {
  display: inline-flex;
  align-items: center;
  height: 32px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}
.chip input:checked + span { background: var(--teal); border-color: var(--teal); color: var(--teal-ink); }
.chip input:focus-visible + span { outline: 2px solid var(--link); outline-offset: 2px; }

.share-confirm {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
}
.share-confirm p { margin: 0 0 4px; font-size: 14px; }
.share-confirm .check { margin: 8px 0 12px; }
.check span {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
}

.switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}
.switch-ui {
  width: 42px;
  height: 24px;
  margin: 0;
  border-radius: 999px;
  background: #243033;
  position: relative;
  flex: none;
}
.switch-ui::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text);
  position: absolute;
  top: 3px;
  left: 3px;
}
.switch input:checked + .switch-ui { background: var(--teal); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--link); outline-offset: 2px; }
.switch.large { gap: 12px; font-size: 16px; font-weight: 600; }
.switch.large .switch-ui { width: 64px; height: 36px; }
.switch.large .switch-ui::after { width: 28px; height: 28px; top: 4px; left: 4px; }
.switch.large input:checked + .switch-ui::after { transform: translateX(28px); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  background: #141b1b;
  color: #eef2f2;
  border: 1px solid #2a3a3a;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.status-pill.online { color: #8ef0c0; background: rgba(61, 220, 151, 0.16); }
.status-pill.paused { color: #f0d48a; background: rgba(226, 193, 90, 0.16); }
.status-pill.offline { color: var(--muted); background: rgba(159, 176, 176, 0.12); }

.scope-pill {
  display: inline-block;
  margin: 0 6px 6px 0;
  padding: 2px 8px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  font-size: 13px;
}

.revoked { margin-top: 12px; color: var(--muted); }
.revoked summary { cursor: pointer; }
.revoked .agents { opacity: 0.72; }

.disclosure { margin: 0 0 16px; }
.disclosure summary { cursor: pointer; color: var(--link); }
.disclosure p { font-size: 14px; max-width: 68ch; }

code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--bg);
  border-radius: 4px;
  padding: 1px 6px;
}

.overflow { margin-top: 12px; }
.overflow summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.overflow button { margin-top: 8px; }
.reason { display: block; }
.agent { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.agent-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22ch; }
.agent-tile {
  --tile: 159, 176, 176;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(var(--tile), 0.14);
  box-shadow: inset 0 0 0 1px rgba(var(--tile), 0.28);
}
.agent-tile.agent-grok-bot { --tile: 232, 236, 233; }
.agent-tile.agent-cursor { --tile: 111, 224, 160; }
.agent-tile.agent-claude { --tile: 232, 121, 79; }
.agent-tile.agent-chatgpt { --tile: 95, 212, 176; }
.agent-tile.agent-copilot { --tile: 168, 155, 255; }
.agent-tile.agent-other { --tile: 159, 176, 176; background: rgba(159, 176, 176, 0.08); }
.agent-mark {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  flex: none;
  display: block;
  object-fit: contain;
}
.job-row { cursor: pointer; }
.jobs-table th { white-space: nowrap; }
.jobs-table td { vertical-align: middle; }
.jobs-table td button.ghost,
.stack-table td button.ghost,
.stack-table td a.ghost {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
}
.jobs-table td button { white-space: nowrap; }
.jobs-table td.agent-col { padding-top: 6px; padding-bottom: 6px; }
.prompt-panel {
  max-height: 220px;
  overflow: auto;
  background: var(--bg);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0 0 8px;
}
.prompt-panel pre.copy { margin: 4px 0 10px; }
tr.prompt-row td { padding-top: 0; text-align: left; }
.inline-filter {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin: 0 0 16px;
  max-width: 240px;
}
.pager { margin-top: 12px; }
.activity-link { margin: 8px 0 0; }
button.copy { padding: 2px 8px; font-size: 13px; }

.auth { max-width: 420px; margin: 10vh auto; padding: 24px; }
.auth h1 { font-size: 22px; margin: 16px 0; }

.models { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.model-group + .model-group { margin-top: 14px; }

@media (max-width: 720px) {
  .stack-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .stack-table, .stack-table tbody, .stack-table tr, .stack-table td { display: block; width: 100%; }
  .stack-table tr { padding: 10px 0; border-bottom: 1px solid var(--card-border); }
  .stack-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    border: 0;
    padding: 3px 0;
    text-align: right;
  }
  .stack-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: left;
    flex: none;
  }
  .stack-table td[data-label=""]::before { content: none; }
  .stack-table tr.prompt-row td { display: block; text-align: left; }
  .stack-table td button { flex: none; }
}

@media (max-width: 640px) {
  .wrap { padding: 8px 12px 48px; }
  .top-tools { margin-left: 0; width: 100%; }
  .who { max-width: 100%; }
  .wordmark { height: 22px; }
  .stat { font-size: 32px; }
  .auth { margin: 24px 12px; padding: 16px; }
  h1:not(.sr-only) { font-size: 24px; }
  .card { padding: 16px; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form > label,
  .inline-form > label.field-sm,
  .inline-form > label.field-grow { flex-basis: auto; width: 100%; min-width: 0; }
  .inline-form > button { width: 100%; }
  .row-list li { align-items: flex-start; flex-wrap: wrap; }
  .row-actions { width: 100%; justify-content: flex-start; }
  .groups-card { gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .switch-ui::after { transition: none; }
}

/* Auth pages. The dashboard keeps #016769. These screens use the lighter link color. */
html.auth-page {
  --bg: #0e1212;
  --text: #eef2f2;
  --card: #141b1b;
  --card-border: #2a3a3a;
  --link: #3fa3a5;
  --auth-hint: #d5e0de;
}

html.auth-page body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: var(--bg);
  color: var(--text);
  font-family: "Poppins", "Segoe UI", system-ui, sans-serif;
  font-weight: 400;
}

html.auth-page #app { width: min(400px, 100%); }

html.auth-page .auth {
  width: 100%;
  max-width: 400px;
  margin: 0;
  padding: 32px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
}

html.auth-page .wordmark {
  width: 140px;
  height: auto;
}

html.auth-page .auth h1 {
  font-family: "Poppins", "Segoe UI", system-ui, sans-serif;
  font-weight: 500;
  font-size: 24px;
  line-height: 1.25;
  margin: 20px 0;
}

html.auth-page a {
  color: var(--link);
  font-size: 14px;
  text-decoration: none;
}

html.auth-page a:hover { text-decoration: underline; }

html.auth-page .auth label,
html.auth-page .auth button,
html.auth-page .auth input {
  font-family: "Poppins", "Segoe UI", system-ui, sans-serif;
}

html.auth-page .field { margin: 0 0 16px; }

html.auth-page .field label {
  display: block;
  margin: 0 0 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

html.auth-page .auth input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
  height: 42px;
  border: 1px solid #2a3a3a;
  border-radius: 8px;
  padding: 10px 12px;
  background: #0e1212;
}

html.auth-page .auth input:not([type="checkbox"]):not([type="radio"]):focus {
  outline: 2px solid #3fa3a5;
  outline-offset: 0;
}

html.auth-page .auth input.code {
  text-align: center;
  letter-spacing: 0.35em;
  font-size: 20px;
  font-weight: 500;
}

html.auth-page .password-row { position: relative; }

html.auth-page .password-row input { padding-right: 72px; }

html.auth-page button.text-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: auto;
  height: auto;
  margin: 0;
  padding: 4px 8px;
  background: transparent;
  color: var(--link);
  border: 0;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
}

html.auth-page button.text-toggle:hover {
  background: transparent;
  text-decoration: underline;
}

html.auth-page .auth button[type="submit"],
html.auth-page a.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
}

html.auth-page .auth button[type="submit"]:not(.ghost),
html.auth-page a.button {
  background: var(--teal);
  color: var(--text);
  border: 0;
}

html.auth-page .auth button[type="submit"]:not(.ghost):hover,
html.auth-page a.button:hover {
  background: #018385;
  text-decoration: none;
}

html.auth-page .auth button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid #2a3a3a;
}

html.auth-page .auth button.ghost:hover { background: transparent; }

html.auth-page .auth button:focus-visible,
html.auth-page .auth a:focus-visible,
html.auth-page a.button:focus-visible {
  outline: 2px solid #3fa3a5;
  outline-offset: 2px;
}

html.auth-page .auth button:disabled {
  opacity: 0.5;
  cursor: default;
}

html.auth-page .hint,
html.auth-page .intro {
  color: var(--auth-hint);
  font-size: 14px;
  line-height: 1.45;
}

html.auth-page .intro { margin: 0 0 16px; }

html.auth-page .field .hint { margin: 6px 0 0; }

html.auth-page .field-extra {
  margin: 6px 0 0;
  text-align: right;
}

html.auth-page .auth-foot {
  margin: 16px 0 0;
  text-align: center;
}

html.auth-page .banner.error {
  color: #e07a6a;
  border-color: #e07a6a;
  background: transparent;
}

html.auth-page .divider {
  border: 0;
  border-top: 1px solid #2a3a3a;
  margin: 24px 0;
}

html.auth-page .auth form + form { margin-top: 8px; }

.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.pack {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pack .stat { font-size: 24px; margin: 0; }
.pack p { margin: 0; }
.pack button { margin-top: 8px; align-self: flex-start; }

/* Plan first: the current plan, what's included, then monthly and yearly subscribe buttons. */
.plan-lead { border-color: var(--teal); }
.plan-lead .plan-name {
  margin: 0 0 8px;
  font-family: var(--heading);
  font-size: 32px;
  line-height: 1.1;
}
.plan-lead .plan-included { margin: 8px 0 12px; }
.plan-card .plan-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 8px;
}
.plan-card .plan-subscribe {
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.25;
  min-height: 48px;
}
.plan-card .plan-subscribe small { font-size: 13px; font-weight: 400; }
.plan-card > .ghost { width: 100%; margin: 4px 0 8px; }
.plan-card p { margin: 4px 0; }
#where-jobs-run { scroll-margin-top: calc(84px + var(--view-as-offset)); }
.route-card { display: grid; gap: 10px; margin-bottom: 16px; }
.route-card h2 { margin: 0; font-size: 18px; }
.route-card .hint { margin: 0; }
.route-card fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.route-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  cursor: pointer;
}
.route-option:has(input:checked) { border-color: var(--teal); background: rgba(1, 103, 105, 0.18); }
.route-option input {
  width: 16px;
  height: 16px;
  flex: none;
  margin: 2px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--link);
}
.route-option input:focus { outline: none; }
.route-option input:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.route-label { font-weight: 600; }
.route-note { display: block; color: var(--hint); font-size: 13px; font-weight: 400; }
.route-status { margin: 4px 0 0; }
.limit-note { margin: 6px 0 0; }

/* ---- Admin ---- */
.admin .section,
.admin h2.section { scroll-margin-top: calc(var(--admin-chrome, 128px) + var(--view-as-offset) + 8px); }
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.brand-lockup:hover { text-decoration: none; }
.admin-pill {
  height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  color: var(--text);
  border-color: var(--link);
  background: rgba(63, 163, 165, 0.16);
}
.admin-top { row-gap: 8px; }
/* The dashboard top bar does not wrap on a phone. Admin keeps its section nav on the next line. */
@media (max-width: 760px) {
  .topbar.admin-top { flex-wrap: wrap; align-items: center; row-gap: 8px; }
  .topbar.admin-top .admin-links { margin-left: auto; }
}
.admin-links { display: flex; gap: 16px; align-items: center; margin-left: auto; }
.admin-links a.ghost { height: 32px; display: inline-flex; align-items: center; }
.admin-nav {
  flex: 1 0 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0 14px;
  align-items: center;
  margin: 2px 0 0;
  padding: 4px 0 0;
  border-top: 1px solid var(--card-border);
}
.admin .card > .hint:first-child { margin-top: 0; }

/* Labels sit above their input, 16px between groups, buttons spaced apart. */
.admin-form { display: grid; gap: 16px; margin: 16px 0; max-width: 720px; }
.admin-form + .admin-form { margin-top: 24px; }
.admin-field { display: grid; gap: 6px; margin: 0; align-content: start; }
.admin-field > span { margin: 0; color: var(--text); font-size: 13px; font-weight: 500; }
.admin-field > small.hint { margin: 0; }
.admin-grid { display: grid; gap: 16px; align-items: start; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Dark file inputs with a teal outline button. */
.admin input[type="file"] {
  height: auto;
  padding: 6px;
  background: var(--bg);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}
.admin input[type="file"]::file-selector-button {
  margin-right: 12px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--link);
  border-radius: 8px;
  background: transparent;
  color: var(--link);
  font: inherit;
  cursor: pointer;
}
.admin input[type="file"]::file-selector-button:hover { background: rgba(63, 163, 165, 0.12); }

/* Thin dark scrollbars on wide admin tables. */
.admin .table-scroll { scrollbar-width: thin; scrollbar-color: #2c4246 transparent; }
.admin .table-scroll::-webkit-scrollbar { height: 8px; width: 8px; }
.admin .table-scroll::-webkit-scrollbar-track { background: transparent; }
.admin .table-scroll::-webkit-scrollbar-thumb { background: #2c4246; border-radius: 999px; }
.admin .table-scroll::-webkit-scrollbar-thumb:hover { background: #3a5458; }

.admin th, .admin td { padding: 10px 16px 10px 0; }
.admin th:last-child, .admin td:last-child { padding-right: 0; }
.admin td { vertical-align: middle; }
.admin .config-table td, .admin .config-table th { vertical-align: top; }
.admin .audit-table td:last-child { min-width: 160px; }
.admin .audit-table td:nth-child(6) { min-width: 110px; }
.admin td.cell-action { text-align: right; width: 1%; white-space: nowrap; }
.admin td.cell-action button { height: 32px; padding: 0 10px; font-size: 13px; }
.admin td.cell-action button + button { margin-left: 8px; }
.admin .idcell { vertical-align: middle; }

.mono { font-family: var(--mono); font-size: 12px; }
.wrap-any { overflow-wrap: anywhere; word-break: break-word; }
.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  vertical-align: 1px;
}
.tag.ok { color: var(--ok); border-color: rgba(61, 220, 151, 0.4); margin-left: 0; }
.tag.warn { color: var(--warn); border-color: rgba(226, 193, 90, 0.4); margin-left: 0; }
/* Admin badges use a filled pill so status text stays readable on the dark card. */
.admin .tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  margin: 0 6px 0 0;
  padding: 0 8px;
  border: 0;
  background: rgba(159, 176, 176, 0.18);
  color: #e7eeee;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  vertical-align: middle;
}
.admin .tag.ok { color: #8ef0c0; background: rgba(61, 220, 151, 0.2); border: 0; }
.admin .tag.warn { color: #1a1404; background: #f0d48a; border: 0; }
.admin .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.admin .tags .tag { margin: 0; }
.admin .profile-id { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 0; }
.admin .profile-id .idcell { max-width: none; overflow-wrap: anywhere; white-space: normal; }

.value-more summary { cursor: pointer; color: var(--text); overflow-wrap: anywhere; }
.value-more summary::marker { color: var(--muted); }
.value-pre {
  margin: 8px 0 0;
  padding: 10px 12px;
  max-width: 640px;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.key-cell { display: block; }
.key-cell .mono { display: block; margin-top: 2px; }
.admin .key-cell { display: grid; gap: 2px; max-width: 64ch; }
.admin .key-label { color: var(--text); font-weight: 600; }
.admin .key-meta { color: var(--muted); font-size: 13px; line-height: 1.4; }
.admin .config-note { display: block; margin-top: 4px; }
.admin .config-num { white-space: nowrap; }

.admin .job-size-line { display: block; }
.jobs-filter .jobs-search { grid-column: 1 / -1; }
.jobs-table tr.job-error-row td { padding-top: 0; color: #ffb4b6; font-size: 13px; }
.jobs-table tr:has(+ tr.job-error-row) td { border-bottom: none; }
.job-error-label { font-weight: 600; margin-right: 6px; }
.sort-head {
  all: unset;
  cursor: pointer;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  white-space: nowrap;
}
.sort-head:hover, .sort-head:focus-visible { color: var(--text); text-decoration: underline; }
.job-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.job-badge.passed { color: #8ef0c0; background: rgba(61, 220, 151, 0.16); }
.job-badge.failed { color: #ffb4b6; background: rgba(229, 72, 77, 0.18); }
.job-badge.canceled { color: var(--muted); background: rgba(159, 176, 176, 0.12); }
.job-badge.running { color: #9fd0ff; background: rgba(80, 160, 255, 0.16); }
.job-badge.queued { color: #f0d48a; background: rgba(226, 193, 90, 0.16); }
.job-badge.unknown { color: var(--muted); border: 1px dashed var(--card-border); }

/* At desktop width the admin jobs table stays inside the card. Cells wrap instead of a sideways scroll. */
@media (min-width: 1024px) {
  .admin .jobs-fit { overflow-x: clip; }
  .admin .jobs-table { table-layout: fixed; width: 100%; }
  .admin .jobs-table th,
  .admin .jobs-table td {
    white-space: normal;
    overflow-wrap: anywhere;
    padding-right: 8px;
  }
  .admin .jobs-table .sort-head { white-space: normal; }
  .admin .jobs-table .job-size,
  .admin .job-size-line { white-space: nowrap; overflow-wrap: normal; }
  .admin .jobs-table col.c-time { width: 15%; }
  .admin .jobs-table col.c-dur { width: 8%; }
  .admin .jobs-table col.c-user { width: 16%; }
  .admin .jobs-table col.c-machine { width: 8%; }
  .admin .jobs-table col.c-model { width: 11%; }
  .admin .jobs-table col.c-status { width: 11%; }
  .admin .jobs-table col.c-route { width: 10%; }
  .admin .jobs-table col.c-credits { width: 7%; }
  .admin .jobs-table col.c-size { width: 14%; }
}

/* Models on one machine (Details view). */
.machine-models { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--card-border); }
.machine-models h4 { margin: 0 0 10px; font-family: var(--heading); font-size: 15px; font-weight: 600; }
.machine-models h4 .hint { margin-left: 6px; font-weight: 400; }
.model-table td.actions { text-align: right; white-space: nowrap; }
.wrap button.text-button.danger-text { color: var(--danger); font-size: 13px; }
.wrap button.text-button:disabled { opacity: 0.45; cursor: not-allowed; }
.model-add { margin-top: 16px; }
.model-add input[name="model"] { min-width: 0; font-family: var(--mono); }
.model-add .hint { margin: 6px 0 0; }
.model-add label.hf-quant { flex: 0 1 240px; min-width: 180px; }
.inline-form > label.hf-quant[hidden] { display: none; }
.model-add .model-add-result { flex: 1 1 100%; margin: 0; font-size: 13.5px; }
.model-add .model-add-result.failed { color: var(--danger); }
.model-add .model-add-result[hidden] { display: none; }
.model-op { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--card-border); border-radius: 10px; font-size: 13.5px; }
.model-op p { margin: 0; }
.model-op.done { color: var(--ok); }
.model-op.failed { color: var(--danger); }
.model-progress { height: 6px; margin-top: 8px; border-radius: 3px; background: var(--card-border); overflow: hidden; }
.model-progress span { display: block; height: 100%; background: var(--link); transition: width 0.4s ease; }
.m-models { color: var(--muted); }

.m-op { color: var(--link); }

/* Direct Windows download: the first step inside the Add a machine card. */
.download-step { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--card-border); }
.download-step .row.spread { align-items: baseline; margin-bottom: 8px; }
.download-step .field-label { margin: 0; }
.download-step .download-meta { grid-template-columns: max-content minmax(0, 1fr); margin: 10px 0 6px; font-size: 13px; }
.download-step .download-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.download-step .download-button { font-weight: 600; }
.download-step .hint-link { font-size: 13px; }
.download-step .hint { margin: 0; font-size: 13px; }
.download-step .download-again { margin: 0; }
.download-step button.text-button.link { font-size: 13px; }
.pair-step > .field-label { margin: 0 0 4px; }
.pair-step > .hint { margin: 0 0 10px; }
.hint-inline { color: var(--muted); font-size: 13px; }
table.download-counts { margin-top: 4px; }

.agent-type { margin-left: 6px; font-size: 11.5px; font-weight: 500; vertical-align: 2px; }
.anchor-alias, .card[id] { scroll-margin-top: calc(84px + var(--view-as-offset)); }

.help-fold { margin: 4px 0 0; max-width: 720px; }
.help-fold > summary { cursor: pointer; color: var(--link); font-size: 13px; }
.help-fold[open] > summary { margin-bottom: 4px; }

/* Shared form and list rhythm. Gaps stay on the 8 / 12 / 16 / 24 scale.
   .inline-form: labels above fields, fields and buttons 40px, aligned on the bottom edge.
   .stack-form: the same fields stacked. .row-list: a bullet-free row, actions on the right.
   .btn-sm: the row action size. .fold: a disclosure row. */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin: 0;
  width: 100%;
}
.inline-form > label {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  margin: 0;
  min-width: 0;
  flex: 1 1 180px;
}
.inline-form > label.field-sm { flex: 0 1 168px; min-width: 140px; }
.inline-form > label.field-grow { flex: 1 1 240px; }
.inline-form > button { flex: none; margin: 0; }
.inline-form > h3,
.inline-form > h4,
.inline-form > .hint,
.inline-form > p { flex: 1 1 100%; margin: 0; }
.stack-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  max-width: 480px;
}
.stack-form > .stack-label,
.stack-form > .hint,
.stack-form > fieldset,
.stack-form > .check,
.stack-form > .inline-form { width: 100%; margin: 0; }
.stack-form > h3,
.stack-form > button { margin: 0; }
.stack-form > .inline-form { max-width: none; }
button.btn-sm, a.btn-sm {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  line-height: 1;
  border-radius: var(--radius-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.row-list, .plain-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.row-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--card-border);
}
.row-list li:first-child { padding-top: 0; }
.row-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.row-main { min-width: 0; flex: 1; }
.row-title { font-weight: 600; }
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  flex: none;
}
.row-list .hint { margin: 0; }
.note-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--hint);
  font-size: 13px;
  line-height: 1.45;
}
.note-list li { margin: 0; }
.plain-list li { padding: 6px 0; }
.empty {
  margin: 0;
  padding: 14px 16px;
  border: 1px dashed var(--card-border);
  border-radius: var(--radius-control);
  color: var(--hint);
  background: rgba(11, 18, 20, 0.35);
  font-size: 14px;
  line-height: 1.45;
}
.callout {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-control);
  background: rgba(11, 18, 20, 0.45);
  color: var(--hint);
  font-size: 14px;
  line-height: 1.45;
}
.secret-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-control);
}
.secret-block p { flex: 1 1 100%; margin: 0; }
.secret-block code { flex: 1 1 auto; }
.secret-block button { flex: none; }
.route-scope {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin: 8px 0 0;
  max-width: 280px;
}
.route-scope > span { color: var(--muted); font-size: 13px; font-weight: 500; }
.fold > summary,
.disclosure > summary,
.revoked > summary,
.group-create > summary {
  cursor: pointer;
  padding: 12px 0;
}
.fold > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  font-family: var(--heading);
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::marker { content: ""; }
.fold > summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid var(--muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  flex: none;
}
.fold[open] > summary::before { transform: rotate(90deg); }
.fold > :not(summary) { margin: 0 0 12px; }
.fold > :last-child { margin-bottom: 4px; }
.groups-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.groups-card > * { margin-top: 0; margin-bottom: 0; }
.group-list { display: flex; flex-direction: column; }
.group-row { padding: 16px 0; border-top: 1px solid var(--card-border); }
.group-row:first-child { border-top: 0; padding-top: 0; }
.group-row:last-child { padding-bottom: 0; }
.group-row .row.spread { align-items: center; gap: 16px; }
.group-row .machine-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
}
.group-row .hint { margin: 0; }
.group-detail {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--card-border);
}
.group-detail .inline-form { max-width: 640px; }
.detail-block { display: flex; flex-direction: column; gap: 8px; }
.detail-block > h4,
.detail-block > .hint,
.detail-block > .inline-form,
.group-detail > .hint,
.group-detail > .banner,
.group-detail > .fold,
.group-detail > .ghost { margin: 0; }
.group-detail > .fold {
  border-top: 1px solid var(--card-border);
  border-bottom: 1px solid var(--card-border);
}
.group-detail > .fold + .fold { border-top: 0; margin-top: -24px; }
.group-join h3 { margin: 0; }
.groups-card > .group-join {
  margin-top: 0;
  padding: 16px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: rgba(11, 18, 20, 0.35);
}
.group-identity { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.group-identity .machine-name { margin: 0; }
.group-identity .hint { margin: 0; }
.danger-zone {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 16px;
  border: 1px solid rgba(224, 122, 106, 0.45);
  border-radius: 12px;
  background: rgba(224, 122, 106, 0.06);
}
.danger-zone h4 { margin: 0; color: var(--danger); font-size: 15px; }
.danger-zone .hint, .danger-zone .row { margin: 0; }
.group-meta { margin-top: 6px; }
.activity-zero { margin: 0 0 14px; }
.activity-note { margin: 8px 0 16px; }
.activity-own { margin: 0 0 12px; }
.page-stack { display: flex; flex-direction: column; gap: 24px; }
.page-stack > .card > h2.section:first-child { margin-top: 0; }
.referral-list { margin-top: 16px; overflow-x: auto; }
.referral-list table { margin: 0; }
.referral-list th, .referral-list td { padding-left: 0; }
.referral-list th:last-child, .referral-list td:last-child { padding-right: 0; }
.referral-list .empty { margin-top: 4px; }
.who-cell { display: grid; gap: 2px; min-width: 0; }
.who-cell .hint { margin: 0; }
.admin-group-detail {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--bg);
}
.admin-group-detail > h3.section:first-child { margin-top: 0; }
.overflow-setting {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
}
.overflow-setting .hint { margin: 0; max-width: 68ch; }
.groups-card .overflow-setting {
  padding-top: 16px;
  border-top: 1px solid var(--card-border);
}
.group-share {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--card-border);
}
.group-share h4,
.group-share .hint,
.group-share .check { margin: 0; }
.group-share h4 { font-size: 15px; }
.agents li > button, .agents li > .row { flex: none; align-self: center; }
.form-actions.align-end { align-self: end; margin: 0; }
.jobs-filter .form-actions { grid-column: 1 / -1; }
.stack-form > .share-confirm { margin: 0; width: 100%; }

/* Dashboard Groups: Create a group. Room between the fields, the checkbox and the button. */
.group-create { margin: 0; }
.group-create > form { margin: 4px 0 8px; max-width: 480px; }
.group-create .stack-label,
.group-create .check { margin: 0; }

/* Pressed look for every button and button-style link: slight darken, a 1px nudge
   and an inset shadow while held down. .is-pressed keeps that look (and the button
   disabled) while its request is in flight; see withPressed() in app.js. Focus rings stay. */
button, a.button, a.ghost { transition: filter 80ms ease, box-shadow 80ms ease, transform 80ms ease; }
button:not(:disabled):active,
button.is-pressed,
a.button:active,
a.ghost:active {
  filter: brightness(0.85);
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35);
}
/* Outline and text-style buttons have no fill to darken, so they get a faint one. */
button.ghost:not(:disabled):active, button.ghost.is-pressed,
button.danger:not(:disabled):active, button.danger.is-pressed,
button.outline-danger:not(:disabled):active, button.outline-danger.is-pressed,
button.token-pill:not(:disabled):active, button.token-pill.is-pressed,
a.ghost:active,
.wrap .row-menu-list button:not(:disabled):active, .wrap .row-menu-list button.is-pressed {
  background: rgba(255, 255, 255, 0.07);
}
button.nav-link:not(:disabled):active, button.nav-link.is-pressed,
button.text-button:not(:disabled):active, button.text-button.is-pressed,
button.icon-copy:not(:disabled):active, button.icon-copy.is-pressed {
  box-shadow: none;
  filter: brightness(0.75);
}
/* In flight: pressed, not faded like a normal disabled button. */
button.is-pressed:disabled,
html.auth-page .auth button.is-pressed:disabled,
.wrap button.text-button.is-pressed:disabled { opacity: 0.85; cursor: progress; }
/* The password Show/Hide toggle is centred with a transform; keep it centred. */
html.auth-page button.text-toggle:not(:disabled):active,
html.auth-page button.text-toggle.is-pressed { transform: translateY(calc(-50% + 1px)); box-shadow: none; }
@media (prefers-reduced-motion: reduce) {
  button, a.button, a.ghost { transition: none; }
}

@media (max-width: 760px) {
  .topbar { flex-wrap: nowrap; align-items: center; justify-content: space-between; padding: 8px 0; }
  .account-menu { display: none; }
  .side-nav { display: none; }
  .app-frame { display: block; }
  .wordmark { height: 22px; }
  .wrap { padding-bottom: 88px; }
  .admin .wrap { padding-bottom: 24px; }
  .tabbar { display: flex; }
  /* Admin keeps its own menu. The signed-in app uses the bottom tabs instead. */
  .admin .nav-toggle { display: inline-flex; height: 36px; padding: 0 12px; }
  .admin .topbar-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
  }
  .admin .topbar-panel { display: none; }
  .admin .topbar.menu-open .topbar-panel {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 25;
    max-height: min(70vh, 520px);
    overflow: auto;
    padding: 8px 0 14px;
    background: var(--bg);
    border-bottom: 1px solid var(--card-border);
  }
  .admin .topbar.menu-open .admin-links,
  .admin .topbar.menu-open .admin-nav {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    margin-left: 0;
    gap: 2px;
  }
  .admin .topbar.menu-open .admin-nav {
    flex: none;
    align-items: stretch;
    margin: 0;
    padding: 8px 0 0;
    border-top: 1px solid var(--card-border);
  }
  .admin .topbar.menu-open .admin-nav .nav-link,
  .admin .topbar.menu-open .admin-links .nav-link { width: 100%; text-align: left; padding: 8px 2px; }
}

.job-card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-control);
  padding: 12px 14px;
  background: var(--bg);
}
.job-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.job-card-model { margin: 8px 0 0; font-family: var(--heading); font-weight: 600; }
.job-card-meta { margin: 4px 0 0; }
.job-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.job-card-actions:empty { display: none; }
.job-card .prompt-panel { margin-top: 10px; }
.job-cards { display: none; }

@media (max-width: 720px) {
  .jobs-desktop { display: none; }
  .job-cards { display: grid; gap: 10px; }
  .model-table td.actions { flex-direction: column; align-items: stretch; }
  .model-table td.actions .danger { width: 100%; }
  .referral-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Signed-in app: sidebar on wide screens, bottom tabs on a phone. */
.app-frame {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: calc(72px + var(--view-as-offset));
  min-height: calc(100vh - 140px - var(--view-as-offset));
  padding-bottom: 12px;
}
.side-nav .nav-link { padding: 8px 10px; border-radius: 8px; border-bottom: 0; }
.side-nav .nav-link.on { background: rgba(1, 103, 105, 0.35); }
.side-nav .menu-sep { height: 1px; margin: 8px 10px; background: var(--card-border); }
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.page-head h1 { margin: 0; }
.page-count { margin: 4px 0 0; }
.cloud-models-card { margin-bottom: 16px; }
.cloud-models-card h2 { margin: 0 0 12px; font-size: 18px; }
.cloud-model-list { display: grid; gap: 12px; }
@media (min-width: 800px) {
  .cloud-model-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.cloud-model { min-width: 0; }
.cloud-model-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.cloud-model-name strong { font-size: 16px; }
.machine-grid, .group-grid { display: grid; gap: 16px; }
@media (min-width: 800px) {
  .machine-grid, .group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.machine-card-top, .machine-card-actions, .machine-detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.machine-card-top .m-text { flex: 1; min-width: 0; }
.machine-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  margin: 8px 0;
}
.machine-card-link:hover { text-decoration: none; }
.machine-card-actions { flex-wrap: wrap; justify-content: space-between; }
.agent-card-top { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; min-width: 0; }
.agent-card-top .m-text { flex: 1; min-width: 0; }
.agent-card .creds { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--card-border); }
.agent-card .cred { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.agent-card .cred > span, .agent-card .cred > .grow { flex: 1 1 12rem; min-width: 0; }
.agent-card .machine-card-actions { margin-top: 12px; }
.agent-card .route-scope { max-width: none; width: min(100%, 280px); }
.agent-card .hint, .agent-card .cred, .agent-page .mono { overflow-wrap: anywhere; }
.unread-pill { color: #d7f4f1; background: rgba(63, 163, 165, 0.22); }
.share-inline { margin: 0; }
.onboard { width: 100%; }
.danger-zone { border-color: var(--danger); }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.addr-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.agent-page form { display: flex; flex-direction: column; gap: 24px; }
.agent-page .page-head { margin-bottom: 0; }
.agent-page .agent-who,
.agent-page .agent-intents { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; width: 100%; }
.agent-page .agent-intents { margin-top: 4px; }
.agent-detail-head { align-items: center; }
.save-bar {
  position: sticky;
  bottom: 16px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
}
.save-bar[hidden] { display: none; }
.save-bar .hint { flex: 1 1 100%; margin: 0; }
.msg-agent .stack-form + .stack-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--card-border); }
.account-menu { position: relative; }
.account-menu > summary {
  list-style: none;
  cursor: pointer;
  max-width: 28ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 220px;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  display: grid;
  gap: 8px;
}
.account-menu-list a { text-decoration: none; }
.token-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(1, 103, 105, 0.35);
  color: var(--text);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.token-pill:hover { text-decoration: none; }
.tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: var(--card);
  border-top: 1px solid var(--card-border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  justify-content: space-around;
  gap: 4px;
}
.tabbar .tab {
  flex: 1;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
  text-decoration: none;
  font-size: 12px;
}
.tabbar .tab.on { color: var(--text); background: rgba(1, 103, 105, 0.45); }
.sheet-back {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0, 0, 0, 0.45);
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 46;
  background: var(--card);
  border-top: 1px solid var(--card-border);
  border-radius: 16px 16px 0 0;
  padding: 12px 16px calc(20px + env(safe-area-inset-bottom));
  display: grid;
  gap: 4px;
}
.sheet a {
  display: block;
  padding: 12px 4px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--card-border);
}
.modal-back {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.55);
}
.modal {
  position: fixed;
  z-index: 51;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-height: min(86vh, 720px);
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 16px;
}
.verify-download { margin-top: 8px; }
.verify-download summary { cursor: pointer; color: var(--link); font-size: 14px; }
.job-filters { gap: 12px; margin-bottom: 12px; align-items: flex-end; }
@media (max-width: 760px) {
  h1, h2, h3 { scroll-margin-top: calc(64px + var(--view-as-offset)); }
  .modal { top: auto; bottom: 0; left: 0; transform: none; width: 100%; max-height: 88vh; border-radius: 16px 16px 0 0; }
}

/* Desktop sidebar rules above this file's earlier phone query. Restate the
   phone layout last so a viewport under 768px hides the sidebar and shows
   the bottom tabs, with nothing clipped off the side. */
@media (max-width: 767px) {
  .side-nav { display: none; }
  .app-frame { display: block; }
  .tabbar { display: flex; }
  .account-menu { display: none; }
  .wrap { padding-bottom: 88px; overflow-x: clip; }
  .admin .wrap { padding-bottom: 24px; }
  .app-main { min-width: 0; }
  .page-head { flex-wrap: wrap; }
  .page-head > button,
  .page-head > a.button { flex: none; }
  .agent-page { padding-bottom: 76px; }
  .agent-detail-head { flex-direction: column; align-items: stretch; }
  .agent-detail-head .switch.large { width: 100%; justify-content: space-between; }
  .agent-page .stack-form { max-width: none; width: 100%; }
  .agent-page .stack-label,
  .agent-page input[type="text"],
  .agent-page .route-option,
  .agent-page .check,
  .agent-page .addr-line { width: 100%; }
  .agent-page .addr-line { align-items: stretch; flex-direction: column; }
  .agent-page .addr-line .ghost,
  .agent-page .save-bar button { width: 100%; }
  .agent-page .save-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(64px + env(safe-area-inset-bottom));
    z-index: 35;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    margin: 0;
  }
}

/* Mailbox. Read-only group chat. New rows slide in; nothing toasts.
   Phase 2 owner sends land in [data-chat-compose] and use .chat-row.is-you. */
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chat-page .page-head { flex-wrap: wrap; align-items: flex-end; }
.chat-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; }
.chat-heading > h1,
.chat-heading > .section { margin: 0; }
.chat-heading > .btn-sm { flex: none; }
.chat-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; flex: 1 1 280px; justify-content: flex-end; }
.chat-tools .inline-filter { margin: 0; flex: 1 1 9rem; max-width: 16rem; min-width: 0; }
.chat-tools .check { margin: 0; padding-bottom: 8px; }
.chat-card { display: flex; flex-direction: column; gap: 12px; }
.chat-card .chat-tools { justify-content: flex-start; }
.agent-page > .chat-card { margin-top: 24px; }
.chat-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.chat-card-head .section { margin: 0; }
.chat-room { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.chat-room-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.chat-room-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; min-width: 0; }
.chat-room-title {
  margin: 0;
  font-family: var(--heading);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.chat-room-heading .hint { margin: 0; }
.chat-polls { display: grid; gap: 2px; }
.chat-poll { margin: 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.chat-stage {
  position: relative;
  height: min(640px, calc(100dvh - 360px));
  min-height: 280px;
  display: flex;
  flex-direction: column;
}
.chat-scroll {
  overflow: auto;
  min-height: 0;
  flex: 1;
  padding: 4px 2px 12px;
}
.chat-row { display: flex; justify-content: flex-start; }
.chat-row + .chat-row { margin-top: 10px; }
.chat-row.is-you { justify-content: flex-end; }
.chat-bubble {
  max-width: min(36rem, 92%);
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  text-align: left;
  white-space: normal;
  font-size: 14px;
  line-height: 1.45;
  background: rgba(11, 18, 20, 0.55);
  color: inherit;
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--who, var(--teal));
  border-radius: 12px;
  padding: 10px 12px;
}
button.chat-bubble { cursor: pointer; }
button.chat-bubble:hover { background: rgba(255, 255, 255, 0.03); }
.chat-row.is-you .chat-bubble {
  border-left-width: 1px;
  border-left-color: var(--card-border);
  border-right: 3px solid var(--who, var(--link));
}
.chat-name {
  color: var(--who, var(--text));
  font-family: var(--heading);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.chat-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-tag {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  background: rgba(159, 176, 176, 0.12);
  border-radius: 999px;
  padding: 2px 8px;
  overflow-wrap: anywhere;
}
.chat-bubble.is-unread .chat-state { font-weight: 600; color: var(--text); }
.chat-body { display: block; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.chat-body.is-clamped {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 12;
  overflow: hidden;
}
.chat-bubble .btn-sm { align-self: flex-start; margin-top: 4px; }
.chat-files { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 4px; }
.chat-file { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.chat-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.chat-state { display: inline-flex; align-items: center; gap: 6px; }
.dot.unread { background: var(--teal); }
button.chat-jump {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 2;
  height: 32px;
  width: auto;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}
button.chat-jump[hidden],
[data-chat-compose][hidden] { display: none; }
button.chat-jump:not(:disabled):active,
button.chat-jump.is-pressed {
  transform: translateX(-50%) translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35);
}
@keyframes chat-arrive {
  from { transform: translateY(8px); background: rgba(63, 163, 165, 0.28); }
  to { transform: none; background: rgba(11, 18, 20, 0.55); }
}
.chat-row.is-new .chat-bubble { animation: chat-arrive 1.1s ease; }
.chat-card .chat-stage { height: 420px; min-height: 280px; }
@media (max-width: 767px) {
  .wrap:has(.chat-page) {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }
  .wrap:has(.chat-page) .app-frame,
  .wrap:has(.chat-page) .app-main,
  .chat-page,
  .chat-page [data-chat-body],
  .chat-page .chat-room {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .chat-page .crumb,
  .chat-page .page-head,
  .chat-page .chat-tools,
  .chat-page .chat-polls,
  .chat-page .chat-room-bar,
  .chat-page .hint { flex: none; }
  .chat-page .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 8px;
  }
  .chat-page .chat-tools { justify-content: flex-start; width: 100%; }
  .chat-page .chat-tools .inline-filter { flex: 1 1 8rem; max-width: none; }
  .chat-page .chat-tools .check { flex: 0 0 auto; padding-bottom: 0; }
  .chat-page .chat-stage {
    flex: 1;
    height: auto;
    min-height: 0;
  }
  .chat-card .chat-stage { height: 360px; flex: none; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-row.is-new .chat-bubble { animation: none; background: rgba(63, 163, 165, 0.16); }
}
