/*
 * Agent Center UI - one stylesheet, no external resources.
 * Mobile first (the Owner mostly uses a phone or a tablet); light and dark via prefers-color-scheme.
 * Status colours are never the only signal: every badge also carries a symbol and a word.
 */
:root {
  color-scheme: light dark;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #18202c;
  --muted: #566176;
  --border: #dbe1ea;
  --border-strong: #b4bfcd;
  --accent: #1f4fc0;
  --on-accent: #ffffff;
  --focus: #f59e0b;
  --input-bg: #ffffff;
  --code-bg: #eef1f6;
  --ok: #1a7f45;
  --ok-bg: #e3f4ea;
  --warn: #a15c00;
  --warn-bg: #fdf0d8;
  --bad: #b42318;
  --bad-bg: #fde7e4;
  --on-bad: #ffffff;
  --info: #1f4fc0;
  --info-bg: #e6edfb;
  --neutral-bg: #e9edf3;
  --unknown: #6b4fa3;
  --unknown-bg: #efe9fa;
  --bar-bg: #e4e8ef;
  --bar-used: #5d6b82;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f131a;
    --surface: #181e28;
    --surface-2: #1e2531;
    --text: #e7ebf2;
    --muted: #9aa6b8;
    --border: #2b3443;
    --border-strong: #46536a;
    --accent: #7ea6ff;
    --on-accent: #0b1220;
    --focus: #fbbf24;
    --input-bg: #121821;
    --code-bg: #111722;
    --ok: #5fd08a;
    --ok-bg: #14301f;
    --warn: #f2b84b;
    --warn-bg: #3a2a08;
    --bad: #ff8a80;
    --bad-bg: #3d1512;
    --on-bad: #2a0a08;
    --info: #7ea6ff;
    --info-bg: #15233f;
    --neutral-bg: #262f3d;
    --unknown: #c3a8f5;
    --unknown-bg: #2a2140;
    --bar-bg: #2a3342;
    --bar-used: #8391a8;
  }
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font: 16px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-wrap: anywhere;
}
[hidden] {
  display: none !important;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
h1 {
  font-size: 1.35rem;
  margin: 0;
  overflow-wrap: anywhere;
}
h2 {
  font-size: 1.05rem;
  margin: 0;
}
h3 {
  font-size: 0.95rem;
  margin: 14px 0 6px;
}
h4 {
  font-size: 0.9rem;
  margin: 12px 0 4px;
  color: var(--muted);
}
p {
  margin: 6px 0;
  overflow-wrap: anywhere;
}
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 1px 4px;
  border-radius: 4px;
}
blockquote {
  margin: 6px 0;
  padding: 6px 10px;
  border-left: 3px solid var(--border-strong);
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ── shell ─────────────────────────────────────────────────────────────────────── */
.banner-dev {
  position: sticky;
  top: 0;
  z-index: 30;
  background: repeating-linear-gradient(45deg, #b45309, #b45309 14px, #92400e 14px, #92400e 28px);
  color: #fff;
  text-align: center;
  font-weight: 700;
  padding: 6px 10px;
  letter-spacing: 0.02em;
}
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.user {
  color: var(--muted);
  font-size: 0.85rem;
  max-width: 38vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.locale-switch {
  min-height: 40px;
  padding: 2px 6px;
}
.nav {
  order: 3;
  flex-basis: 100%;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 2px;
}
.nav-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--text);
  white-space: nowrap;
}
.nav-link:hover {
  background: var(--neutral-bg);
  text-decoration: none;
}
.nav-link.active {
  background: var(--accent);
  color: var(--on-accent);
}
.nav-count {
  background: var(--bad);
  color: var(--on-bad);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 1.5em;
  padding: 0 0.4em;
  text-align: center;
}
main {
  padding: 12px;
  max-width: 1200px;
  margin: 0 auto;
  outline: none;
}
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 16px;
}
.stale {
  background: var(--warn-bg);
  text-align: center;
  padding: 6px;
  margin: 0;
  font-size: 0.9rem;
}
.loading,
.boot {
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

/* ── layout blocks ─────────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 12px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  min-width: 0;
}
.card-attention {
  border-color: var(--warn);
  box-shadow: inset 4px 0 0 var(--warn);
}
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.count {
  display: inline-block;
  margin-left: 8px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--neutral-bg);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 12px;
}
.section-host {
  min-width: 0;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 10px;
}
.stack > * {
  margin-bottom: 12px;
}
.row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px 10px;
}
.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.actions.wrap {
  flex-wrap: wrap;
  margin: 10px 0;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}
.empty {
  color: var(--muted);
  font-style: italic;
}
.title-link {
  display: inline-block;
  padding: 6px 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list > li {
  padding: 8px 0;
  border-top: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.list > li:first-child {
  border-top: 0;
}
.kv {
  display: grid;
  grid-template-columns: minmax(96px, max-content) minmax(0, 1fr);
  gap: 4px 12px;
  margin: 8px 0;
}
.kv dt {
  color: var(--muted);
}
.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.table-wrap {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}
th,
td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

/* ── badges: tone + symbol + word ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 600;
  max-width: 100%;
  white-space: normal;
  background: var(--neutral-bg);
  color: var(--text);
}
.badge[data-tone='ok'] {
  background: var(--ok-bg);
  color: var(--ok);
}
.badge[data-tone='ok']::before {
  content: '✓';
}
.badge[data-tone='warn'] {
  background: var(--warn-bg);
  color: var(--warn);
}
.badge[data-tone='warn']::before {
  content: '!';
  font-weight: 800;
}
.badge[data-tone='bad'] {
  background: var(--bad-bg);
  color: var(--bad);
}
.badge[data-tone='bad']::before {
  content: '✕';
}
.badge[data-tone='info'] {
  background: var(--info-bg);
  color: var(--info);
}
.badge[data-tone='info']::before {
  content: '●';
  font-size: 0.7em;
}
.badge[data-tone='unknown'] {
  background: var(--unknown-bg);
  color: var(--unknown);
  border: 1px dashed var(--unknown);
}
.badge[data-tone='unknown']::before {
  content: '?';
  font-weight: 800;
}
.badge[data-tone='off'] {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border-strong);
}
.badge[data-tone='off']::before {
  content: '○';
}

/* ── buttons and forms ─────────────────────────────────────────────────────────── */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover {
  background: var(--neutral-bg);
  text-decoration: none;
}
.btn:disabled,
.btn.busy {
  opacity: 0.55;
  cursor: progress;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover {
  background: var(--accent);
  filter: brightness(1.08);
}
.btn-approve {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}
.btn-approve:hover {
  background: var(--ok);
  filter: brightness(1.08);
}
@media (prefers-color-scheme: dark) {
  .btn-approve {
    color: #06170d;
  }
}
.btn-deny {
  border: 2px solid var(--border-strong);
}
.btn-danger {
  color: var(--bad);
  border-color: var(--bad);
}
.btn-small {
  min-height: 40px;
  padding: 4px 10px;
  font-size: 0.85rem;
}
input,
select,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 40px;
  max-width: 100%;
}
textarea {
  width: 100%;
  resize: vertical;
}
input[type='checkbox'] {
  width: 20px;
  height: 20px;
  min-height: 0;
  padding: 0;
  flex: 0 0 auto;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.field-label {
  font-weight: 600;
  font-size: 0.9rem;
}
.field-hint {
  color: var(--muted);
  font-size: 0.82rem;
}
.form input[type='text'],
.form input[type='number'],
.form select,
.dialog-form input[type='text'],
.dialog-form input[type='number'],
.dialog-form select {
  width: 100%;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0 12px;
}
.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.pct-input {
  width: 6.5em;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.filters input[type='search'],
.filters input[type='text'] {
  flex: 1 1 160px;
  min-width: 0;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
}
.chip {
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 0.85rem;
}

/* ── notes, details, text ──────────────────────────────────────────────────────── */
.note {
  border-left: 4px solid var(--info);
  background: var(--info-bg);
  padding: 8px 10px;
  border-radius: 6px;
  margin: 8px 0;
}
.note-ok {
  border-left-color: var(--ok);
  background: var(--ok-bg);
}
.note-warn {
  border-left-color: var(--warn);
  background: var(--warn-bg);
}
.note-bad {
  border-left-color: var(--bad);
  background: var(--bad-bg);
  font-weight: 600;
}
/* The exact content an approval binds: shown as-is, scrollable, never reflowed into prose. */
.request-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 40vh;
  overflow: auto;
  margin: 4px 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2, var(--surface));
}
details.details {
  margin: 8px 0;
}
details.details > summary {
  cursor: pointer;
  color: var(--accent);
  padding: 6px 0;
  font-weight: 600;
}
details.details-strong > summary {
  font-size: 1.05rem;
  color: var(--text);
}
.details-body {
  padding-top: 6px;
}
.json {
  background: var(--code-bg);
  border-radius: 8px;
  padding: 10px;
  margin: 6px 0;
  overflow: auto;
  max-height: 420px;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
}
.text-block {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.id {
  color: var(--muted);
}
.id.wrap {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* ── domain widgets ────────────────────────────────────────────────────────────── */
.agent-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  min-width: 0;
}
.card > .agent-card {
  border: 0;
  padding: 0;
  background: transparent;
}
.work {
  border-left: 3px solid var(--info);
  padding-left: 8px;
  overflow-wrap: anywhere;
}
.work-label {
  color: var(--muted);
  font-size: 0.85rem;
}
.task-row,
.knowledge-row,
.ext-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.tool {
  padding: 2px 0;
}
.grant {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.decision {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--surface-2);
}
.decision-pending {
  border-color: var(--warn);
}
.question {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 8px 0;
}
.why {
  color: var(--text);
}
.safe-default {
  color: var(--muted);
  font-style: italic;
}
.decision-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0;
}
.decision-option {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 200px;
  max-width: 340px;
}
.decision-option .btn {
  width: 100%;
}
.note-input {
  width: 100%;
}
.bar {
  display: flex;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bar-bg);
  margin: 8px 0;
}
.bar-used {
  background: var(--bar-used);
}
.bar-avail {
  background: var(--ok);
}
.bar-reserve {
  background: var(--warn);
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 0.88rem;
}
.legend-item::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
}
.legend-used::before {
  background: var(--bar-used);
}
.legend-avail::before {
  background: var(--ok);
}
.legend-reserve::before {
  background: var(--warn);
}
.health-list {
  margin: 6px 0;
}
.health-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}
.health-row:first-child {
  border-top: 0;
}
.health-name {
  font-weight: 600;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.health-detail {
  flex-basis: 100%;
}
.tree {
  list-style: none;
  margin: 0;
  padding-left: 16px;
  border-left: 2px solid var(--border);
}
.tree-root {
  padding-left: 0;
  border-left: 0;
}
.tree-node {
  padding: 6px 0;
  overflow-wrap: anywhere;
}
.tree-node.current {
  background: var(--info-bg);
  border-radius: 6px;
  padding: 6px 8px;
}
.goal {
  font-size: 1.1rem;
  font-weight: 600;
}
.summary {
  font-weight: 600;
}
.claim,
.evidence,
.review {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.notification.read {
  opacity: 0.65;
}
.event {
  padding: 2px 0;
}
.brief-greeting {
  font-size: 1.25rem;
  font-weight: 700;
}
.brief-item {
  margin: 4px 0 4px 8px;
}

/* ── notices, dialogs, errors ──────────────────────────────────────────────────── */
.error-box {
  border: 1px solid var(--bad);
  background: var(--bad-bg);
  border-radius: 10px;
  padding: 12px;
}
.server-message {
  color: var(--muted);
  font-size: 0.9rem;
}
.hint {
  font-size: 0.9rem;
}
.notices {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.notice {
  pointer-events: auto;
  width: 100%;
  max-width: 640px;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
}
.notice-toast {
  background: var(--text);
  color: var(--bg);
  padding: 10px 14px;
  font-weight: 600;
}
.notice-toast[data-tone='warn'] {
  background: #9a5b00;
  color: #fff;
}
.notice-error {
  background: var(--surface);
  max-height: 70vh;
  overflow: auto;
}
.notice-close {
  margin: 8px 12px 12px;
}
.dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  width: 100%;
  max-width: min(520px, calc(100vw - 24px));
  background: var(--surface);
  color: var(--text);
}
.dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}
.dialog-form {
  padding: 16px;
}
.dialog-form h2 {
  margin-bottom: 8px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
/* ── login: the Terminal's look (dark card, cyan accent), in both colour schemes ─────────── */
.login-wrap {
  --lg-bg-a: #050b14;
  --lg-bg-b: #0b1b2f;
  --lg-text: #f4f7fb;
  --lg-muted: #8fa8c0;
  --lg-cyan: #12d8ff;
  --lg-red: #ff4d5e;
  --lg-yellow: #ffd21f;
  --lg-border: rgba(255, 255, 255, 0.12);
  --lg-input: rgba(3, 7, 13, 0.72);
  min-height: calc(100vh - 40px);
  display: grid;
  place-items: center;
  padding: 20px 12px;
  background: radial-gradient(ellipse at 50% 0%, var(--lg-bg-b), var(--lg-bg-a) 70%);
  color: var(--lg-text);
  color-scheme: dark;
}
.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 6px;
  text-align: center;
  padding: 34px 30px;
  border-radius: 22px;
  border: 1px solid var(--lg-border);
  background: linear-gradient(180deg, rgba(16, 36, 61, 0.85), rgba(7, 17, 31, 0.92));
  box-shadow: 0 0 0 1px rgba(18, 216, 255, 0.08), 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 42px rgba(255, 210, 31, 0.08);
}
.login-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 6px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: -0.04em;
  color: #1a1200;
  background: linear-gradient(135deg, var(--lg-yellow), #f5a742);
  filter: drop-shadow(0 0 26px rgba(255, 210, 31, 0.25));
}
.login-title {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.05em;
  color: var(--lg-text);
}
.login-sub {
  margin: 0 0 4px;
  color: var(--lg-muted);
  font-weight: 700;
}
.login-hint {
  margin: 0 0 10px;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--lg-muted);
}
.login-label {
  display: block;
  text-align: left;
  font-weight: 800;
  font-size: 0.82rem;
  color: var(--lg-muted);
  margin: 6px 0 4px;
}
.login-input {
  width: 100%;
  min-height: 48px;
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid var(--lg-border);
  background: var(--lg-input);
  color: var(--lg-text);
  font: inherit;
  outline: none;
  margin-bottom: 6px;
}
.login-input:focus {
  border-color: var(--lg-cyan);
  box-shadow: 0 0 0 3px rgba(18, 216, 255, 0.14);
}
.login-btn {
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  padding: 12px 16px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-weight: 800;
  color: #03070d;
  background: linear-gradient(135deg, var(--lg-cyan), #3ea7ff);
  box-shadow: 0 0 18px rgba(18, 216, 255, 0.22);
  cursor: pointer;
}
.login-btn:hover {
  filter: brightness(1.08);
}
.login-btn:focus-visible {
  outline: 3px solid rgba(18, 216, 255, 0.5);
  outline-offset: 2px;
}
.login-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}
.login-err {
  color: var(--lg-red);
  font-weight: 800;
  margin: 8px 0 0;
}
.login-note {
  color: var(--lg-cyan);
  font-weight: 700;
  margin: 8px 0 0;
}
.login-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.login-meta {
  font-size: 0.78rem;
  color: var(--lg-muted);
}
.login-wrap .locale-switch {
  background: var(--lg-input);
  color: var(--lg-text);
  border-color: var(--lg-border);
}
.banner-build {
  font-weight: 500;
  opacity: 0.9;
  font-size: 0.85em;
  margin-left: 6px;
}


