:root {
  color-scheme: light;
  --ink: #16211f;
  --muted: #66736f;
  --line: #d9e2df;
  --surface: #f6f8f7;
  --panel: #ffffff;
  --teal: #0f766e;
  --amber: #b7791f;
  --violet: #5b5fc7;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: var(--teal);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #eef4f2;
  padding: 20px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 48px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.room-header p,
.timeline-item small,
.agent-item span,
.room-item small {
  color: var(--muted);
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 6px;
  margin: 26px 0;
}

.nav-list a {
  border-radius: 6px;
  color: var(--ink);
  padding: 10px 12px;
  text-decoration: none;
}

.nav-list a.is-active {
  background: #dcebe7;
  color: #064e47;
  font-weight: 700;
}

.room-list header,
.room-header,
.company-panel header,
.timeline-panel header,
.spatial-panel header,
.memory-panel header,
.agents-panel header,
.profile-panel header,
.actions-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.room-list header span,
.company-panel h2,
.timeline-panel h2,
.spatial-panel h2,
.memory-panel h2,
.agents-panel h2,
.profile-panel h2,
.actions-panel h2 {
  margin: 0;
  font-size: 15px;
}

.spatial-panel header > span {
  border-radius: 999px;
  background: #eef4f2;
  color: var(--muted);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
}

.room-item {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding: 10px 12px;
  text-align: left;
}

.room-item.is-active {
  border-color: #8fbab3;
  background: #ffffff;
}

.room-view {
  min-width: 0;
  padding: 22px;
}

.room-header {
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.room-header h1 {
  margin: 4px 0 0;
  font-size: 24px;
}

.room-header p {
  margin: 0;
  text-transform: uppercase;
}

.room-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.room-status span {
  border-radius: 999px;
  background: #e8f3ef;
  color: #0f5f57;
  max-width: min(42vw, 320px);
  overflow-wrap: anywhere;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.stream-badge {
  border-radius: 999px;
  background: #eef4f2;
  color: var(--muted);
  max-width: 220px;
  overflow-wrap: anywhere;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.stream-badge[data-status="connected"] {
  background: #dcebe7;
  color: #064e47;
}

.stream-badge[data-status="connecting"],
.stream-badge[data-status="reconnecting"] {
  background: #f7ead6;
  color: #7a4c11;
}

.stream-badge[data-status="error"] {
  background: #fde8e7;
  color: var(--danger);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(280px, 360px);
  grid-template-areas:
    "company company"
    "timeline agents"
    "timeline profile"
    "spatial profile"
    "memory actions";
  gap: 16px;
  padding-top: 18px;
}

.timeline-panel,
.company-panel,
.spatial-panel,
.memory-panel,
.agents-panel,
.profile-panel,
.actions-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.company-panel {
  grid-area: company;
}

.timeline-panel {
  grid-area: timeline;
  min-height: 360px;
}

.company-dashboard {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.company-overview {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.company-overview p,
.company-overview h3,
.company-overview span,
.company-section h3 {
  margin: 0;
}

.company-overview p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.company-overview h3 {
  margin-top: 3px;
  font-size: 20px;
}

.company-overview span,
.company-item small,
.employee-item small,
.company-section article span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.company-overview button {
  min-height: 38px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 700;
  white-space: nowrap;
}

.company-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.company-metrics div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
  padding: 11px;
}

.company-metrics strong,
.company-metrics span,
.company-item span,
.employee-item span,
.company-section article strong,
.company-section article span {
  display: block;
}

.company-metrics strong {
  font-size: 20px;
}

.company-metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.company-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(280px, 1fr) minmax(260px, 1fr);
  gap: 14px;
}

.company-section {
  min-width: 0;
}

.company-section header {
  min-height: 30px;
}

.company-section h3 {
  font-size: 15px;
}

.company-create-form,
.hire-agent-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.company-create-form input,
.company-create-form select,
.company-create-form textarea,
.hire-agent-form input,
.hire-agent-form select,
.hire-agent-form textarea {
  min-width: 0;
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
}

.company-create-form button,
.hire-agent-form button {
  min-height: 38px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 700;
}

.onboarding-section {
  margin-bottom: 14px;
}

.admin-console-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
  padding: 12px;
}

.billing-console-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
  margin-top: 14px;
  padding: 12px;
}

.api-access-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f8fb;
  margin-top: 14px;
  padding: 12px;
}

.webhook-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf7;
  margin-top: 14px;
  padding: 12px;
}

