/* Operator UI: readable type, stable controls, and bounded mobile editors.
   Customer font choices still apply to their public reporting surfaces. */
body.workspace-mode, body.login-mode {
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: var(--sans);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
}
.workspace-mode :is(button, input, select, textarea) { font-family: var(--sans); }
.login-mode :is(h1, h2) { font-family: var(--sans); font-weight: 600; letter-spacing: -.025em; line-height: 1.25; }
.workspace-mode :is(h1, h2, h3) { font-family: var(--sans); line-height: 1.3; letter-spacing: -.015em; }
.workspace-mode :is(.console-page-head, .command-head) h1 { font-size: 26px; font-weight: 650; letter-spacing: -.025em; line-height: 1.25; }
.workspace-mode :is(.detail-head, .settings-card, .surface-head) h2 { font-size: 20px; font-weight: 650; letter-spacing: -.015em; }
.workspace-mode .object-card h3 { font-size: 18px; font-weight: 600; }
.workspace-mode .playbook-intro h2 { font-size: 26px; font-weight: 600; }
.workspace-mode :is(.primary, .secondary, .sign-out-button) { min-height: 40px; font-size: 13px; font-weight: 600; line-height: 1.3; }
.workspace-mode .icon-button { flex-shrink: 0; min-width: 40px; min-height: 40px; }
.workspace-mode :is(.editor-form, .settings-form, .configuration-builder) label { font-size: 14px; font-weight: 600; line-height: 1.45; }
.workspace-mode :is(.editor-form, .settings-form) :is(input, textarea, select) { font-size: 14px; line-height: 1.5; }
.workspace-mode textarea:not(.code-input) { font-family: var(--sans); }
.workspace-mode :is(.console-page-head .page-title-group > p:last-child, .detail-head p:last-child, .object-card > p, .validation-summary, .form-help, .form-field-card p, .settings-card p, .safety-boundary span) { font-size: 13px; font-weight: 400; line-height: 1.55; }
.workspace-mode :is(small, .object-card-meta span, .object-card-meta strong, .badge, .segmented-tabs button) { font-size: 12px; line-height: 1.5; }
.workspace-mode label small { color: var(--muted); font-weight: 400; }
.workspace-mode .sidebar nav a { min-height: 44px; font-size: 14px; line-height: 1.4; }
.workspace-mode .sidebar .navigation-expand { flex-basis: 44px; height: 44px; }
.workspace-mode .sidebar .navigation-admin-toggle { min-height: 44px; font-size: 14px; }
.workspace-mode .configuration-tabs { max-width: 100%; }
.workspace-mode .configuration-tabs button { min-height: 44px; padding: 10px 14px; font-size: 14px; white-space: normal; }
.configuration-dialog[open] { display: flex; flex-direction: column; width: min(820px, calc(100% - 32px)); max-height: min(900px, calc(100dvh - 32px)); overflow: hidden; }
.configuration-dialog .detail-head { position: static; flex: 0 0 auto; gap: 16px; }
.configuration-dialog .configuration-form { display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 0; gap: 0; }
.configuration-fields { padding: 24px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; display: grid; gap: 20px; }
.configuration-dialog .editor-footer { flex: 0 0 auto; padding: 14px 24px; background: var(--paper); flex-wrap: wrap; gap: 8px; }
.configuration-dialog .editor-footer > div { margin-left: auto; flex-wrap: wrap; }
.configuration-dialog .editor-footer .error:empty { display: none; }
.configuration-dialog .editor-footer .error:not(:empty) { flex-basis: 100%; margin: 0; }
.configuration-builder, .configuration-section { display: grid; gap: 18px; min-width: 0; }
.configuration-builder label, .configuration-fields > label { display: grid; gap: 6px; }
.configuration-builder h3 { margin: 0; font-size: 18px; font-weight: 600; }
.configuration-builder p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.configuration-section + .configuration-section { border-top: 1px solid var(--line); padding-top: 24px; }
.configuration-section-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.configuration-section-heading p { margin-top: 6px; }
.configuration-section-heading > button { flex-shrink: 0; }
.configuration-empty, .configuration-retained { padding: 14px; border-radius: 8px; background: #f5f7f6; }
.workspace-mode .configuration-builder fieldset { margin: 0; padding: 16px; gap: 16px; min-width: 0; }
.workspace-mode .configuration-builder legend { font-size: 14px; font-weight: 600; }
.configuration-rule-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.routing-condition { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 14px; background: #f5f7f6; border-radius: 8px; align-items: end; }
.configuration-builder :is(input, select, textarea) { min-width: 0; width: 100%; }
.configuration-builder textarea { padding: 12px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; min-height: 100px; }
.configuration-builder .checkbox { display: flex; align-items: start; gap: 10px; font-weight: 400; }
.configuration-builder .checkbox input { width: 20px; min-height: 20px; height: 20px; margin: 1px 0 0; flex-shrink: 0; }
.configuration-advanced { border-top: 1px solid var(--line); padding-top: 14px; min-width: 0; }
.configuration-advanced summary { cursor: pointer; font-size: 14px; font-weight: 600; padding-block: 8px; }
.configuration-advanced p { font-size: 13px; color: var(--muted); margin-top: 10px; }
.configuration-advanced label { display: grid; gap: 8px; }
.configuration-advanced .configuration-code { min-height: 180px; max-height: 360px; font: 13px/1.6 var(--safest-font-mono); }
.message-variable-buttons { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.message-preview { padding: 20px; border: 1px solid var(--line); border-radius: 10px; background: #f8faf9; }
.message-preview p { margin-block: 14px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.workspace-update { position: fixed; z-index: 25; bottom: max(16px, env(safe-area-inset-bottom)); right: 16px; left: 16px; margin-left: auto; max-width: 560px; display: flex; align-items: center; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: 0 4px 24px #14231c26; }
.workspace-update p { margin: 0; font-size: 14px; line-height: 1.5; }
.workspace-update button { flex-shrink: 0; }
.workspace-mode .case-section-tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.workspace-mode .case-section-tabs button { appearance: none; min-width: 0; min-height: 44px; border: 0; border-bottom: 3px solid transparent; border-radius: 4px 4px 0 0; font-size: 14px; font-weight: 500; line-height: 1.4; color: #526258; background: transparent; touch-action: manipulation; }
.workspace-mode .case-section-tabs button[aria-selected="true"] { border-bottom-color: #174c3c; color: #174c3c; background: #e8f1e8; font-weight: 600; }
@media (max-width: 760px) {
  /* iOS zooms focused fields below 16px. Keep native zoom available. */
  .workspace-mode input, .workspace-mode select, .workspace-mode textarea, .login-mode input, .login-mode select, .login-mode textarea { font-size: 16px !important; }
  :is(.workspace-mode, .login-mode) :is(input:not([type="checkbox"]):not([type="radio"]), select) { min-height: 44px; }
  :is(.workspace-mode, .login-mode) select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='m3 5 4 4 4-4' fill='none' stroke='%23647267' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; padding-right: 36px; }
  .workspace-mode :is(button, .primary, .secondary, .icon-button) { min-height: 44px; }
  .workspace-mode .sidebar .navigation-expand { flex-basis: 44px; }
  .workspace-mode :is(.console-page-head, .command-head) h1 { font-size: 24px; }
  .workspace-mode .detail-head h2 { font-size: 21px; }
  .workspace-mode .report-drawer .detail-head h2 { font-size: 16px; }
  .workspace-mode .case-section-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .workspace-update { flex-wrap: wrap; }
  .workspace-mode .configuration-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
  .workspace-mode .configuration-tabs button { width: 100%; padding: 10px 8px; }
  .workspace-mode .configuration-dialog[open] { inset: 0; width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .configuration-dialog .detail-head { padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); }
  .configuration-dialog .configuration-form { flex: 1; }
  .configuration-fields { flex: 1; padding: 20px 16px; }
  .configuration-dialog .editor-footer { padding: 12px 16px max(12px, env(safe-area-inset-bottom)); }
  .configuration-dialog .editor-footer > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; width: 100%; gap: 8px; }
  .configuration-dialog .editor-footer > div > button { width: 100%; }
  .configuration-builder .form-grid, .routing-condition { grid-template-columns: minmax(0, 1fr); }
  .configuration-section-heading { flex-wrap: wrap; }
}
.case-ownership { flex: 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 14px 24px; border-bottom: 1px solid var(--line, #dce3dd); background: #f5f8f5; }
.case-owner-copy { display: flex; align-items: center; gap: 10px; min-width: 0; }
.case-owner-copy strong { display: block; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.case-owner-copy p { margin: 2px 0 0; font-size: 13px; line-height: 1.45; color: #526258; }
.case-owner-empty { font-size: 25px; width: 28px; text-align: center; color: #526258; }
.case-owner-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.case-owner-actions button { min-height: 44px; font-size: 14px; }
.case-owner-status, .case-ownership > .error { flex-basis: 100%; font-size: 13px; line-height: 1.45; margin: 0; }
.ownership-filters { display: flex; gap: 6px; padding: 16px 20px 0; }
.ownership-filters button { min-height: 44px; padding: 8px 18px; border-radius: 24px; border: 1px solid #d2ddd4; font-size: 14px; font-weight: 600; color: #526258; background: white; }
.ownership-filters button[aria-pressed="true"] { color: #174c3c; background: #e8f1e8; border-color: #174c3c; }
.private-draft-status { margin: 0 0 12px; font-size: 13px; line-height: 1.5; color: #526258; }
.latest-handoff { padding: 12px 14px; margin: 0 0 16px; border: 1px solid #d2ddd4; border-radius: 8px; }
.latest-handoff summary { cursor: pointer; font-size: 14px; font-weight: 600; }
.latest-handoff p, .case-handoff-history p { white-space: pre-wrap; overflow-wrap: anywhere; }
.case-handoff-history article { padding: 16px 0; border-bottom: 1px solid #d2ddd4; }
.case-handoff-dialog { position: fixed; inset: 0; box-sizing: border-box; width: min(540px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 24px; border: 1px solid #d2ddd4; border-radius: 16px; background: white; color: #25332b; overflow-y: auto; box-shadow: 0 16px 64px #14271b33; }
.case-handoff-dialog::backdrop { background: #17291fc0; }
.case-handoff-dialog form { display: grid; gap: 16px; }
.case-handoff-dialog h2 { margin: 0; font-size: 22px; line-height: 1.3; }
.case-handoff-dialog p { margin: 0; font-size: 15px; line-height: 1.5; }
.case-handoff-dialog label { display: grid; gap: 8px; font-size: 14px; font-weight: 600; }
.case-handoff-dialog :is(select, textarea) { box-sizing: border-box; width: 100%; min-height: 44px; padding: 12px; border: 1px solid #b7c5ba; border-radius: 8px; background: white; color: inherit; font: inherit; font-size: 16px; font-weight: 400; }
.case-handoff-dialog .handoff-privacy { font-size: 13px; color: #526258; }
.handoff-actions { display: flex; justify-content: flex-end; gap: 8px; }
.handoff-actions button { min-height: 44px; }
@media (max-width: 680px) {
  .case-ownership { padding: 10px 16px; gap: 8px; }
  .case-owner-actions { width: 100%; gap: 6px; }
  .case-owner-actions button { padding: 8px 10px; font-size: 13px; }
  .case-handoff-dialog { padding: 20px; }
}
