/* Small late-loaded containment rules for wide operational tables. */
.table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

/* AR AI task orchestration: compact business-first presentation. */
.ar-task-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, .22fr);
  gap: 16px;
  align-items: end;
}
.ar-task-composer label:first-child { grid-row: span 2; }
.ar-task-composer textarea { min-height: 132px; resize: vertical; }
.ar-task-composer .error,
.ar-task-composer .safe-caption { grid-column: 1 / -1; }
.ar-task-composer > button { justify-self: start; }
.ar-voice-panel,
.ar-voice-actions,
.ar-tts-controls,
.ar-task-controls { min-width: 0; }
.ar-voice-actions,
.ar-tts-controls,
.ar-task-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.ar-voice-actions label,
.ar-tts-controls label { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.ar-voice-panel > p,
.ar-tts-controls .small { overflow-wrap: anywhere; }
.ar-goal-grid { margin-bottom: 28px; }
.ar-task-list { display: grid; gap: 16px; }
.ar-task-card { border-left: 4px solid rgba(92, 112, 135, .35); }
.ar-task-card.task-running,
.ar-task-card.task-done { border-left-color: var(--mint); }
.ar-task-card.task-waiting,
.ar-task-card.task-approval { border-left-color: #d69b36; }
.ar-task-card.task-blocked,
.ar-task-card.task-failed { border-left-color: #d46060; }
.ar-task-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}
.ar-task-head h3 { margin: 4px 0 7px; max-width: 780px; }
.task-priority {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid rgba(93, 117, 144, .25);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
}
.task-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin: 16px 0;
}
.task-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(95, 114, 137, .16);
}
.task-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), #50aee5);
}
.task-state-reason,
.task-entitlement,
.task-qa,
.task-final-result {
  margin-top: 14px;
  padding: 15px;
  border-radius: 14px;
  background: rgba(86, 108, 132, .08);
}
.task-state-reason p,
.task-entitlement h4,
.task-final-result h4 { margin-bottom: 0; }
.task-execution { margin-top: 14px; }
.task-execution summary { cursor: pointer; font-weight: 750; }
.task-step-list { display: grid; gap: 10px; margin: 14px 0 0; padding: 0; list-style: none; }
.task-step {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}
.task-step small { display: block; margin-top: 3px; }
.task-step-marker {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: rgba(95, 114, 137, .45);
}
.task-step.task-running .task-step-marker,
.task-step.task-done .task-step-marker { background: var(--mint); }
.task-step.task-waiting .task-step-marker,
.task-step.task-approval .task-step-marker { background: #d69b36; }
.task-step.task-blocked .task-step-marker,
.task-step.task-failed .task-step-marker { background: #d46060; }
.task-qa-pass { border: 1px solid rgba(54, 180, 139, .28); }
.task-qa-pending { border: 1px solid rgba(214, 155, 54, .28); }
.task-entitlement { border: 1px solid rgba(214, 155, 54, .35); }
.task-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.task-result-grid > div {
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .045);
}
.task-result-grid ul,
.task-result-grid ol,
.task-qa ul { margin-bottom: 0; padding-left: 20px; }

@media (max-width: 720px) {
  .ar-task-composer { grid-template-columns: 1fr; }
  .ar-task-composer label:first-child { grid-row: auto; }
  .ar-task-composer .error,
  .ar-task-composer .safe-caption { grid-column: auto; }
  .ar-task-head { flex-direction: column; gap: 8px; }
  .task-result-grid { grid-template-columns: 1fr; }
}
@media (max-width: 430px) {
  .ar-voice-actions,
  .ar-tts-controls,
  .ar-task-controls { align-items: stretch; flex-direction: column; }
  .ar-voice-actions label,
  .ar-tts-controls label { flex-basis: auto; width: 100%; }
  .ar-voice-actions .btn,
  .ar-tts-controls .btn,
  .ar-task-controls .btn { width: 100%; max-width: 100%; white-space: normal; }
}

.mcp-registry-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}

