:root {
  color-scheme: light dark;
  --line: color-mix(in srgb, currentColor 20%, transparent);
  --muted: color-mix(in srgb, currentColor 60%, transparent);
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
  max-width: 60rem;
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.75rem;
}

h1 { font-size: 1.1rem; margin: 0; letter-spacing: 0.02em; }
h2 { font-size: 0.95rem; margin: 0 0 0.75rem; }

.identity { display: flex; gap: 0.5rem; align-items: center; }
.identity span { color: var(--muted); font-variant-numeric: tabular-nums; }

.panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem;
  margin-top: 1.25rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

label { color: var(--muted); min-width: 6rem; }

input, select, textarea, pre.document {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: inherit;
}

input { flex: 1 1 14rem; min-width: 10rem; }
textarea { width: 100%; resize: vertical; }

pre.document {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 24rem;
  overflow: auto;
  margin: 0;
}

button {
  font: inherit;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

button:hover { border-color: currentColor; }
button:disabled { opacity: 0.5; cursor: default; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.15rem 1rem;
  margin: 0 0 0.9rem;
}

.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }

.hint { color: var(--muted); margin: 0.75rem 0 0; }

.message {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 4px;
  padding: 0.6rem 0.8rem;
  margin: 1rem 0 0;
  white-space: pre-wrap;
}

.message[data-kind="error"] { border-left-color: #c0392b; }
.message[data-kind="conflict"] { border-left-color: #d68910; }
.message[data-kind="ok"] { border-left-color: #1e8449; }

/* The hidden attribute wins over layout display rules, including signed-out navigation. */
[hidden] { display: none !important; }
body { max-width: 76rem; background: light-dark(#f5f7fb, #101722); }
header { padding: 0.5rem 0 1.25rem; }
h1 { font-size: 1.35rem; font-weight: 700; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; margin: 0 0 0.5rem; overflow-wrap: anywhere; }
.panel { border-radius: 12px; padding: 1.5rem; background: light-dark(#fff, #172130); }
.portal-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }
.portal-nav button[aria-current="page"] { background: #225ad7; color: #fff; border-color: #225ad7; }
.card-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.card-heading .hint { margin-top: 0; }
.agent-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 27rem), 1fr)); gap: 1rem; }
.agent-card { border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem; min-width: 0; }
.agent-card .facts { font-size: 0.85rem; margin-top: 0.75rem; }
.agent-card .facts dd { overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
.badge { padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.badge.online { background: #d9f4e5; color: #145a32; }
.badge.offline { background: #e8ecf2; color: #344256; }
.badge.disabled { background: #fce8d2; color: #7b4300; }
.workspace { border-top: 1px solid var(--line); padding-top: 0.75rem; margin-top: 0.75rem; }
.workspace > .hint { margin-left: 0.75rem; }
summary { cursor: pointer; color: light-dark(#225ad7, #91b6ff); }
.download-link { display: inline-block; padding: 0.5rem 1rem; border-radius: 6px; background: #225ad7; color: #fff; text-decoration: none; }
.setup-steps li { padding: 0.35rem 0; }
:focus-visible { outline: 3px solid #4b8dff; outline-offset: 3px; }
@media (max-width: 520px) {
  .panel { padding: 1rem; }
  .facts { grid-template-columns: 1fr; gap: 0.15rem; }
  .facts dd { margin-bottom: 0.5rem; }
  .identity { flex-wrap: wrap; overflow-wrap: anywhere; }
}


/* Guided project configuration: clear groups and touch/keyboard help. */
.primary { background: #225ad7; border-color: #225ad7; color: #fff; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1rem; }
.project-grid button { margin-top: 1rem; }
.project-grid details { margin-top: 0.75rem; }
.project-open { margin: 1.5rem 0; padding: 1rem; border: 1px dashed var(--line); border-radius: 8px; }
.project-open .row { margin-top: 0.75rem; }
#project-editor { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1.5rem; }
.info-box { background: light-dark(#edf3ff, #1b2d49); border-radius: 8px; padding: 1rem; margin: 1rem 0; overflow-wrap: anywhere; }
.info-box p { margin: 0.5rem 0; }
.project-fields { border: 0; margin: 1.5rem 0; padding: 0; min-width: 0; }
.project-fields > legend { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.75rem; }
.policy-group { padding: 1rem 0; border-top: 1px solid var(--line); }
.policy-group > summary { font-size: 1rem; font-weight: 600; padding: 0.25rem 0; }
.project-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin-top: 1rem; }
.project-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: start; gap: 0.4rem; min-width: 0; }
.project-field > label { font-weight: 600; color: inherit; align-self: center; }
.project-field > input, .project-field > select, .project-field > textarea { grid-column: 1 / -1; width: 100%; min-width: 0; padding: 0.65rem; font: inherit; }
.tooltip { position: relative; }
.tooltip > button { border-radius: 50%; width: 2rem; height: 2rem; padding: 0; font-weight: 700; }
.tooltip-body { display: none; position: absolute; z-index: 5; right: 0; top: 100%; width: min(21rem, 75vw); padding: 0.75rem; background: light-dark(#172130, #eef3fa); color: light-dark(#fff, #101722); border-radius: 6px; box-shadow: 0 4px 16px #0003; font-size: 0.9rem; overflow-wrap: anywhere; }
.tooltip:hover .tooltip-body, .tooltip:focus-within .tooltip-body, .tooltip[data-open="true"] .tooltip-body { display: block; }
.tooltip[data-open="false"] .tooltip-body { display: none; }
.task-card { padding: 1rem; margin: 1rem 0; border: 1px solid var(--line); border-radius: 8px; }
.task-card h4 { margin: 0; overflow-wrap: anywhere; }
.task-card > button { margin-top: 1rem; }
#project-comment { width: 100%; margin-top: 0.5rem; }
#project-dirty { color: var(--muted); }
#project-changes li { margin: 0.6rem 0; }
.help-grid { display: grid; gap: 0.75rem; margin-top: 1.5rem; }
.help-grid details { padding: 1rem; border: 1px solid var(--line); border-radius: 8px; }
.help-grid summary { font-weight: 600; }
@media (max-width: 680px) { .project-form-grid { grid-template-columns: 1fr; } }

.inherited-hint { grid-column: 1 / -1; margin: 0; font-size: 0.85rem; overflow-wrap: anywhere; }

.workspace-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.workspace-heading .hint { margin: 0; }
.workspace-heading .danger { margin-left: auto; }
.danger { border-color: light-dark(#b42318, #ff8b82); color: light-dark(#b42318, #ffaaa3); }
.danger:hover { border-color: currentColor; }

/* Agent inventory: make the machine name and workspace actions immediately visible. */
.eyebrow { margin: 0 0 0.2rem; color: var(--muted); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.workspace-list { margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--line); }
.workspace-list h4 { margin: 0; font-size: 0.9rem; }
.agent-technical { margin-top: 1rem; }
.agent-technical .facts { margin-top: 0.75rem; }