.admin-console-header,
.admin-actions,
.admin-disabled-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-console-header div:first-child {
  min-width: 0;
}

.admin-console-header span,
.admin-console-card small,
.admin-rollup-list span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.admin-actions,
.admin-incident-actions {
  flex-wrap: wrap;
}

.admin-actions button,
.admin-disabled-banner button {
  min-height: 34px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 700;
}

.admin-status-pill {
  border-radius: 999px;
  background: #dcebe7;
  color: #064e47;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-status-pill[data-status="disabled"] {
  background: #fde8e7;
  color: var(--danger);
}

.admin-disabled-banner {
  border: 1px solid #dfb06a;
  border-radius: 8px;
  background: #fffaf0;
  margin-top: 10px;
  padding: 10px;
}

.admin-disabled-banner strong {
  overflow-wrap: anywhere;
}

.admin-console-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.billing-console-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.api-access-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.webhook-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-console-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.admin-console-card h4 {
  margin: 0;
  font-size: 14px;
}

.model-audit-card,
.audit-trail-card,
.api-events-card,
.webhook-deliveries-card {
  grid-column: span 2;
}

.admin-kv {
  display: grid;
  grid-template-columns: minmax(72px, auto) minmax(0, 1fr);
  gap: 6px 10px;
  margin: 0;
}