/* ── workers ───────────────────────────────────────────────────────────────────── */
.worker-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface);
  display: grid;
  gap: 6px;
}
.worker-revoked {
  opacity: 0.75;
}
.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0 0 12px;
  font-weight: 600;
}
.note-inline-warn {
  color: var(--warn, #b45309);
  font-weight: 700;
}
.token-wrap {
  display: grid;
  gap: 8px;
  margin: 8px 0;
}
.token-box {
  display: block;
  padding: 10px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
  user-select: all;
}

/* ── the Owner's simple view of a task (simple first, technical second) ───────────── */
.owner-card {
  border-left: 6px solid var(--border-strong);
}
.owner-card[data-tone='ok'] {
  border-left-color: var(--ok);
}
.owner-card[data-tone='info'] {
  border-left-color: var(--info);
}
.owner-card[data-tone='attention'] {
  border-left-color: var(--warn);
}
.owner-card[data-tone='bad'] {
  border-left-color: var(--bad);
}
.owner-headline {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 6px;
}
.owner-next {
  margin: 8px 0;
}
.owner-next-you {
  font-weight: 700;
}
.question-box {
  border: 1px solid var(--warn);
  border-radius: 10px;
  padding: 12px;
  margin: 10px 0;
  background: var(--surface-2);
}
.answer-input {
  width: 100%;
  min-height: 88px;
  margin: 6px 0;
}
.cost-note {
  margin-top: 6px;
}
.cost-estimate {
  cursor: help;
}
.qa blockquote {
  margin: 4px 0;
  padding-left: 10px;
  border-left: 3px solid var(--border-strong);
}

/* ── remote access, knowledge library ──────────────────────────────────────────── */
/* Calm on purpose: being in over the Internet is information, not an alarm (the DEV banner is the alarm). */
.remote-indicator {
  border: 1px solid var(--info);
  color: var(--info);
  background: var(--info-bg);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8rem;
  white-space: nowrap;
}
/* One more item in the header: on a narrow phone the right-hand group wraps instead of overflowing. */
.topbar-right {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.lan-only {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.question-clarify {
  border-color: var(--info);
  border-left: 4px solid var(--info);
}
.learned-line {
  margin-top: 2px;
}
.chips {
  gap: 6px;
}
a.chip {
  color: var(--text);
  text-decoration: none;
}
a.chip:hover {
  border-color: var(--accent);
}
.chip-on {
  border-color: var(--accent);
  background: var(--info-bg);
  font-weight: 600;
}
.chip-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
}
.source-path {
  overflow-wrap: anywhere;
}
.passage {
  border-left: 3px solid var(--border);
  padding: 4px 0 4px 10px;
  margin: 10px 0;
}
.passage-hit {
  border-left-color: var(--accent);
  background: var(--surface-2);
}
.passage-text {
  margin-top: 4px;
}
.library-result .text-block,
.passage .text-block {
  font-size: 0.92rem;
}

/* ── wider screens ─────────────────────────────────────────────────────────────── */
@media (min-width: 760px) {
  .topbar {
    flex-wrap: nowrap;
  }
  .nav {
    order: 0;
    flex: 1 1 auto;
    min-width: 0;
  }
  main {
    padding: 16px 20px;
  }
}
@media (min-width: 960px) {
  .grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .grid > [data-section='decisions'],
  .grid > [data-section='agents'] {
    grid-column: 1 / -1;
  }
}
@media print {
  .topbar,
  .footer,
  .notices,
  .banner-dev {
    position: static;
  }
  .nav,
  .btn {
    display: none;
  }
}

/* ── brand (official logo; generated files in /brand, master in Design/) ─────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  flex: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}
/* The whole artwork on the login card. It is dark by design; the card around it is dark too,
   and a soft mask lets its edges melt into the card instead of sitting on it as a rectangle. */
.login-brand {
  display: block;
  width: min(360px, 100%);
  height: auto;
  aspect-ratio: 3 / 2;
  margin: -14px auto 2px;
  border-radius: 16px;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent), linear-gradient(to bottom, transparent, #000 9%, #000 91%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent), linear-gradient(to bottom, transparent, #000 9%, #000 91%, transparent);
  mask-composite: intersect;
}
/* "Install as app": a quiet text button - present when the browser offers it, never a popup. */
.install-slot:empty {
  display: none;
}
.install-action {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8rem;
  white-space: nowrap;
  cursor: pointer;
}
.install-action:hover,
.install-action:focus-visible {
  border-color: var(--accent, var(--info));
}
.login-wrap .install-action {
  color: var(--lg-text);
  border-color: var(--lg-border);
}
/* A newer release is running on the server: one calm line with the way to get it. */
.banner-update {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  padding: 6px 12px;
  font-size: 0.9rem;
  color: var(--info);
  background: var(--info-bg);
  border-bottom: 1px solid var(--info);
}
/* Installed app on a phone with a notch: keep the header clear of the system bars. */
@media (display-mode: standalone) {
  .banner-dev {
    padding-top: max(4px, env(safe-area-inset-top));
  }
}