.mcp-registry-table th,
.mcp-registry-table td {
  min-width: 145px;
  max-width: 320px;
  padding: .75rem;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
  text-align: left;
}

/* Native selects can use the width of their longest option as a minimum.
   Keep every owner/client form control inside its responsive card. */
.form label {
  min-width: 0;
}

.form input,
.form textarea,
.form select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.onboarding-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.onboarding-summary > div {
  min-width: 0;
  padding: 4px 2px;
}

.onboarding-summary h2 { margin: .25rem 0; }

.module-preferences {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 20px;
  margin-bottom: 18px;
}

.module-preferences > * { min-width: 0; }
.module-choice-grid { display: grid; gap: 9px; }

.module-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .55);
}

.module-choice input { width: auto; margin-top: 3px; }
.module-choice span,
.module-choice b,
.module-choice small { display: block; min-width: 0; }
.module-choice small { margin-top: 2px; overflow-wrap: anywhere; }

.onboarding-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.onboarding-step {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.onboarding-step-index {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #e8f0f5;
  color: #12344a;
  font-weight: 800;
}

.onboarding-step-body { min-width: 0; }
.onboarding-step-body .row { align-items: flex-start; gap: 10px; }
.onboarding-step-body p { overflow-wrap: anywhere; }

.readiness-state {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  white-space: nowrap;
  background: #e8eef2;
  color: #324858;
}

.readiness-pass { background: #dff5e7; color: #17613a; }
.readiness-partial,
.readiness-optional,
.readiness-not-selected { background: #fff0ce; color: #795614; }
.readiness-safe-closed,
.readiness-blocked,
.readiness-not-connected { background: #ffe1df; color: #8c2f2b; }

.onboarding-finish {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: center;
  margin-top: 18px;
}

.onboarding-finish > div { min-width: 0; }

@media (max-width: 760px) {
  .onboarding-summary,
  .onboarding-grid,
  .module-preferences { grid-template-columns: 1fr; }
  .onboarding-step { grid-template-columns: 34px minmax(0, 1fr); gap: 10px; }
  .onboarding-step-index { width: 32px; height: 32px; border-radius: 10px; }
  .onboarding-step-body .row { display: flex; flex-direction: column; }
  .onboarding-finish { align-items: stretch; flex-direction: column; }
}

.security-audit-panel { margin-top: 18px; }
.security-audit-list { display: grid; }

.security-audit-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.security-audit-row:first-child { border-top: 0; }
.security-audit-row span { min-width: 0; }
.security-audit-row b,
.security-audit-row small { display: block; overflow-wrap: anywhere; }
.security-audit-row time { flex: 0 0 auto; color: var(--muted); font-size: .82rem; text-align: right; }

@media (max-width: 560px) {
  .security-audit-row { flex-direction: column; gap: 6px; }
  .security-audit-row time { text-align: left; }
}

.accounting-readiness,
.accounting-safe-closed {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-top: 16px;
}

.accounting-readiness > div,
.accounting-safe-closed > div { min-width: 0; }

.accounting-workspace-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.accounting-workspace-grid .panel { margin-top: 0; }
.accounting-bindings { display: grid; gap: 0; }

.accounting-binding-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.accounting-binding-row:first-child { border-top: 0; }
.accounting-binding-row span,
.accounting-binding-row b,
.accounting-binding-row small { display: block; min-width: 0; overflow-wrap: anywhere; }
.accounting-draft { margin-top: 12px; background: color-mix(in srgb, var(--card) 92%, var(--mint)); }

.readiness-legal-entity-missing,
.readiness-tax-profile-missing,
.readiness-tax-profile-unconfirmed,
.readiness-accounting-period-missing,
.readiness-store-binding-missing,
.readiness-marketplace-source-partial,
.readiness-ledger-not-ready,
.readiness-declaration-draft-not-ready { background: #fff0ce; color: #795614; }

.readiness-ready-for-review { background: #dff5e7; color: #17613a; }

@media (max-width: 820px) {
  .accounting-workspace-grid { grid-template-columns: 1fr; }
  .accounting-readiness,
  .accounting-safe-closed { flex-direction: column; }
}

@media (max-width: 620px) {
  .accounting-binding-row { grid-template-columns: 1fr; align-items: stretch; }
  .accounting-binding-row .btn { width: 100%; }
}

.marking-function-center { margin-top: 22px; overflow: hidden; }
.marking-function-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px;
  cursor: pointer;
  list-style: none;
}
.marking-function-summary::-webkit-details-marker { display: none; }
.marking-function-summary span:first-child { display: grid; gap: 5px; min-width: 0; }
.marking-function-summary small { color: var(--muted); line-height: 1.45; }
.marking-function-center[open] .marking-function-summary { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.marking-function-center[open] .marking-function-heading { margin-top: 18px; }
.marking-function-heading { align-items: flex-start; }
.marking-function-heading h2,
.marking-connection-heading h2 { margin: 4px 0 8px; }
.marking-preview-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid #f3bd56;
  border-radius: 999px;
  background: rgba(243, 189, 86, .12);
  color: #ffd98a;
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-align: center;
}
.marking-function-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.marking-function-card {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .025);
}
.marking-function-card h3 { margin: 0 0 8px; font-size: 1.08rem; }
.marking-function-card p { margin: 0; }
.marking-function-legend {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .02);
}
.marking-function-legend small { color: var(--muted); }
.marking-function-list { display: grid; gap: 8px; }
.marking-function-row {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid #6c8299;
  border-radius: 10px;
  background: rgba(8, 23, 40, .58);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.marking-function-row:hover,
.marking-function-row:focus-visible { border-color: #9eb0c0; background: rgba(255, 255, 255, .055); }
.marking-function-row.local { border-left-color: var(--mint); }
.marking-function-row.required { border-left-color: #f3bd56; }
.marking-function-row.closed { border-left-color: #e2746b; }
.marking-function-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.marking-function-row > span:first-child b,
.marking-function-row > span:first-child small { display: block; }
.marking-function-row > span:first-child small { margin-top: 5px; color: var(--muted); line-height: 1.4; }
.marking-function-row .draft-pill { flex: 0 0 auto; max-width: 100%; white-space: normal; text-align: center; }
.marking-connection-center {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.marking-shared-connection-form { scroll-margin-top: 110px; }
.marking-connection-wizard { margin: 22px 0 0; scroll-margin-top: 110px; }
.marking-quick-connect { margin: 18px 0 0; padding: 14px; scroll-margin-top: 110px; }
.marking-quick-connect-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.15fr) minmax(210px, 1fr) minmax(250px, 1.2fr) auto;
  gap: 10px;
  align-items: end;
}
.marking-quick-connect-form label { display: grid; min-width: 0; gap: 6px; color: var(--muted); font-size: .78rem; }
.marking-quick-connect-form input,
.marking-quick-connect-form select,
.marking-quick-connect-form label > .btn { width: 100%; min-width: 0; margin: 0; }
.marking-quick-connect-form > .btn { min-height: 44px; }
.marking-quick-connect-form > .error,
.marking-quick-connect-message { grid-column: 1 / -1; margin: 0; }
.marking-quick-connect-message:empty { display: none; }
.marking-connection-heading { margin-bottom: 14px; }
.marking-wizard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.marking-wizard-step {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.marking-wizard-step.is-locked { opacity: .78; }
.marking-wizard-title { display: flex; align-items: flex-start; gap: 10px; }
.marking-wizard-title h3 { margin: 3px 0 0; }
.marking-wizard-number {
  display: inline-flex;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(103, 245, 204, .48);
  border-radius: 50%;
  background: rgba(103, 245, 204, .1);
  color: var(--mint);
  font-weight: 900;
}
.marking-wizard-step > .draft-pill { align-self: flex-start; white-space: normal; overflow-wrap: anywhere; }
.marking-wizard-step .form { margin-top: 0; }
.marking-saved-connection details { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.marking-saved-connection summary { color: var(--mint); cursor: pointer; font-weight: 800; }
.marking-saved-connection details[open] summary { margin-bottom: 12px; }
.marking-preview-note { border-left: 4px solid #f3bd56; }
.marking-code-filter-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.marking-code-filter-form label { min-width: 0; color: var(--muted); font-size: .82rem; }
.marking-code-filter-form input,
.marking-code-filter-form select { width: 100%; margin-top: 6px; }
.marking-code-filter-actions { display: flex; grid-column: 1 / -1; flex-wrap: wrap; gap: 8px; }
.marking-code-filter-form > .error { grid-column: 1 / -1; }
.marking-code-import { margin-top: 18px; }
.marking-code-import textarea { width: 100%; min-height: 210px; resize: vertical; font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.marking-code-preview { display: grid; gap: 14px; margin-top: 18px; }
.marking-code-preview-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.marking-code-preview-metrics span { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .025); }
.marking-code-preview-metrics small { color: var(--muted); }
.marking-overview-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; }
.marking-signer-setup { margin-top: 18px; }
.marking-signer-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0; }
.marking-signer-select { display: grid; gap: 6px; color: var(--muted); font-size: .82rem; }
.marking-certificate-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.marking-certificate-meta div { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .025); }
.marking-certificate-meta dt { color: var(--muted); font-size: .76rem; }
.marking-certificate-meta dd { margin: 5px 0 0; overflow-wrap: anywhere; }
.catalog-working-screen { display: grid; gap: 14px; }
.catalog-commandbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.catalog-commandbar-primary,
.catalog-commandbar-secondary,
.catalog-filter-row,
.catalog-pagination,
.catalog-editor-actions,
.catalog-inline-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.catalog-commandbar select,
.catalog-filter-row input,
.catalog-filter-row select,
.catalog-pagination select { min-height: 40px; }
.catalog-commandbar-secondary { margin-left: auto; justify-content: flex-end; }
.catalog-filter-row input { flex: 1 1 360px; min-width: 220px; }
.catalog-filter-row select { flex: 0 1 240px; }
.catalog-master-table { min-width: 1680px; }
.catalog-master-table th:first-child,
.catalog-master-table td:first-child { position: sticky; left: 0; z-index: 2; background: var(--panel); }
.catalog-pagination { justify-content: flex-end; color: var(--muted); font-size: .82rem; }
.catalog-editor-dialog { width: min(1180px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
.catalog-editor-form { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 18px; }
.catalog-editor-primary,
.catalog-editor-extra { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-content: start; }
.catalog-editor-primary > label:has(textarea),
.catalog-editor-extra > label:has(textarea),
.catalog-composition-field,
.catalog-inline-actions,
.catalog-editor-form > .error,
.catalog-editor-actions { grid-column: 1 / -1; }
.catalog-editor-form details { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.catalog-editor-form details summary { cursor: pointer; color: var(--mint); font-weight: 800; margin-bottom: 12px; }
.catalog-editor-form input,
.catalog-editor-form select,
.catalog-editor-form textarea { width: 100%; }
.catalog-editor-actions { justify-content: flex-end; }
.marking-reconcile { margin-top: 18px; }
.marking-reconcile-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.marking-reconcile-form label { min-width: 0; color: var(--muted); font-size: .82rem; }
.marking-reconcile-form input,
.marking-reconcile-form textarea { width: 100%; margin-top: 7px; }
.marking-reconcile-form textarea { min-height: 210px; resize: vertical; font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.marking-reconcile-form > .error,
.marking-reconcile-actions { grid-column: 1 / -1; }
.marking-reconcile-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.marking-reconcile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.marking-reconcile-result { min-width: 0; }

@media (max-width: 1040px) {
  .marking-function-legend { grid-template-columns: auto minmax(0, 1fr); }
  .marking-quick-connect-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .marking-quick-connect-form > .btn { width: 100%; }
  .marking-wizard-grid { grid-template-columns: 1fr; }
  .catalog-editor-form { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .marking-function-heading { align-items: stretch; flex-direction: column; }
  .marking-function-summary { align-items: flex-start; flex-direction: column; }
  .marking-preview-badge { width: 100%; justify-content: center; border-radius: 12px; }
  .marking-function-grid { grid-template-columns: 1fr; }
  .marking-function-row { align-items: flex-start; flex-direction: column; }
  .marking-quick-connect-form { grid-template-columns: 1fr; }
  .marking-workspace-nav { display: flex; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; }
  .marking-workspace-nav .btn { width: auto; flex: 0 0 auto; }
  .catalog-commandbar,
  .catalog-commandbar-primary,
  .catalog-commandbar-secondary,
  .catalog-filter-row,
  .catalog-pagination,
  .catalog-editor-primary,
  .catalog-editor-extra,
  .marking-reconcile-form,
  .marking-reconcile-grid { display: grid; grid-template-columns: 1fr; width: 100%; }
  .catalog-commandbar .btn,
  .catalog-commandbar select,
  .catalog-filter-row .btn,
  .catalog-filter-row input,
  .catalog-filter-row select,
  .catalog-pagination .btn,
  .catalog-pagination select,
  .catalog-editor-actions .btn,
  .marking-reconcile-actions .btn { width: 100%; }
  .marking-code-filter-form,
  .marking-code-preview-metrics,
  .marking-certificate-meta { grid-template-columns: 1fr; }
  .marking-code-filter-actions { display: grid; }
  .marking-code-filter-actions .btn { width: 100%; }
  .marking-signer-actions { display: grid; }
  .marking-signer-actions .btn { width: 100%; }
}

/* Compact workspace hierarchy: one owner/client navigation mode at a time. */
.nav-mode-switch { padding: 8px 10px 14px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.nav-mode-switch button { width: 100%; border: 1px solid rgba(112, 240, 205, .35); background: rgba(112, 240, 205, .08); color: var(--text); }
.nav-mode-switch button:hover { background: rgba(112, 240, 205, .14); }
.owner-entry { border-bottom: 0; border-top: 1px solid var(--line); margin: 0 0 10px; padding-top: 10px; }

/* Secondary marking capabilities stay available without taking over the page. */
.marking-detail-panel { padding: 0; overflow: hidden; }
.marking-detail-panel > summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; cursor: pointer; list-style: none; }
.marking-detail-panel > summary::-webkit-details-marker { display: none; }
.marking-detail-panel > summary span:first-child { display: grid; gap: 3px; }
.marking-detail-panel > summary small { color: var(--muted); font-weight: 500; }
.marking-detail-panel[open] > summary { border-bottom: 1px solid var(--line); }
.marking-detail-panel .marking-detail-grid { padding: 16px 18px 18px; }
.marking-plan-note { margin: -8px 0 18px; text-align: center; }

/* The dashboard starts with period, evidence and working modules. */
.dashboard-title { margin-bottom: 12px; }
.dashboard-title h1 { font-size: clamp(2rem, 4vw, 3.2rem); }
.dashboard-next-action { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.dashboard-next-action h2 { margin-bottom: 5px; }
.dashboard-next-action p { margin: 0; color: var(--muted); }
.central-work-card { min-height: 220px; }

@media (max-width: 900px) {
  .nav-mode-switch { flex: 0 0 auto; min-width: 210px; border: 0; margin: 0; padding: 0; }
  .dashboard-next-action { align-items: stretch; flex-direction: column; }
}

@media (max-width: 680px) {
  .dashboard-title h1 { font-size: 2rem; }
  .dashboard-next-action .btn { width: 100%; }
  .catalog-master-table { min-width: 1040px; }
}

/* Focused work surface for the marking cabinet.  It intentionally does not
   change the rest of the dark AGENYRA shell. */
.marking-workspace-shell {
  --text: #172033;
  --muted: #66758a;
  --line: #dce4ec;
  --card: #fff;
  --mint: #1769d8;
  color: #172033;
  display: grid;
  gap: 14px;
  padding: 4px 0 24px;
}
.marking-workspace-shell .card,
.marking-workspace-shell .marking-quick-connect,
.marking-workspace-shell .marking-function-center {
  background: #fff;
  border-color: #dce4ec;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(30, 52, 79, .06);
}
.marking-workspace-shell .small,
.marking-workspace-shell .source-note { color: #66758a; }
.marking-workspace-shell .notice { background: #edf5ff; color: #1e4e80; }
.marking-workspace-shell .status { color: #1769d8; }
.marking-workspace-shell .draft-pill { border-color: #cbd9e7; background: #f5f8fc; color: #55677b; }
.marking-workspace-shell .btn { border-radius: 8px; background: #1769d8; color: #fff; box-shadow: none; }
.marking-workspace-shell .btn.ghost { border-color: #cbd7e4; background: #fff; color: #28435d; }
.marking-workspace-shell .btn.ghost:hover { background: #eef5ff; border-color: #9fc0e5; }
.marking-workspace-shell .btn:disabled { background: #eef2f6; border-color: #e0e6ed; color: #94a2b2; }
.marking-workspace-shell input,
.marking-workspace-shell select,
.marking-workspace-shell textarea {
  border: 1px solid #cbd7e4;
  border-radius: 8px;
  background: #fff;
  color: #172033;
  box-shadow: none;
}
.marking-workspace-shell input:focus,
.marking-workspace-shell select:focus,
.marking-workspace-shell textarea:focus { outline: 3px solid rgba(23, 105, 216, .16); border-color: #1769d8; }
.marking-workspace-shell .marking-quick-connect { margin: 0; padding: 18px; }
.marking-workspace-shell .marking-workspace-nav { position: static; margin: 0; padding: 8px; border-color: #dce4ec; border-radius: 10px; background: #fff; backdrop-filter: none; box-shadow: 0 8px 24px rgba(30, 52, 79, .05); }
.marking-workspace-shell .marking-workspace-nav .active-tab { background: #e9f2ff; border-color: #b6d3f6; color: #1258b5; }
.marking-more-nav { position: relative; }
.marking-more-nav summary { cursor: pointer; list-style: none; padding: 10px 13px; border: 1px solid #cbd7e4; border-radius: 8px; color: #28435d; font-weight: 750; }
.marking-more-nav summary::-webkit-details-marker { display: none; }
.marking-more-nav[open] > div { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; display: grid; gap: 6px; min-width: 190px; padding: 8px; border: 1px solid #dce4ec; border-radius: 10px; background: #fff; box-shadow: 0 16px 36px rgba(26, 48, 75, .18); }
.marking-more-nav .btn { width: 100%; justify-content: flex-start; }
.marking-workspace-shell .marking-catalog-workspace { display: grid; gap: 16px; padding: 20px; }
.marking-workspace-shell .marking-context { display: flex; align-items: end; gap: 14px; margin: 0; padding: 0 0 16px; border-bottom: 1px solid #e4eaf1; }
.marking-workspace-shell .marking-context label { display: grid; gap: 6px; min-width: 220px; color: #52647a; font-size: .78rem; font-weight: 750; }
.marking-workspace-shell .marking-context select { min-height: 42px; }
.marking-context-fact { display: grid; gap: 2px; margin: 0; min-width: 160px; }
.marking-context-fact small { color: #718096; font-size: .75rem; }
.marking-context-fact b { color: #24364b; font-size: .9rem; font-weight: 750; }
.marking-workspace-shell .catalog-commandbar { padding: 0; }
.marking-workspace-shell .catalog-commandbar-primary { flex: 1; }
.marking-workspace-shell .catalog-commandbar-secondary { margin-left: 0; }
.marking-workspace-shell .catalog-commandbar select,
.marking-workspace-shell .catalog-filter-row input,
.marking-workspace-shell .catalog-filter-row select,
.marking-workspace-shell .catalog-pagination select { min-height: 42px; padding: 8px 11px; }
.marking-workspace-shell .catalog-table-wrap { border-color: #dce4ec; border-radius: 10px; background: #fff; }
.marking-workspace-shell .catalog-table th { background: #f6f8fb; color: #43546a; border-color: #dce4ec; font-weight: 800; }
.marking-workspace-shell .catalog-table td { background: #fff; color: #28394d; border-color: #e7edf3; }
.marking-workspace-shell .catalog-master-table th:first-child,
.marking-workspace-shell .catalog-master-table td:first-child { background: #f6f8fb; }
.marking-workspace-shell .catalog-pagination { padding-top: 2px; color: #66758a; }
.catalog-empty-state { display: grid; justify-items: center; gap: 8px; padding: 54px 24px; border: 1px dashed #b9c9da; border-radius: 10px; background: #f8fbfe; color: #66758a; text-align: center; }
.catalog-empty-state b { color: #24364b; font-size: 1.05rem; }
.catalog-empty-state p { max-width: 570px; margin: 0 0 8px; }
.marking-workspace-shell .marking-dialog { background: #fff; border-color: #dce4ec; color: #172033; box-shadow: 0 24px 80px rgba(15, 34, 57, .28); }
.marking-workspace-shell .marking-dialog::backdrop { background: rgba(20, 34, 51, .42); }

@media (min-width: 1100px) {
  .top + main.wrap:has(.marking-workspace-shell) { max-width: 1560px; }
}
@media (max-width: 680px) {
  .marking-workspace-shell .marking-workspace-nav { overflow-x: auto; flex-wrap: nowrap; }
  .marking-workspace-shell .marking-workspace-nav > .btn,
  .marking-workspace-shell .marking-more-nav { flex: 0 0 auto; }
  .marking-workspace-shell .marking-context { display: grid; grid-template-columns: 1fr; align-items: stretch; }
  .marking-workspace-shell .marking-context label { min-width: 0; }
  .marking-workspace-shell .catalog-commandbar-primary,
  .marking-workspace-shell .catalog-commandbar-secondary { display: grid; width: 100%; }
}

/* Cross-cabinet accessibility guards.  Keep keyboard navigation visible on
   public, client, owner and marking surfaces, not only on primary buttons. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid #70e6d3;
  outline-offset: 3px;
}

.marking-workspace-shell :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline-color: #1769d8;
}

/* Dense horizontal navigation and operational tables must stay inside the
   viewport while preserving an obvious, keyboard-scrollable work surface. */
.side,
.public-links,
.table-wrap,
.catalog-table-wrap,
.marking-workspace-nav {
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

@media (max-width: 900px) {
  .side { scroll-snap-type: inline proximity; }
  .side button,
  .nav-mode-switch { scroll-snap-align: start; }
}

@media (max-width: 680px) {
  :where(button, input, select, summary) { min-height: 44px; }
  textarea { min-height: 96px; }
}

/* Four public destinations must remain fully visible at the 390px release
   viewport; a compact 2x2 grid is clearer than a clipped scroll strip. */
@media (max-width: 430px) {
  .public-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    max-width: 100%;
    overflow: visible;
  }
  .public-link {
    width: 100%;
    min-width: 0;
    padding-inline: 6px;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* Motion is decorative; no product task depends on it. */
@media (prefers-reduced-motion: reduce) {
  html:focus-within { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Owner Agent Registry: 121 canonical discovery rows remain a compact,
   filterable disclosure list rather than a wall of executable-agent cards. */
.owner-agent-registry-filters {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}
.owner-agent-registry-filters label { min-width: 0; }
.owner-agent-registry-filters input,
.owner-agent-registry-filters select { width: 100%; min-width: 0; max-width: 100%; }
.owner-agent-registry-filters #ownerAgentRegistryFilterSummary { grid-column: 1 / -1; margin: 0; }
.owner-agent-compact-list { display: grid; gap: 6px; }
.owner-agent-registry-row {
  min-width: 0;
  border: 1px solid var(--line, rgba(255,255,255,.12));
  border-radius: 12px;
  background: rgba(255,255,255,.025);
  overflow: visible;
}
.owner-agent-registry-row[hidden] { display: none; }
.owner-agent-registry-row > summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
}
.owner-agent-registry-row > summary > span:first-child { display: grid; min-width: 0; }
.owner-agent-registry-row > summary b,
.owner-agent-registry-row > summary small { overflow-wrap: anywhere; }
.owner-agent-row-state { display: grid; justify-items: end; gap: 4px; text-align: right; }
.owner-agent-field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line, rgba(255,255,255,.12));
}
.owner-agent-field-grid > div { min-width: 0; overflow-wrap: anywhere; }
.owner-agent-field-grid p { margin-block: 4px 0; }
.owner-agent-field-wide { grid-column: 1 / -1; }
.owner-agent-row-warning { margin: 0 12px 12px; }

@media (max-width: 900px) {
  .owner-agent-registry-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .owner-agent-field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .owner-agent-registry-filters,
  .owner-agent-field-grid { grid-template-columns: minmax(0, 1fr); }
  .owner-agent-registry-row > summary { align-items: flex-start; flex-direction: column; }
  .owner-agent-row-state { width: 100%; max-width: 100%; justify-items: start; text-align: left; }
  .owner-agent-field-wide { grid-column: auto; }
}

/* Profit Audit is the only client surface with an explicit print/PDF action.
   Keep screen branding unchanged and isolate a legible, complete report. */
@media print {
  @page { size: landscape; margin: 8mm; }

  html,
  body {
    width: 100%;
    max-width: none;
    overflow: visible !important;
    background: #fff !important;
    color: #111 !important;
  }

  body * { visibility: hidden !important; }
  .profit-audit-print-ready,
  .profit-audit-print-ready * { visibility: visible !important; }
  .profit-audit-print-ready {
    position: absolute;
    inset: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #fff !important;
    color: #111 !important;
  }

  .profit-audit-print-ready [data-profit-audit-print],
  .profit-audit-print-ready button,
  .top,
  .side,
  #profitAuditForm { display: none !important; }
  .profit-audit-print-ready .page-title,
  .profit-audit-print-ready .section-head { display: block; margin: 0 0 5mm; }
  .profit-audit-print-ready .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3mm; }
  .profit-audit-print-ready .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4mm; }
  .profit-audit-print-ready .card,
  .profit-audit-print-ready .metric,
  .profit-audit-print-ready .notice {
    break-inside: avoid;
    border: 1px solid #bbb !important;
    background: #fff !important;
    color: #111 !important;
    box-shadow: none !important;
  }
  .profit-audit-print-ready .small,
  .profit-audit-print-ready .status,
  .profit-audit-print-ready .draft-pill { color: #222 !important; }
  .profit-audit-print-ready .table-wrap { width: 100%; max-width: none; overflow: visible !important; }
  .profit-audit-print-ready .profit-audit-table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 7pt;
  }
  .profit-audit-print-ready .profit-audit-table thead { display: table-header-group; }
  .profit-audit-print-ready .profit-audit-table tr { break-inside: avoid; }
  .profit-audit-print-ready .profit-audit-table th,
  .profit-audit-print-ready .profit-audit-table td {
    padding: 2.2mm 1.2mm;
    border: 1px solid #bbb;
    white-space: normal !important;
    overflow-wrap: anywhere;
    color: #111 !important;
    background: #fff !important;
    vertical-align: top;
  }
}