.admin-kv dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-kv dd {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.admin-rollup-list,
.admin-incident-actions,
.billing-plan-list,
.billing-invoice-list,
.api-access-list,
.api-event-list,
.webhook-list,
.webhook-delivery-list {
  display: grid;
  gap: 7px;
}

.billing-plan,
.billing-invoice,
.api-access-row,
.api-event-row,
.webhook-row {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.billing-plan.is-selected {
  border-color: var(--teal);
  box-shadow: inset 3px 0 0 var(--teal);
}

.billing-plan span,
.billing-plan small,
.billing-invoice span,
.api-access-row span,
.api-event-row span,
.api-event-row small,
.webhook-row span,
.webhook-row small {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.api-secret-box {
  display: grid;
  gap: 6px;
  border: 1px solid #dfb06a;
  border-radius: 8px;
  background: #fffaf0;
  margin-top: 10px;
  padding: 10px;
}

.api-secret-box code {
  color: var(--ink);
  font-size: 12px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.billing-action-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.billing-action-row button {
  min-height: 32px;
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.api-access-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.api-access-row > button,
.api-access-actions button {
  min-height: 32px;
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.billing-session-link {
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.admin-rollup {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.admin-rollup strong {
  overflow-wrap: anywhere;
}

.model-call-list {
  display: grid;
  gap: 7px;
  max-height: 210px;
  overflow: auto;
}

.audit-record-list {
  display: grid;
  gap: 7px;
  max-height: 210px;
  overflow: auto;
}

.model-call-list > span,
.model-call-row span,
.model-call-row small,
.model-call-detail span,
.model-call-detail small,
.audit-record-list > span,
.audit-record-row span,
.audit-record-row small,
.audit-trace-detail span,
.audit-trace-detail small {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.model-call-row,
.audit-record-row {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 58px;
  padding: 8px;
  text-align: left;
}

.model-call-row.is-selected {
  border-color: var(--teal);
  box-shadow: inset 3px 0 0 var(--teal);
}

.audit-record-row.is-selected {
  border-color: var(--violet);
  box-shadow: inset 3px 0 0 var(--violet);
}

.model-call-row strong,
.model-call-detail strong,
.audit-record-row strong,
.audit-trace-detail strong {
  overflow-wrap: anywhere;
}

.model-call-detail,
.audit-trace-detail {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.model-call-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.model-call-status {
  border-radius: 999px;
  background: #dcebe7;
  color: #064e47;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.model-call-status[data-status="failed"] {
  background: #fde8e7;
  color: var(--danger);
}

.model-call-status[data-status="streamed"] {
  background: #e5edff;
  color: var(--violet);
}

.audit-status-pill {
  border-radius: 999px;
  background: #dcebe7;
  color: #064e47;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.audit-status-pill[data-status="invalid"] {
  background: #fde8e7;
  color: var(--danger);
}

.admin-incident-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-incident-actions button {
  min-height: 32px;
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.onboarding-checklist {
  display: grid;
  gap: 8px;
}

.onboarding-step {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #ffffff;
}

.onboarding-step span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.onboarding-step small {
  grid-column: 1 / -1;
  color: var(--danger);
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.company-item,
.employee-item {
  min-height: 56px;
}

.employee-item .agent-avatar {
  flex: 0 0 36px;
}

.company-section article,
.memory-health {
  display: grid;
  gap: 7px;
  background: #ffffff;
}

.memory-health > strong {
  color: var(--violet);
  text-transform: capitalize;
}

.spatial-panel {
  grid-area: spatial;
  min-height: 300px;
}

.memory-panel {
  grid-area: memory;
  min-height: 360px;
}

.agents-panel {
  grid-area: agents;
  min-height: 280px;
}

.profile-panel {
  grid-area: profile;
  min-height: 360px;
}

.actions-panel {
  grid-area: actions;
  min-height: 320px;
}

.timeline-list,
.agent-list,
.memory-list,
.company-list,
.employee-roster,
.template-library,
.org-summary,
.team-summary,
.work-summary {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.timeline-item,
.agent-item,
.memory-item,
.company-item,
.employee-item,
.company-section article,
.memory-health {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.timeline-item div,
.agent-item,
.memory-item,
.company-item,
.employee-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-item,
.memory-item,
.company-item,
.employee-item {
  width: 100%;
  background: #ffffff;
  text-align: left;
}

.agent-item.is-selected,
.memory-item.is-selected,
.company-item.is-selected,
.employee-item.is-selected {
  border-color: #8fbab3;
  background: #f3faf7;
}

.timeline-item strong,
.agent-item strong,
.memory-item strong,
.company-item strong,
.employee-item strong,
.company-section article strong {
  overflow-wrap: anywhere;
}

.timeline-item span {
  border-radius: 999px;
  background: #f7ead6;
  color: #7a4c11;
  padding: 4px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.spatial-shell {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.spatial-map {
  width: 100%;
  min-height: 250px;
}

.spatial-map.world-map {
  min-height: 280px;
}

.spatial-floor {
  fill: #f7faf9;
  stroke: var(--line);
}

.spatial-link {
  stroke: #9cb4ae;
  stroke-dasharray: 4 5;
  stroke-width: 1.5;
  marker-end: url("#spatial-arrow");
}

.spatial-link[data-kind="work"] {
  stroke: #b7791f;
}

.spatial-link[data-kind="memory"] {
  stroke: #5b5fc7;
}

.spatial-map marker path {
  fill: #9cb4ae;
}

.spatial-core circle {
  fill: #0f766e;
  stroke: #064e47;
  stroke-width: 2;
}

.spatial-core text,
.spatial-agent text,
.spatial-task text,
.spatial-memory text {
  dominant-baseline: middle;
  text-anchor: middle;
  font-weight: 800;
}

.spatial-core text {
  fill: #ffffff;
  font-size: 16px;
}

.spatial-core text:last-child {
  font-size: 11px;
  opacity: 0.8;
  text-transform: uppercase;
}

.spatial-agent circle {
  fill: #e8e9fb;
  stroke: #c7c9f6;
  stroke-width: 2;
}

.spatial-agent[data-status="live"] circle {
  fill: #dcebe7;
  stroke: var(--teal);
}

.spatial-agent text {
  fill: var(--violet);
  font-size: 13px;
}

.spatial-agent .spatial-label {
  fill: var(--muted);
  font-size: 11px;
}

.spatial-task rect {
  fill: #fff4df;
  stroke: #e4c48f;
}

.spatial-task text {
  fill: #7a4c11;
  font-size: 11px;
}

.spatial-memory path {
  fill: #eef0ff;
  stroke: #c8cdfb;
}

.spatial-memory text {
  fill: #484ca8;
  font-size: 10px;
}

.world-link[data-kind="project_link"] {
  stroke: #d97706;
}

.world-link[data-kind="contract_portal"],
.world-link[data-kind="contract"] {
  stroke: #7c3aed;
}

.world-location {
  cursor: pointer;
}

.world-location circle {
  fill: #e6f4f1;
  stroke: #89b8ae;
  stroke-width: 2;
}

.world-location text {
  dominant-baseline: middle;
  fill: #123835;
  font-size: 11px;
  font-weight: 800;
  text-anchor: middle;
}

.world-location .world-location-kind {
  fill: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.world-location[data-type="world_root"] circle {
  fill: #0f766e;
  stroke: #064e47;
}

.world-location[data-type="world_root"] text {
  fill: #ffffff;
}

.world-location[data-type="company_room"] circle {
  fill: #eef2ff;
  stroke: #9aa5f4;
}

.world-location[data-type="project_space"] circle {
  fill: #fff4df;
  stroke: #d99b32;
}

.world-location[data-type="contract_space"] circle {
  fill: #f1e8ff;
  stroke: #aa86e8;
}

.world-location[data-status="visible_locked"] circle {
  fill: #f8fafc;
  stroke: #94a3b8;
  stroke-dasharray: 5 4;
}

.world-location[data-status="redacted"] circle,
.world-location[data-status="hidden"] circle {
  fill: #f1f5f9;
  stroke: #64748b;
  stroke-dasharray: 3 4;
}

.world-location.is-selected circle {
  stroke: #0f766e;
  stroke-width: 4;
}

.world-presence circle {
  fill: #22c55e;
  stroke: #ffffff;
  stroke-width: 2;
}

.spatial-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.spatial-legend span {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  padding: 8px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.world-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1.2fr) minmax(180px, 0.8fr);
  padding: 12px;
}

.world-detail h4 {
  margin: 6px 0 4px;
}

.world-detail p {
  color: var(--muted);
  margin: 0;
}

.world-detail dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.world-detail dl div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.world-detail dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.world-detail dd {
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.world-status,
.world-decision {
  border-radius: 999px;
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
}

.world-status[data-status="allowed"],
.world-decision[data-status="allowed"] {
  background: #dcebe7;
  color: #075a52;
}

.world-status[data-status="visible_locked"],
.world-decision[data-status="visible_locked"] {
  background: #eef2ff;
  color: #3730a3;
}

.world-status[data-status="redacted"],
.world-status[data-status="hidden"],
.world-decision[data-status="redacted"],
.world-decision[data-status="hidden"] {
  background: #f1f5f9;
  color: #475569;
}

.world-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
}

.world-actions a,
.world-actions button,
.world-location-button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  padding: 8px 10px;
  text-decoration: none;
}

.world-location-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.world-location-button {
  display: grid;
  gap: 3px;
  text-align: left;
}

.world-location-button span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.world-location-button.is-selected {
  border-color: #0f766e;
  background: #f3faf7;
}

.world-location-button[data-status="redacted"],
.world-location-button[data-status="hidden"] {
  background: #f8fafc;
}

.agent-avatar {
  display: grid;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: #e8e9fb;
  color: var(--violet);
  font-size: 13px;
  font-weight: 800;
}

.agent-item div:last-child {
  min-width: 0;
}

.agent-item span,
.timeline-item small {
  display: block;
  overflow-wrap: anywhere;
}

.agent-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 7px;
  font-size: 13px;
}

.presence-dot {
  display: inline-block;
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #9aa7a3;
}

.presence-dot[data-presence="active"],
.presence-dot[data-presence="present"],
.presence-dot[data-presence="live"] {
  background: var(--teal);
}

.presence-dot[data-presence="offline"] {
  background: var(--danger);
}

.memory-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) repeat(4, minmax(110px, 150px)) auto;
  gap: 8px;
  margin-top: 14px;
}

.memory-form input,
.memory-form select,
.memory-flag-form textarea {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
}

.memory-form button,
.memory-flag-form button {
  min-height: 38px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 700;
}

.memory-browser {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(220px, 1.1fr);
  gap: 12px;
  margin-top: 12px;
}

.memory-list {
  align-content: start;
  margin-top: 0;
}

.memory-item {
  align-items: flex-start;
  flex-direction: column;
}

.memory-item span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.memory-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.memory-card header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.memory-card header p,
.memory-card header h3,
.memory-card p,
.memory-card small {
  margin: 0;
  overflow-wrap: anywhere;
}

.memory-card header p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.memory-card header h3 {
  font-size: 16px;
}

.memory-card header > span {
  border-radius: 999px;
  background: #eef4f2;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.memory-card small,
.memory-card a {
  color: var(--muted);
}

.memory-flag-form {
  display: grid;
  gap: 8px;
}

.goal-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.goal-form label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.goal-form textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.goal-form button {
  min-height: 40px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 700;
}

.agent-profile-form,
.agent-profile-form label,
.profile-section {
  display: grid;
  gap: 9px;
}

.agent-profile-form {
  margin-top: 14px;
}

.agent-profile-form header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.agent-profile-form header p,
.agent-profile-form header h3,
.profile-section h4 {
  margin: 0;
}

.agent-profile-form header p,
.agent-profile-form label span,
.profile-section h4,
.memory-policy dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.agent-profile-form header h3 {
  font-size: 18px;
}

.agent-profile-form header > span {
  border-radius: 999px;
  background: #eef4f2;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.agent-profile-form textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.agent-profile-form button[type="submit"] {
  min-height: 40px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 700;
}

.profile-section {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.profile-section p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-list span,
.profile-message {
  border-radius: 999px;
  background: #eef4f2;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.profile-message {
  border-radius: 6px;
}

.profile-message.is-error {
  background: #fde8e7;
  color: var(--danger);
}

.confirm-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.confirm-row input {
  width: 16px;
  height: 16px;
}

.memory-policy {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 6px 10px;
  margin: 0;
}

.memory-policy dd {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.notification-inbox,
.approval-console {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.notification-inbox h3,
.approval-console h3 {
  margin: 0;
  font-size: 15px;
}

.notification-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.notification-summary span {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7faf9;
  color: var(--muted);
  padding: 8px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  overflow-wrap: anywhere;
}

.notification-list {
  display: grid;
  gap: 10px;
}

.notification-item {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.notification-item[data-priority="high"] {
  border-color: #dfb06a;
  background: #fffaf0;
}

.notification-item[data-status="resolved"] {
  background: #f4f7f6;
  color: var(--muted);
}

.notification-item header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.notification-item strong,
.notification-item p,
.notification-item a {
  overflow-wrap: anywhere;
}

.notification-item a {
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  text-transform: uppercase;
}

.notification-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.notification-links {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 4px 8px;
  margin: 0;
}

.notification-links dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.notification-links dd {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.notification-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.notification-actions button:first-child {
  border-color: #8fbab3;
  background: #dcebe7;
  color: #064e47;
  font-weight: 700;
}

.approval-list {
  display: grid;
  gap: 10px;
}

.approval-item {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.approval-item strong,
.approval-item p {
  overflow-wrap: anywhere;
}

.approval-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.approval-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.approval-meta span {
  border-radius: 999px;
  background: #eef4f2;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.approval-actions button:first-child {
  border-color: #8fbab3;
  background: #dcebe7;
  color: #064e47;
  font-weight: 700;
}

.empty-state {
  display: grid;
  min-height: 120px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 16px;
  text-align: center;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "company"
      "timeline"
      "spatial"
      "memory"
      "agents"
      "profile"
      "actions";
  }

  .timeline-panel {
    min-height: 420px;
  }

  .memory-form,
  .memory-browser,
  .company-grid,
  .admin-console-grid,
  .world-detail,
  .company-metrics {
    grid-template-columns: 1fr;
  }

  .model-audit-card,
  .audit-trail-card {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .room-view,
  .sidebar {
    padding: 14px;
  }

  .room-header,
  .room-list header,
  .company-panel header,
  .company-overview,
  .admin-console-header,
  .admin-disabled-banner,
  .timeline-panel header,
  .spatial-panel header,
  .memory-panel header,
  .agents-panel header,
  .profile-panel header,
  .actions-panel header,
  .timeline-item div {
    align-items: flex-start;
    flex-direction: column;
  }

  .room-status {
    width: 100%;
    justify-content: space-between;
  }

  .company-overview button {
    width: 100%;
  }

  .admin-actions,
  .world-actions,
  .admin-disabled-banner button {
    width: 100%;
  }

  .world-actions a,
  .world-actions button {
    text-align: center;
    width: 100%;
  }
}
