.aps-workspace-panel {
  padding: 0 clamp(10px, 1.6vw, 24px) 24px;
}

.aps-workspace-hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 174px;
  border: 1px solid #c7def4;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(115deg, #f1f8ff 20%, #e4f2ff 67%, #c6e6fc);
}

.aps-workspace-hero-copy {
  z-index: 1;
  width: min(70%, 740px);
  padding: clamp(16px, 2.5vw, 32px);
}

.aps-workspace-hero h1 {
  margin: 0;
  color: #12264c;
  font-size: clamp(24px, 3.2vw, 39px);
  line-height: 1.14;
}

.aps-workspace-hero p {
  margin: 8px 0 16px;
  color: #2a456d;
}

.aps-workspace-illustration {
  position: absolute;
  inset: 0 0 0 auto;
  width: clamp(185px, 26%, 310px);
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, #000 38%);
  pointer-events: none;
}

.aps-workspace-illustration img {
  position: absolute;
  right: -277%;
  top: -45%;
  width: 619%;
  height: 495%;
  max-width: none;
}

[data-painel="prontuario"] .aps-workspace-illustration img { right: -199%; top: -51%; height: 570%; }
[data-painel="prescricoes"] .aps-workspace-illustration img { right: -245%; }
[data-painel="exames"] .aps-workspace-illustration img { right: -266%; top: -53%; height: 560%; }
[data-painel="documentos"] .aps-workspace-illustration img { right: -216%; top: -45%; height: 510%; }

.aps-workspace-loading,
.aps-workspace-card {
  padding: clamp(13px, 1.5vw, 21px);
}

.aps-workspace-loading { margin-top: 13px; }
.aps-workspace-loading p { margin: 0 0 8px; }

.aps-workspace-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.aps-workspace-metric {
  display: flex;
  flex-direction: column;
  align-items: start;
  justify-content: center;
  gap: 4px;
  min-height: 82px;
  padding: 12px 15px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.aps-workspace-metric:hover { border-color: #7fb5f7; }
.aps-workspace-metric span { font-weight: 600; font-size: .83rem; }
.aps-workspace-metric strong { color: #0756c5; font-size: 1.55rem; line-height: 1.1; }

.aps-workspace-card { min-width: 0; }
.aps-workspace-card h2 { margin: 0 0 11px; color: #162c55; font-size: 1.12rem; }
.aps-workspace-side { display: grid; align-content: start; gap: 11px; min-width: 0; }
.aps-workspace-side .aps-workspace-controls { margin-top: 9px; }
.aps-workspace-controls .section-button { min-height: 36px; }
.aps-workspace-patient { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.aps-workspace-side small { display: block; margin-top: 4px; color: #385676; }
.aps-workspace-save-status { margin: 0 0 12px; color: #1c684c; font-size: .86rem; }
.aps-workspace-save-status:empty { display: none; }

.aps-workspace-controls,
.aps-workspace-search,
.aps-workspace-paging {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.aps-workspace-search label { flex: 1 1 145px; }
.aps-workspace-search input,
.aps-workspace-search select { min-height: 38px; }
.aps-workspace-table-scroll { max-width: 100%; overflow: auto; }
.aps-workspace-table-scroll table { width: 100%; border-collapse: collapse; text-align: left; }
.aps-workspace-table-scroll :is(td,th) {
  padding: 10px 7px;
  border-bottom: 1px solid #dfebf6;
  font-size: .83rem;
}
.aps-workspace-table-scroll th { color: #304d72; background: #eef6ff; }
.aps-workspace-row-action {
  border: 0;
  padding: 2px;
  background: none;
  color: #054eab;
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}
.aps-workspace-row-action:hover { text-decoration: underline; }
.aps-workspace-status-chip {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 10px;
  background: #e5f0ff;
  color: #194477;
  font-size: .77rem;
}
.aps-workspace-empty { padding: 12px 0; color: #405977; }
.aps-workspace-paging { justify-content: space-between; margin-top: 9px; color: #405977; font-size: .82rem; }

.aps-workspace-popover .dialog-fields { margin: 8px 0; }
.dialog-fields label[hidden] { display: none; }
.dialog-fields .pec-check { display:flex; align-items:center; gap:8px; }
.dialog-fields .pec-check input { width:20px; height:20px; flex:none; }
.pec-queue-person { display:inline-flex; align-items:center; gap:7px; }
.pec-patient-avatar {
  position:relative; display:inline-grid; place-items:center; flex:none; width:30px; height:30px; overflow:hidden;
  border-radius:50%; background:#e1e8ef; color:#284562; font-size:11px; font-weight:700;
}
.pec-patient-avatar img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; visibility:hidden; }
.pec-patient-avatar.has-photo img { visibility:visible; }
.workspace[data-theme="dark"] .pec-patient-avatar { background:var(--aps-dark-control); color:var(--aps-dark-text); }
.pec-medication-list fieldset { min-width:0; margin:8px 0; border:1px solid var(--line); border-radius:9px; }
.pec-evolution-text { white-space:pre-wrap; overflow-wrap:anywhere; }
.pec-pharmacy-queue { margin-bottom:12px; }
#view-farmacia[data-restricted] :is(.aps-workspace-metrics,.aps-workspace-side,.aps-workspace-illustration,.reference-main-content,.aps-workspace-body > .section-panel:not(.pec-pharmacy-queue),.reference-assistant) { display:none; }
#view-farmacia[data-restricted] .aps-workspace-columns { grid-template-columns:minmax(0,1fr); }
.aps-workspace-popover h3 { margin: 12px 0 8px; font-size: 1rem; }
.aps-workspace-popover .aps-workspace-controls { margin: 14px 0 3px; }
.aps-workspace-popover .dialog-fields textarea { min-height: 90px; }
.aps-workspace-results {
  padding: 0;
  margin: 8px 0;
  list-style: none;
}
.aps-workspace-results li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding: 8px 0;
  gap: 6px;
  border-bottom: 1px solid #dbe7f5;
}
.aps-workspace-results li > span { min-width: 0; overflow-wrap: anywhere; }
.aps-workspace-results li small { display: block; color: #324c65; }
.aps-workspace-popover .aps-workspace-note { white-space: pre-wrap; overflow-wrap: anywhere; }
.aps-workspace-popover [role="alert"]:empty { display: none; }
.aps-workspace-popover [role="alert"] { color: #a42532; }

.workspace[data-theme="dark"] .aps-workspace-card,
.workspace[data-theme="dark"] .aps-workspace-metric,
.workspace[data-theme="dark"] .aps-workspace-loading {
  background: #193551;
  border-color: #3a5f86;
  color: #edf5ff;
}
.workspace[data-theme="dark"] .aps-workspace-card :is(h2,small),
.workspace[data-theme="dark"] .aps-workspace-paging,
.workspace[data-theme="dark"] .aps-workspace-empty { color: #d1e6ff; }
.workspace[data-theme="dark"] .aps-workspace-save-status { color: #9ae2bd; }
.workspace[data-theme="dark"] .aps-workspace-metric strong,
.workspace[data-theme="dark"] .aps-workspace-row-action { color: #9bcaff; }

@container (max-width: 850px) {
  .aps-workspace-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (max-width: 500px) {
  .aps-workspace-hero-copy { width: 100%; }
  .aps-workspace-illustration { opacity: .14; }
  .aps-workspace-table-scroll table { min-width: 480px; }
}

:is(#view-dashboard,.clinical-tab)[aria-busy="true"] > :not(.aps-legacy-loading) { display: none; }
.aps-legacy-loading { margin: 16px; }
.aps-legacy-empty { margin: 8px 6px; color: #405977; font-size: .85rem; line-height: 1.4; }
.history-list button {
  border: 0;
  padding: 2px 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
}
.report-filters label:last-of-type { display: grid; }
@container (min-width: 1220px) {
  .report-filters { grid-template-columns: repeat(5,minmax(0,1fr)) auto auto; }
}
.aps-operation-toast {
  position: fixed;
  z-index: 10;
  bottom: 16px;
  right: 16px;
  width: auto;
  height: auto;
  max-width: min(420px,calc(100vw - 40px));
  padding: 12px 15px;
  overflow: visible;
  clip-path: none;
  color: #fff;
  background: #16426f;
  box-shadow: 0 3px 12px #113d6b4a;
  border-radius: 9px;
}
#screen[data-theme="dark"] { color-scheme: dark; }
.workspace[data-theme="dark"] { background: #10233b; color: #edf5ff; }
.workspace[data-theme="dark"] .aps-legacy-empty { color: #c4dcf9; }
.workspace[data-theme="dark"] :is(.upper-panel,.lower-panel) { background: #193551; border-color: #3a5f86; }
.workspace[data-theme="dark"] :is(.lower-panel small,.lower-head > button,.calendar-footer .text-action) { color: #c4dcf9; }
.workspace[data-theme="dark"] :is(.quick-grid button,.chat-options button,.chat-feed p,.result-metrics button,.med-reminder) { background: #27445f; color: #edf5ff; }
.workspace[data-theme="dark"] :is(.recent-list button,.file-list button,.agenda-preview button,.recent-notices button):hover { background: #27445f; }
.workspace[data-theme="dark"] .report-filters label { color: #edf5ff; }
#dash-dialog[data-theme="dark"] { background: #193551; color: #edf5ff; --ink: #edf5ff; }
#dash-dialog[data-theme="dark"] :is(input,textarea,select) { background: #16314c; color: #edf5ff; }
#dash-dialog[data-theme="dark"] [role="alert"] { color: #ffc6cc; }

.aps-rail-columns, .clinical-tab .tab-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(234px, 26%);
  align-items: start;
  gap: 14px;
}
.dashboard-columns { padding: 17px 11px 16px; }
.dashboard-main, .aps-rail-main, .aps-workspace-main { min-width: 0; }
.dashboard-main { display: grid; gap: 11px; }
#view-dashboard .upper-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
  padding: 0;
}
.dashboard-side .lower-right, .clinical-tab .tab-columns > aside { grid-template-columns: minmax(0, 1fr); }
.aps-rail-main .report-intro { grid-template-columns: minmax(0, 1fr); }
.aps-rail-main .settings-hero::after { right: 0; width: 48%; }
.aps-rail-columns .section-reminders { margin-top: 8px; }
.aps-rail-columns .calendar-head [data-month-title] {
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.calendar-head .calendar-step { flex: 0 0 auto; }
.aps-rail-columns .calendar-days { grid-template-columns: repeat(7,minmax(0,1fr)); }
.aps-rail-columns .calendar-days button { min-width: 0; padding-inline: 1px; }
.aps-rail-columns .calendar-days button small { display: block; margin: 0 0 2px; font-size: 9px; }
.workspace[data-theme="dark"] .aps-workspace-side > .section-panel { background: #193551; border-color: #3a5f86; }

@container (max-width: 1219px) {
  .aps-rail-main :is(.report-filters,.report-grid) { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@container (max-width: 1030px) {
  #view-dashboard .metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .clinical-tab .settings-grid { grid-template-columns: minmax(0,1fr); }
}
@container (max-width: 925px) {
  #view-dashboard .upper-dashboard,
  .clinical-tab :is(.agenda-intro,.patients-intro,.patients-workspace,.queue-workspace) { grid-template-columns: minmax(0,1fr); }
  #view-dashboard .metrics { grid-column: 1; }
  #view-dashboard .lower-row, #view-dashboard .results-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@container (max-width: 740px) {
  .aps-rail-columns, .clinical-tab .tab-columns { grid-template-columns: minmax(0, 1fr); }
}
@container (max-width: 485px) {
  #view-dashboard .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #view-dashboard :is(.lower-row,.results-row), .aps-rail-main .report-grid { grid-template-columns: minmax(0,1fr); }
}


/* Reference layouts share the same live cards, filters and file actions. */
.aps-workspace-panel[data-painel] { padding: 17px 11px 20px; }
.aps-workspace-panel.reference-full > .aps-rail-columns { grid-template-columns: minmax(0,1fr); }
.reference-intro {
  display: grid;
  grid-template-columns: minmax(0,1.82fr) minmax(235px,1fr);
  gap: 12px;
  margin-bottom: 13px;
}
[data-painel="prontuario"] .reference-intro { grid-template-columns: minmax(0,2.15fr) minmax(260px,1fr); }
[data-painel="prescricoes"] .reference-intro { grid-template-columns: minmax(0,2.45fr) minmax(225px,1fr); }
[data-painel="documentos"] .reference-intro { grid-template-columns: minmax(0,1.55fr) minmax(250px,1fr); }
.reference-intro .aps-workspace-hero { min-height: 192px; padding: 0; align-items: stretch; }
:is([data-painel="atendimento"],.reference-inventory) .reference-intro .aps-workspace-hero { min-height: 212px; }
[data-painel="prontuario"] .aps-workspace-hero { min-height: 158px; }
.reference-intro .aps-workspace-hero-copy { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 20px; }
.reference-intro .aps-workspace-hero h1 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  column-gap: .22em;
  max-width: 78%;
  color: #10213c;
  font-size: clamp(23px,2.25vw,35px);
  font-weight: 760;
  letter-spacing: -.035em;
}
.reference-intro .aps-workspace-hero h1 > span { color: #005ce9; }
.reference-intro .aps-workspace-hero h1 .dash-icon { width: 1em; height: 1em; }
.reference-intro .aps-workspace-hero p { max-width: 65%; margin: 8px 0 12px; font-size: .90rem; }
.reference-hero-actions { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 5px; }
.reference-hero-actions .primary-action { min-height: 38px; }
.reference-intro .reference-inline-primary { display: none; }
.reference-hero-actions:has(> .reference-inline-primary:only-child) { display: none; }
.reference-assistant {
  min-width: 0;
  background: linear-gradient(120deg,#f5fbff 0%,#e5f2ff 66%,#d1eafa 100%);
  border-color: #b6dafa;
}
.reference-assistant h2 { font-size: clamp(15px,1.35vw,20px); }
.reference-assistant p { font-size: .84rem; line-height: 1.4; }
.reference-assistant .section-assist-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
[data-painel="prontuario"] .reference-assistant .section-assist-grid { grid-template-columns: 1fr; }
.reference-assistant .section-button { justify-content: flex-start; min-height: 42px; text-align: left; color: #14345e; }

/* Each hero uses only the illustration region of its original reference. */
.aps-workspace-panel[data-painel] .aps-workspace-illustration {
  inset: auto 0 0 auto;
  width: min(43%,calc(var(--reference-art-width) * 1px - 3px));
  aspect-ratio: var(--reference-art-width) / var(--reference-art-height);
  mask-image: linear-gradient(to right,transparent 0%,#000 36%);
}
.aps-workspace-panel[data-painel] .aps-workspace-illustration img {
  inset: auto;
  left: calc(-100% * var(--reference-art-x) / var(--reference-art-width));
  top: calc(-100% * var(--reference-art-y) / var(--reference-art-height));
  width: calc(1672 * 100% / var(--reference-art-width));
  height: auto;
}
[data-painel="atendimento"] { --reference-art-x: 650; --reference-art-y: 82; --reference-art-width: 269; --reference-art-height: 221; }
[data-painel="prontuario"] { --reference-art-x: 742; --reference-art-y: 83; --reference-art-width: 426; --reference-art-height: 161; }
[data-painel="prescricoes"] { --reference-art-x: 694; --reference-art-y: 79; --reference-art-width: 308; --reference-art-height: 220; }
[data-painel="exames"] { --reference-art-x: 675; --reference-art-y: 80; --reference-art-width: 277; --reference-art-height: 164; }
[data-painel="documentos"] { --reference-art-x: 696; --reference-art-y: 82; --reference-art-width: 385; --reference-art-height: 199; }
[data-painel="vacinacao"],[data-painel="almoxarifado"],[data-painel="farmacia"] {
  --reference-art-x: 682; --reference-art-y: 82; --reference-art-width: 237; --reference-art-height: 221;
}

.aps-workspace-panel[data-painel] .aps-workspace-metrics {
  grid-template-columns: repeat(auto-fit,minmax(min(145px,100%),1fr));
  gap: 10px;
  margin: 0 0 13px;
}
.aps-workspace-panel[data-painel] .aps-workspace-metric { min-height: 80px; flex-direction: row; align-items: flex-start; justify-content: start; padding: 10px; gap: 9px; }
.reference-metric-icon {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e1f2ff;
}
.reference-metric-icon .dash-icon { width: 21px; height: 21px; }
.aps-workspace-metric:nth-child(2) .reference-metric-icon { background: #fff1d5; }
.aps-workspace-metric:nth-child(2) .reference-metric-icon svg { color: #9d5000; }
.aps-workspace-metric:nth-child(4) .reference-metric-icon { background: #e8e5ff; }
.aps-workspace-metric:nth-child(4) .reference-metric-icon svg { color: #5740c4; }
.aps-workspace-metric:nth-child(5) .reference-metric-icon { background: #e0f7eb; }
.aps-workspace-metric:nth-child(5) .reference-metric-icon svg { color: #16804c; }
.reference-metric-label { display: grid; align-content: start; gap: 5px; min-width: 0; }
.aps-workspace-metric .reference-metric-label > span { font-size: .75rem; }
.aps-workspace-metric .reference-metric-label > strong { color: #112343; font-size: 1.48rem; white-space: normal; }
.reference-record-grid,.reference-inventory-grid,.reference-care-grid,.reference-care-bottom {
  display: grid;
  min-width: 0;
  gap: 11px;
  grid-template-columns: repeat(3,minmax(0,1fr));
}
.reference-care-bottom { grid-template-columns: 1.4fr 1fr; }
.reference-inventory-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
.reference-record-grid { grid-template-columns: minmax(0,.9fr) minmax(0,1.35fr) minmax(0,1.1fr); }
.reference-card { padding: 11px 12px; }
.reference-card .section-panel-head { gap: 4px; }
.reference-card .section-panel-head h2 { margin: 0; font-size: .96rem; letter-spacing: -.023em; align-items: center; }
.reference-card .section-panel-head .dash-icon { width: 19px; height: 19px; }
.reference-card .text-action { white-space: normal; text-align: left; }
.reference-card > p,.reference-card .aps-workspace-empty { margin: 7px 0 0; padding: 0; color: #345172; font-size: .80rem; line-height: 1.4; }
.reference-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.reference-list li + li { border-top: 1px solid #dce9f7; }
.reference-item-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 39px;
  border: 0;
  padding: 5px 3px;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
}
button.reference-item-button:hover { background: #e4f0ff; }
.reference-item-button b,.reference-item-button small { display: block; }
.reference-item-button b { font-size: .76rem; }
.reference-item-button small { margin-top: 2px; color: #2f4c72; font-size: .69rem; }
.reference-item-button .aps-workspace-status-chip { padding: 2px 5px; font-size: .66rem; min-width: max-content; }
.reference-quick-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
.reference-quick-grid button { min-height: 46px; padding: 5px 3px; font-size: .72rem; overflow-wrap: anywhere; }
.reference-workspace-content:not(:empty) { display: grid; gap: 11px; }
.reference-main-content > .reference-table-card { margin-top: 11px; }
.reference-main-content > .reference-workspace-content:empty + .reference-table-card { margin-top: 0; }
[data-painel="prescricoes"] .reference-main-content {
  display: grid;
  grid-template-columns: minmax(0,2.24fr) minmax(190px,1fr);
  gap: 11px;
  align-items: start;
}
[data-painel="prescricoes"] .reference-main-content .reference-workspace-content { grid-column: 2; grid-row: 1; }
[data-painel="prescricoes"] .reference-main-content .reference-table-card { grid-column: 1; grid-row: 1; margin-top: 0; }
.reference-notes-preview {
  min-height: 86px;
  margin: 8px 0 6px;
  padding: 10px;
  border: 1px solid #ccdef3;
  border-radius: 6px;
  color: #243d5c;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: .88rem;
}
.reference-patient-heading { display: flex; align-items: center; gap: 8px; }
.reference-card dl { margin: 7px 0; }
.reference-card dl > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 7px; border-bottom: 1px solid #dce9f7; padding: 4px 0; font-size: .75rem; }
.reference-card dt { font-weight: 700; }
.reference-card dd { margin: 0; overflow-wrap: anywhere; }
.reference-card > .section-button { margin: 2px 4px 2px 0; }
.reference-tabs .section-button { min-height: 32px; }
.reference-table-head .reference-tabs:empty { display: none; }
.reference-table-head > .mode-buttons { display: flex; flex-wrap: wrap; align-items: center; }
.reference-table-card .aps-workspace-table-scroll table { min-width: 540px; }
.reference-table-card td,.reference-table-card th { padding: 9px 6px; }
.reference-table-card .aps-workspace-status-chip { white-space: nowrap; }
.aps-workspace-status-chip:is([data-status="Ativa"],[data-status="Concluído"],[data-status="Disponível"],[data-status="Validado"]) { color: #135b38; background: #d7f5e6; }
.aps-workspace-status-chip:is([data-status="Pendente"],[data-status="Em análise"],[data-status="Aguardando coleta"]) { color: #76500d; background: #ffedc4; }
.aps-workspace-status-chip:is([data-status="Sinalizado"],[data-status="Cancelada"]) { color: #912236; background: #fce2e8; }
.reference-more-actions { position: relative; }
.reference-more-actions summary { color: #0b4da0; font-size: .79rem; font-weight: 650; cursor: pointer; }
.reference-more-actions .aps-workspace-controls {
  display: flex; position: absolute; right: 0; top: calc(100% + 5px); z-index: 4; width: min(254px,72vw);
  padding: 9px; border: 1px solid #c5daf6; border-radius: 10px; background: #f5faff;
}
@container (max-width: 600px) {
  .reference-table-head { position: relative; }
  .reference-more-actions { position: static; }
  .reference-more-actions .aps-workspace-controls { inset-inline: 0; width: auto; }
}
.reference-distribution { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; }
.reference-distribution .ring { flex: 0 0 77px; margin: 4px 0; }
.reference-distribution .ring strong { font-size: 17px; }
.reference-distribution ul { flex: 1 1 75px; list-style: none; margin: 0; padding: 0; font-size: .68rem; line-height: 1.4; }
.reference-distribution li { display: flex; gap: 5px; justify-content: space-between; }
.reference-chat-feed { margin: 8px 0; height: auto; min-height: 80px; }
.reference-chat-feed p { padding: 5px 9px; font-size: .8rem; }
.workspace[data-theme="dark"] .reference-card dl > div,.workspace[data-theme="dark"] .reference-list li + li { border-color: #3a5f86; }
.workspace[data-theme="dark"] .reference-card :is(p,small),.workspace[data-theme="dark"] .reference-metric-label > strong { color: #dcecff; }
.workspace[data-theme="dark"] .reference-notes-preview { border-color: #456d93; color: #e5f2ff; }
.workspace[data-theme="dark"] button.reference-item-button:hover { background: #264965; }

@container (max-width: 1180px) {
  .reference-inventory-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .reference-care-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .reference-care-grid > :last-child { grid-column: 1 / -1; }
}
@container (max-width: 980px) {
  .reference-intro { grid-template-columns: minmax(0,1fr); }
  [data-painel="prescricoes"] .reference-main-content { grid-template-columns: minmax(0,1fr); }
  [data-painel="prescricoes"] .reference-main-content .reference-workspace-content { grid-column: 1; grid-row: 1; }
  [data-painel="prescricoes"] .reference-main-content .reference-table-card { grid-column: 1; grid-row: 2; }
}
@container (max-width: 740px) {
  [data-painel] .reference-intro { grid-template-columns: minmax(0,1fr); }
  .reference-record-grid,.reference-care-bottom { grid-template-columns: minmax(0,1fr); }
}
@container (max-width: 440px) {
  .reference-inventory-grid,.reference-care-grid,.reference-care-bottom { grid-template-columns: minmax(0,1fr); }
  .aps-workspace-panel[data-painel] .aps-workspace-illustration { opacity: .25; }
  .reference-intro .aps-workspace-hero h1,.reference-intro .aps-workspace-hero p { max-width: 100%; }
}


/* Sizes and colors follow the supplied desktop reference art. */
.aps-reference-icon {
  display: inline-block;
  width: 19px;
  aspect-ratio: var(--icon-ratio);
  flex: none;
  background-image: var(--icon-image);
  background-size: var(--icon-size);
  background-position: var(--icon-position);
  background-repeat: no-repeat;
  vertical-align: middle;
  mix-blend-mode: multiply;
}
html:has(#screen.dashboard-view) { scrollbar-width: thin; scrollbar-color: #b8cde8 transparent; }
.reference-intro h1 > .aps-reference-icon { width: 1.08em; }
.reference-assistant h2 > .aps-reference-icon { width: 26px; }
.reference-assistant .section-button > .aps-reference-icon,
.reference-quick-grid .section-button > .aps-reference-icon { width: 22px; }
.reference-metric-icon > .aps-reference-icon { width: 25px; }
.reference-card .section-panel-head > h2 > .aps-reference-icon { width: 20px; }
.reference-table-head > h2 { display: flex; gap: 8px; align-items: center; margin: 0; font-size: 1.15rem; }
.reference-table-head > h2 > .aps-reference-icon { width: 23px; }
.reference-card .chat-options .aps-reference-icon,
.reference-reminders-card .reminder > .aps-reference-icon { width: 15px; }

.sidebar {
  background: linear-gradient(160deg,#00275a 0%,#00234c 46%,#022b61 72%,#043972 100%);
  box-shadow: none;
}
.sidebar .reference-brand-mark {
  width: 51px;
  height: auto;
  border-radius: 6px;
  background-color: transparent;
  box-shadow: none;
  mix-blend-mode: normal;
  mask-image: linear-gradient(90deg,transparent,#000 7%,#000 94%,transparent);
}
.sidebar .brand { padding-inline: 11px 0; gap: 12px; }
.sidebar:not(.is-open):not(:focus-within):not(:hover) .reference-brand-mark,
.sidebar[data-dismissed]:not(.is-open) .reference-brand-mark { width: 39px; }
.sidebar .brand-text { font-size: 20px; font-weight: 750; line-height: 1.10; }
.sidebar .menu { margin-top: 22px; gap: 1px; }
.sidebar .menu-item { grid-template-columns: 54px minmax(0,1fr); min-height: 40px; font-size: 15px; }
.sidebar .menu-item[aria-current="page"] {
  min-height: 43px;
  background: linear-gradient(130deg,#168afa,#0479f7 68%,#0871e2);
  border-color: #32a6ff;
  box-shadow: inset 0 1px 3px #76bdff40,0 3px 8px #00153155;
}
.sidebar-art {
  --sidebar-reference: url("/api/layout-references/atendimento.png");
  left: 0;
  transform: none;
  width: 222px;
  height: clamp(0px,calc(100dvh - 594px),335px);
  background: var(--sidebar-reference) left bottom / 1672px 941px no-repeat;
  mask-image: linear-gradient(transparent,#000 24px);
}
#screen[data-reference="vacinacao"] .sidebar-art { --sidebar-reference: url("/api/layout-references/vacinacao.png"); }
#screen[data-reference="farmacia"] .sidebar-art { --sidebar-reference: url("/api/layout-references/farmacia.png"); }
#screen[data-reference="almoxarifado"] .sidebar-art { --sidebar-reference: url("/api/layout-references/almoxarifado.png"); }

.workspace:not([data-theme="dark"]) {
  --ink: #0f1935;
  --blue: #005afa;
  --line: #cee1fa;
  background: linear-gradient(145deg,#fbfdff 0%,#f0f6fc 50%,#e7f2fd 100%);
}
.workspace:not([data-theme="dark"]) .dashboard-header {
  border-color: #dce9f9;
  background: linear-gradient(115deg,#fbfdff,#edf5fd 75%,#f2f7fd);
}
.workspace:not([data-theme="dark"]) .search-field { border-color: #bed9fc; box-shadow: 0 2px 6px #075bde18; }
.workspace .primary-action {
  border-color: #006cf7;
  background: linear-gradient(#087ffb 0%,#0668ed 49%,#0053dd 100%);
  box-shadow: 0 3px 8px #005cde28;
}
.workspace .primary-action:hover { background: linear-gradient(#0873eb,#004dcb); }
.workspace:not([data-theme="dark"]) :is(.tile,.lower-panel,.upper-panel,.metric) {
  border-color: #cfe2fa;
  box-shadow: 0 2px 4px #4a84cc14;
}
.workspace:not([data-theme="dark"]) :is(.tab-stack,.aps-workspace-side) .section-panel,
.workspace:not([data-theme="dark"]) .reference-card,
.workspace:not([data-theme="dark"]) .reference-table-card {
  background: linear-gradient(145deg,#fcfdff,#f3f8fd 62%,#edf5fe);
}
.workspace:not([data-theme="dark"]) :is(.assist,.reference-assistant,.patients-assist,.agenda-assist) {
  background: linear-gradient(125deg,#f5faff,#e1f1ff 70%,#cdeafb);
  border-color: #b5dafa;
}
.workspace:not([data-theme="dark"]) .section-button {
  color: #10315d;
  border-color: #c4dbf9;
  background: linear-gradient(144deg,#fbfdff,#e9f3fe);
}
.workspace:not([data-theme="dark"]) .section-button[aria-pressed="true"] {
  color: white;
  border-color: #075ded;
  background: linear-gradient(#087dfd,#0058df);
}
.workspace:not([data-theme="dark"]) .section-button[aria-pressed="true"] .aps-reference-icon {
  mix-blend-mode: normal;
  filter: brightness(0) invert(1);
}
.workspace:not([data-theme="dark"]) .reminder.red { background: #fce0e5; }
.workspace:not([data-theme="dark"]) .reminder.yellow { background: #fff0d7; }
.workspace:not([data-theme="dark"]) .reminder:not(.red):not(.yellow) { background: #dceefe; }
:is(.workspace,#dash-dialog)[data-theme="dark"] .aps-reference-icon {
  mix-blend-mode: screen;
  filter: grayscale(1) invert(1) brightness(1.75) contrast(1.45);
}
.workspace[data-theme="dark"] .reference-patient-facts { border-color: #456d93; }

.reference-calendar-card { min-height: 151px; }
.reference-calendar-card .calendar-head { min-height: 31px; }
.reference-calendar-card .calendar-head > .calendar-step { height: 28px; min-height: 28px; }
.reference-calendar-card .calendar-days { margin-top: 8px; margin-bottom: 6px; }
.reference-calendar-card .calendar-days button { min-height: 36px; }
.reference-calendar-card .calendar-days button[aria-pressed="true"] {
  background: linear-gradient(#087ef7,#0057e7);
  color: white;
}
.reference-calendar-card .calendar-days small { font-size: .62rem; }
.reference-reminders-card { min-height: 169px; }
.reference-reminders-card .section-reminders { display: grid; gap: 4px; }
.reference-reminders-card .reminder {
  display: flex;
  min-height: 26px;
  padding: 3px 8px;
  font-size: .79rem;
  line-height: 1.24;
}
.reference-notices-card { min-height: 170px; }
.reference-notices-card .recent-notices button { min-height: 40px; }
.reference-chat-card { min-height: 297px; }
.reference-chat-card .chat-form { margin-top: 8px; }
.reference-chat-card .chat-options button { display: inline-flex; gap: 4px; align-items: center; padding-inline: 8px; min-height: 30px; border-radius: 14px; }
.reference-chat-card .chat-options button .aps-reference-icon { margin: 0; }

.reference-table-disclosure { margin-top: 10px; }
.reference-table-disclosure summary {
  color: #0757b8;
  font-size: .78rem;
  cursor: pointer;
  padding: 5px 2px;
}
.reference-patient-facts dl { margin: 0; }
.reference-patient-shortcuts { display: grid; gap: 5px; }
.reference-patient-shortcuts .section-button { justify-content: start; }
.reference-record-patient > .section-panel-head { margin: 0; }
.reference-record-patient .reference-patient-heading .patient-initials {
  width: 68px;
  height: 68px;
  font-size: 1.22rem;
}
.reference-record-patient .reference-patient-heading b { font-size: 1.16rem; }
.reference-card .reference-patient-heading { margin: 0 0 8px; }
.reference-patient-facts { padding-block: 6px; }
.reference-assistant .section-button { gap: 7px; }

.settings-avatar-wrap { position: relative; width: 100%; }
.profile-button .avatar > img,.settings-avatar > img,.profile-photo-preview > img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.settings-photo-button {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #bdd9fa;
  border-radius: 50%;
  color: #0869ed;
  background: #f5fbff;
  box-shadow: 0 4px 10px #1b65b326;
  cursor: pointer;
}
.settings-photo-button:hover { background: #dfedff; }
.settings-photo-button:focus-visible { outline: 2px solid #0067e8; outline-offset: 2px; }
.profile-camera {
  position: relative;
  display: grid;
  place-items: center;
  width: 22px;
  height: 15px;
  border-radius: 4px;
  background: currentColor;
}
.profile-camera::before,.profile-camera::after { content: ""; }
.profile-camera::before { position: absolute; top: -3px; width: 9px; height: 5px; border-radius: 2px; background: inherit; }
.profile-camera::after { width: 8px; height: 8px; border: 2px solid #f5fbff; border-radius: 50%; }
.profile-photo-preview {
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  margin: 0 auto 12px;
  border-radius: 50%;
  color: #143a70;
  background: linear-gradient(145deg,#cdf0ff,#8bbbf2);
  font-size: 32px;
  font-weight: 700;
}
#profile-photo-hint { margin-bottom: 14px; text-align: center; }

@media (min-width: 1240px) {
  .sidebar,.workspace,#dash-dialog { font-family: Arial, "Segoe UI", sans-serif; }
  :is(.workspace,#dash-dialog) :is(button,input,select,textarea,kbd,table,.status-chip,.file-list i) {
    font-family: inherit;
  }
  .dashboard-header { min-height: 63px; padding-inline: 25px 20px; }
  .top-actions { gap: 14px; }
  .top-actions .primary-action { font-size: 15px; }
  .profile-button strong { font-size: 17px; line-height: 1.18; }
  .profile-button small { font-size: 13px; line-height: 1.2; }
  .sidebar .menu-item { font-size: 15.5px; }
}

@container (min-width: 1060px) {
  .dashboard-columns { padding: 18px 10px 19px 11px; }
  .aps-workspace-panel[data-painel],.clinical-tab { padding: 18px 10px 21px 15px; }
  .aps-rail-columns,.clinical-tab .tab-columns {
    gap: 15px;
    grid-template-columns: minmax(0,1fr) minmax(240px,calc(24% - 4px));
  }
  .schedule-view .tab-columns { grid-template-columns: minmax(0,1fr) minmax(260px,26.55%); }
  #view-dashboard .upper-dashboard {
    grid-template-columns: minmax(0,1.82fr) minmax(0,1fr);
    align-items: stretch;
    gap: 14px 15px;
  }
  #view-dashboard .hero {
    display: flex;
    flex-direction: column;
    align-items: start;
    min-height: 222px;
    padding: 21px 26px;
  }
  #view-dashboard .hero .aps-banner-context { margin-top: auto; padding-top: 16px; }
  #view-dashboard .assist { min-height: 222px; padding: 15px 13px; }
  #view-dashboard .assist-grid { gap: 7px 9px; }
  #view-dashboard .assist-action { min-height: 50px; }
  #view-dashboard .metrics,.clinical-tab .section-metrics { gap: 10px; }
  #view-dashboard .metrics .metric,.clinical-tab .section-metric { min-height: 94px; padding: 11px; }
  .dashboard-side,.clinical-tab .tab-columns > aside,.aps-workspace-side { gap: 10px; }
  #view-dashboard .dashboard-side > [aria-labelledby="calendar-title"] { min-height: 151px; }
  #view-dashboard .dashboard-side > [aria-labelledby="reminders-title"] { min-height: 168px; }
  .dashboard-side .upper-panel,.aps-workspace-side .upper-panel,.clinical-tab .section-calendar { padding: 12px 14px; }
  .aps-rail-columns .calendar-head,.tab-columns .calendar-head { flex-wrap: nowrap; gap: 5px; }
  .workspace :is(.calendar-head .calendar-step,.calendar-footer .text-action) { min-height: 32px; padding: 3px; }
  .workspace .calendar-head .calendar-step { min-width: 27px; height: auto; }
  .aps-rail-columns .calendar-head [data-month-title] { font-size: 13px; white-space: nowrap; }
  .workspace .calendar-days { margin-block: 8px 4px; }
  .workspace .calendar-days .day-button {
    justify-self: center;
    min-height: 0;
    max-width: 38px;
    aspect-ratio: auto;
    padding: 0;
    border-radius: 8px;
  }
  .workspace .calendar-days .day-button > b {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin-inline: auto;
    border-radius: 50%;
  }
  .workspace .calendar-days .day-button[aria-pressed="true"] { background: transparent; color: var(--ink); }
  .workspace .calendar-days .day-button[aria-pressed="true"] > b { background: #0061eb; color: white; }
  .dashboard-side .reminder-list { gap: 4px; margin-top: 6px; }
  .workspace :is(.dashboard-side,.aps-workspace-side,.tab-columns > aside) .reminder { min-height: 26px; }
  #view-dashboard .dashboard-main { gap: 14px; }
  .schedule-view .agenda-intro,.clinical-tab .patients-intro { gap: 15px; grid-template-columns: minmax(0,1.82fr) minmax(0,1fr); }
  .patients-workspace { gap: 12px; grid-template-columns: minmax(0,2.64fr) minmax(198px,1fr); }
  .queue-workspace { gap: 11px; grid-template-columns: minmax(0,2.34fr) minmax(145px,.87fr) minmax(150px,1fr); }
  .reports-view .report-intro { grid-template-columns: minmax(0,2fr) minmax(0,1fr); gap: 14px; }
  .reports-view .report-grid { grid-template-columns: minmax(0,1.18fr) minmax(0,1.18fr) minmax(0,1fr); }
  .reference-intro { gap: 15px; margin-bottom: 14px; }
  .reference-intro .aps-workspace-hero-copy { padding: 20px 24px; }
  :is([data-painel="atendimento"],.reference-inventory) .reference-intro .aps-workspace-hero { min-height: 221px; }
  [data-painel="prescricoes"] .reference-intro { grid-template-columns: minmax(0,2.58fr) minmax(235px,1fr); }
  [data-painel="prescricoes"] .reference-intro .aps-workspace-hero { min-height: 221px; }
  [data-painel="exames"] .reference-intro { grid-template-columns: minmax(0,2.12fr) minmax(235px,1fr); }
  [data-painel="exames"] .reference-intro .aps-workspace-hero { min-height: 165px; }
  [data-painel="documentos"] .reference-intro .aps-workspace-hero { min-height: 200px; }
  .reference-intro .aps-workspace-hero p,.section-hero p { font-size: 15.5px; line-height: 1.38; }
  .reference-intro .aps-workspace-hero h1,.section-hero h1,.hero h1 { font-size: 32px; line-height: 1.12; letter-spacing: -.033em; }
  .clinical-tab .section-hero h1 { margin-bottom: 7px; }
  .reference-assistant h2,.section-assist .section-panel-head h2 { font-size: 20px; line-height: 1.15; letter-spacing: -.028em; }
  .reference-assistant { padding: 14px 15px; }
  .reference-assistant p { font-size: 14px; line-height: 1.3; }
  .reference-assistant .section-assist-grid { gap: 7px 9px; }
  .reference-assistant .section-button { min-height: 46px; }
  .workspace :is(.upper-heading,.section-panel-head h2,.lower-head h2,.reference-table-head > h2) > :is(.dash-icon,.aps-reference-icon) {
    width: 23px;
    flex: 0 0 23px;
  }
  .workspace :is(.upper-heading,.section-panel-head h2,.lower-head h2,.reference-table-head > h2) > .dash-icon { height: 23px; }
  .workspace :is(.assist .upper-heading,.section-assist .section-panel-head h2) > :is(.dash-icon,.aps-reference-icon) {
    width: 27px;
    flex-basis: 27px;
  }
  .workspace :is(.assist .upper-heading,.section-assist .section-panel-head h2) > .dash-icon { height: 27px; }
  .workspace :is(.assist-action,.section-assist-grid .section-button,.reference-quick-grid .section-button) > :is(.dash-icon,.aps-reference-icon) {
    width: 23px;
    flex: 0 0 23px;
  }
  .workspace :is(.assist-action,.section-assist-grid .section-button,.reference-quick-grid .section-button) > .dash-icon { height: 23px; }
  .workspace :is(.metric-icon,.reference-metric-icon) { width: 43px; height: 43px; flex: 0 0 43px; }
  .workspace :is(.metric-icon,.reference-metric-icon) > :is(.dash-icon,.aps-reference-icon) { width: 25px; }
  .workspace :is(.metric-icon,.reference-metric-icon) > .dash-icon { height: 25px; }
  .workspace :is(.reminder,.chat-options button) > :is(.dash-icon,.aps-reference-icon) { width: 17px; flex: 0 0 17px; }
  .workspace :is(.reminder,.chat-options button) > .dash-icon { height: 17px; }
  .reference-intro .primary-action,.reference-hero-actions .section-button,.section-hero .section-button { min-height: 41px; }
  .reference-list li,.reference-shortcuts,.recent-notices,.agenda-preview { line-height: 1.25; }
  .reference-card .section-panel-head h2,.lower-head h2 { font-size: 16px; line-height: 1.18; letter-spacing: -.024em; }
  .reference-table-head > h2,.clinical-tab .section-panel-head h2 { letter-spacing: -.025em; }
  .reference-table-card td,.reference-table-card th { padding-block: 8px; }
  .reference-table-card .aps-workspace-table-scroll th,.clinical-tab .table-scroll th { font-size: 12px; }
  .reference-metric-label > strong,.clinical-tab .section-metric strong { font-size: 26px; line-height: 1.04; }
  .reference-metric-label > span,.clinical-tab .section-metric b { font-size: 12.5px; }
  .settings-view .settings-hero { padding-inline: 24px; }
  .settings-grid { grid-template-columns: minmax(0,37.7%) minmax(0,6.1%) minmax(0,1fr); gap: 18px 22px; }
  .settings-grid > :nth-child(1) { grid-column: 1 / 3; }
  .settings-grid > :nth-child(2) { grid-column: 3; }
  .settings-grid > :nth-child(4) { grid-column: 2 / -1; }
  .settings-grid > .section-panel { padding: 15px 17px; }
  .settings-grid > :nth-child(-n+2) { min-height: 284px; }
  .settings-grid > :nth-child(n+3) { min-height: 290px; }
  .settings-grid .section-panel-head { margin-bottom: 12px; }
  .settings-grid .section-panel-head h2 { font-size: 23px; line-height: 1.12; }
  .settings-profile { grid-template-columns: 146px minmax(0,1fr); gap: 25px; padding: 7px 5px 6px 14px; }
  .settings-profile h3 { font-size: 23px; letter-spacing: -.025em; }
  .settings-profile .profile-role { font-size: 13px; }
  .settings-grid .preference-row { min-height: 50px; column-gap: 11px; }
  .settings-grid .preference-row small { font-size: 12px; }
  .aps-workspace-panel[data-painel] .aps-workspace-metrics { margin-bottom: 14px; }
  .aps-workspace-panel[data-painel] .aps-workspace-metric { min-height: 94px; padding: 12px; }
  .reference-inventory-grid { gap: 12px; }
  .reference-inventory-grid > .reference-card { min-height: 220px; }
  .reference-inventory-grid > .reference-card:nth-child(n+5) { min-height: 234px; }
  .reference-care-grid { grid-template-columns: minmax(0,1.22fr) minmax(0,.90fr) minmax(0,1fr); }
  .reference-care-grid > .reference-card,.reference-care-bottom > .reference-card { min-height: 201px; }
  .reference-care-grid > :last-child { grid-column: auto; }
  [data-painel="prescricoes"] .reference-main-content { grid-template-columns: minmax(0,2.57fr) minmax(190px,1fr); }
  [data-painel="prescricoes"] .reference-workspace-content .reference-card,
  [data-painel="prescricoes"] .reference-table-card,
  [data-painel="exames"] .reference-table-card,
  [data-painel="documentos"] .reference-table-card { min-height: 442px; }
  .reference-record-patient {
    display: grid;
    grid-template-columns: minmax(0,1.1fr) minmax(0,1.75fr) minmax(160px,.72fr);
    align-items: center;
    column-gap: 14px;
    padding: 9px 14px 12px;
  }
  .reference-record-patient > .section-panel-head { grid-column: 1 / -1; }
  .reference-record-patient .reference-patient-heading { margin: 0; }
  .reference-record-patient .reference-patient-facts {
    border-inline: 1px solid #d5e5fb;
    padding: 3px 12px;
  }
  .reference-record-patient .reference-patient-facts dl {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 4px 12px;
  }
  .reference-record-patient .reference-patient-facts dl > div { display: grid; border: none; }
  .reference-record-grid { min-height: 368px; }
}
@container (min-width: 1180px) {
  #view-dashboard .lower-row { gap: 10px; grid-template-columns: minmax(0,1.16fr) minmax(0,1fr) minmax(0,.85fr) minmax(0,1fr); }
  #view-dashboard .results-row { grid-template-columns: minmax(0,1.15fr) minmax(0,1.07fr) minmax(0,.98fr) minmax(0,.94fr); }
  .reference-inventory-grid { grid-template-columns: minmax(0,1.12fr) minmax(0,1.06fr) minmax(0,.84fr) minmax(0,1fr); }
}
@container (max-width: 920px) {
  .sidebar .reference-brand-mark { width: 39px; }
  .reference-record-patient > .section-panel-head { margin-bottom: 6px; }
}
@container (max-width: 450px) {
  .reference-table-head .primary-action .aps-reference-icon { display: none; }
}

.sidebar .brand {
  min-height: 76px;
  height: auto;
  padding: 8px 10px;
  gap: 10px;
}
.sidebar .brand-text {
  min-width: 0;
  flex: 0 1 auto;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.015em;
}
.brand-name,.brand-edition { display: block; }
.brand-edition { margin-top: 3px; color: #9fd6ff; font-size: .95em; }
.brand-menu-icon,.top-actions .mobile-calendar-button { display: none; }
.sidebar:is(.is-open,:focus-within,:hover):not([data-dismissed]) .brand {
  background: linear-gradient(135deg,#1778c326,#0c549023);
  box-shadow: inset 0 0 0 1px #71b9ff30;
}

@media (max-width: 740px) {
  #screen.dashboard-view {
    --aps-page-inset: clamp(10px,3.1vw,18px);
    --aps-card-inset: 12px;
    --aps-panel-gap: 10px;
    display: block;
    font-family: Arial,"Segoe UI",sans-serif;
  }
  :is(.workspace,.dash-dialog) :is(button,input,select,textarea,table,.status-chip) { font-family: inherit; }
  .sidebar,
  .sidebar:is(:hover,:focus-within,.is-open),
  .sidebar:not(.is-open):is(:hover,:focus-within):not([data-dismissed]),
  .sidebar[data-dismissed]:not(.is-open) {
    width: 100%;
    height: auto;
    margin: 0;
    overflow: visible;
    transition: none;
  }
  .sidebar { z-index: 7; padding: env(safe-area-inset-top,0px) var(--aps-page-inset) 0; }
  .sidebar-inner { height: auto; overflow: visible; padding: 0; }
  .sidebar .sidebar-art { display: none; }
  .sidebar .brand,.sidebar:is(.is-open,:focus-within,:hover):not([data-dismissed]) .brand {
    width: 100%;
    min-height: 60px;
    padding: 5px 2px;
    background: none;
    box-shadow: none;
  }
  .sidebar .brand .reference-brand-mark { width: 39px; height: auto; }
  .sidebar .brand-text,.sidebar[data-dismissed]:not(.is-open) .brand-text {
    opacity: 1;
    font-size: clamp(15px,4.3vw,17px);
    line-height: 1.1;
  }
  .brand-menu-icon {
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    height: 42px;
    margin-left: auto;
    border: 1px solid #4c8cc088;
    border-radius: 10px;
    color: #eaf7ff;
    background: #0c3b6c;
  }
  .brand-menu-icon::before {
    content: "";
    width: 19px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    box-shadow: 0 -6px currentColor,0 6px currentColor;
  }
  .sidebar.is-open .brand-menu-icon::before {
    width: 19px;
    height: 19px;
    background: linear-gradient(45deg,transparent 45%,currentColor 46%,currentColor 54%,transparent 55%),
      linear-gradient(-45deg,transparent 45%,currentColor 46%,currentColor 54%,transparent 55%);
    box-shadow: none;
  }
  .sidebar:not(.is-open) #aps-navigation { display: none; }
  #aps-navigation {
    position: absolute;
    top: 100%;
    left: 0;
    width: min(100%,356px);
    max-height: calc(100dvh - 68px - env(safe-area-inset-top,0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px;
    border: 1px solid #3671a4;
    border-radius: 0 0 12px 12px;
    background: #062d59;
    box-shadow: 0 12px 26px #06274855;
  }
  .sidebar .menu { gap: 3px; margin: 0; }
  .sidebar .menu .menu-item { min-height: 44px; font-size: 15px; grid-template-columns: 38px minmax(0,1fr); }
  .sidebar .menu .label { opacity: 1; }
  .workspace { min-height: calc(100dvh - 60px); }
  .dashboard-header {
    display: grid;
    grid-template-columns: minmax(0,1fr);
    gap: 8px;
    padding: 8px var(--aps-page-inset);
  }
  .top-search { max-width: none; }
  .top-search .search-field,.search-field input { min-height: 42px; }
  .search-field input { font-size: 16px; }
  .top-actions {
    display: grid;
    grid-template-columns: repeat(2,44px) minmax(0,1fr) 44px;
    align-items: stretch;
    gap: 7px;
    margin: 0;
  }
  .top-actions:has(.mobile-calendar-button[hidden]) { grid-template-columns: 44px minmax(0,1fr) 44px; }
  .top-actions .mobile-calendar-button { display: grid; }
  .mobile-calendar-button::after { display: none; }
  .top-actions :is(.top-button,.profile-button) { width: 44px; min-height: 44px; }
  .top-actions .top-button { border: 1px solid var(--line); }
  .top-actions .profile-button { gap: 0; padding: 0; border: 0; }
  .top-actions .profile-button .avatar { width: 42px; height: 42px; }
  .top-actions .profile-button > .dash-icon { display: none; }
  .top-actions .primary-action { min-height: 44px; font-size: 14px; line-height: 1.2; padding: 6px 8px; }
  .top-pop,.search-results { width: min(315px,calc(100vw - 24px)); max-width: none; }
  .top-actions .menu-popover:has(#notification-toggle) .top-pop { right: auto; left: 0; width: min(290px,calc(100vw - 76px)); }
  .clinical-tab,.dashboard-columns,.aps-workspace-panel[data-painel] { padding: 10px var(--aps-page-inset) 20px; }
  :is(.dashboard-main,.tab-stack,.aps-workspace-side,.agenda-intro,.patients-intro,.report-intro,.settings-grid,
      .reference-intro,.reference-inventory-grid,.reference-care-grid,.reference-care-bottom,.reference-record-grid,.report-grid) {
    gap: var(--aps-panel-gap);
  }
  #view-dashboard .upper-dashboard { grid-template-columns: minmax(0,1fr); gap: var(--aps-panel-gap); }
  :is(.workspace .upper-panel,.workspace .section-panel,.workspace .section-calendar,.workspace .section-assist,
      .workspace .reference-card,.workspace .lower-panel,.workspace .reference-table-card) {
    padding: var(--aps-card-inset);
  }
  #view-dashboard :is(.lower-panel,.dashboard-side .upper-panel),
  .aps-workspace-side :is(.reference-reminders-card,.reference-notices-card,.reference-chat-card) {
    min-height: 0;
  }
  .section-panel-head,.lower-head { column-gap: 8px; row-gap: 3px; margin-bottom: 7px; }
  :is(.upper-heading,.section-panel-head h2,.lower-head h2,.reference-card .section-panel-head h2) {
    font-size: 17px;
    line-height: 1.16;
    letter-spacing: -.02em;
  }
  :is(.assist .upper-heading,.section-assist .section-panel-head h2,.reference-assistant h2,
      .reference-table-head > h2,.settings-grid .section-panel-head h2) {
    font-size: 19px;
    line-height: 1.12;
    letter-spacing: -.025em;
  }
  .section-panel-head h2,.upper-heading,.reference-table-head > h2 { overflow-wrap: anywhere; }
  :is(.section-panel,.section-assist,.reference-card,.assist) p { font-size: 14px; line-height: 1.36; }
  :is(.reference-list button,.recent-notices button,.agenda-preview button,.chat-feed p,.reference-reminders-card .reminder) {
    font-size: 13px;
    line-height: 1.3;
  }
  :is(.reference-list small,.recent-notices small,.agenda-preview small) { font-size: 11px; line-height: 1.25; }
  #view-dashboard .metrics,.clinical-tab .section-metrics,
  .aps-workspace-panel[data-painel] .aps-workspace-metrics {
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 8px;
  }
  :is(#view-dashboard,.clinical-tab,[data-painel]) :is(.metric,.section-metric,.aps-workspace-metric) {
    min-width: 0;
    min-height: 74px;
    padding: 9px 10px;
    gap: 8px;
  }
  :is(.metrics,.section-metrics,.aps-workspace-metrics) > button:last-child:nth-child(odd) { grid-column: 1 / -1; }
  :is(.metrics,.section-metrics,.aps-workspace-metrics) :is(.metric-icon,.reference-metric-icon) {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
  }
  .reference-metric-label { gap: 3px; }
  :is(.metric-label,.section-metric b,.aps-workspace-metric .reference-metric-label > span) {
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.18;
    overflow-wrap: break-word;
  }
  :is(.metric strong,.section-metric strong,.aps-workspace-metric .reference-metric-label > strong) {
    font-size: 25px;
    line-height: 1.05;
    letter-spacing: -.025em;
    font-variant-numeric: tabular-nums;
  }
  .hero { min-height: 181px; padding: 14px; }
  .section-hero { padding: 14px; }
  :is(.patients-hero,.queue-hero) { min-height: 174px; }
  .reports-hero { min-height: 160px; }
  .section-hero::after { width: 45%; background-size: auto min(100%,175px); }
  .section-hero h1,.hero h1,.reference-intro .aps-workspace-hero h1 {
    max-width: 82%;
    font-size: clamp(23px,6.4vw,29px);
    line-height: 1.09;
    letter-spacing: -.035em;
  }
  .reference-intro .aps-workspace-hero h1 { max-width: 96%; }
  .section-hero h1 .aps-reference-icon { width: 25px; }
  :is(.hero,.section-hero) p,.reference-intro .aps-workspace-hero p {
    max-width: 70%;
    margin: 6px 0 0;
    font-size: 14px;
    line-height: 1.36;
  }
  .section-hero .section-welcome,.hero .welcome { font-size: 16px; line-height: 1.2; }
  .hero-meta,.section-context {
    max-width: 100%;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-top: 11px;
    font-size: 11px;
  }
  .reference-intro { margin-bottom: var(--aps-panel-gap); }
  .reference-intro .aps-workspace-hero,.reference-inventory .reference-intro .aps-workspace-hero { min-height: 172px; }
  .reference-intro .aps-workspace-hero-copy { padding: 14px; min-width: 0; }
  .hero-actions,.reference-hero-actions { gap: 6px; padding-top: 0; margin-top: 10px; }
  .reference-hero-actions .section-button { text-align: left; }
  .assist { min-height: 0; padding: var(--aps-card-inset); }
  .assist p { margin: 6px 0 8px; }
  .aps-workspace-panel[data-painel] .aps-workspace-illustration { width: min(42%,215px); opacity: .75; }
  .reference-assistant .section-assist-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .section-assist-grid,.assist-grid,.reference-shortcuts { gap: 6px; }
  .section-assist .section-assist-grid .section-button,.assist-action,.reference-shortcuts button {
    min-width: 0;
    min-height: 44px;
    gap: 7px;
    font-size: 13px;
    line-height: 1.2;
    overflow-wrap: break-word;
  }
  .patients-assist .section-assist-grid .section-button { min-height: 70px; }
  :is(.workspace,.dash-dialog) :is(.section-button,.primary-action,.text-action,.table-action) { min-height: 40px; }
  .workspace :is(.search-field input,input[type=search],select,.chat-form input),
  .dash-dialog :is(input,select,textarea) { font-size: 16px; }
  .schedule-filters,.patient-toolbar,.queue-tools,.aps-workspace-search { align-items: stretch; }
  :is(.patient-toolbar,.queue-tools) .search-field { flex-basis: 100%; }
  :is(.schedule-filters,.queue-tools) label:not(.search-field) { flex: 1 1 128px; min-width: 0; }
  :is(.schedule-filters,.queue-tools) select { display: block; width: 100%; min-height: 34px; }
  :is(.patients-scroll,.aps-workspace-table-scroll) { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
  :is(.patients-scroll,.aps-workspace-table-scroll) table { font-size: 13px; }
  :is(.patients-scroll,.aps-workspace-table-scroll) :is(th,td) { padding: 8px 7px; }
  :is(.patients-scroll,.aps-workspace-table-scroll) th { font-size: 12px; }
  .patient-footer,.aps-workspace-paging { font-size: 12px; line-height: 1.25; }
  .reference-table-card .aps-workspace-table-scroll table { min-width: 510px; }
  .aps-workspace-table-scroll :is(td,th) { white-space: nowrap; }
  :is(.reference-calendar-card,.section-calendar,[aria-labelledby="calendar-title"]) { scroll-margin-top: 72px; }
  .calendar-days button,.month-grid button {
    width: min(100%,38px);
    max-width: none;
    min-height: 36px;
    aspect-ratio: 1;
    justify-self: center;
    font-variant-numeric: tabular-nums;
  }
  .calendar-step { min-width: 38px; min-height: 38px; }
  .settings-view .settings-hero { display: grid; gap: 12px; align-items: start; }
  .settings-view .settings-hero::after { right: 0; height: 128px; bottom: auto; }
  .settings-profile { grid-template-columns: minmax(74px,25%) minmax(0,1fr); gap: 4px 12px; align-items: center; }
  .settings-profile > div:last-child { display: contents; }
  .settings-avatar-wrap { grid-row: span 2; }
  .settings-profile h3 { align-self: end; font-size: 19px; line-height: 1.14; letter-spacing: -.025em; overflow-wrap: anywhere; }
  .settings-profile .profile-role { align-self: start; margin: 0; font-size: 13px; line-height: 1.3; }
  .settings-photo-button { right: -3px; bottom: -4px; }
  .settings-profile dl { grid-column: 1 / -1; margin-top: 10px; }
  .settings-profile dl > div { grid-template-columns: minmax(72px,33%) minmax(0,1fr); gap: 8px; padding: 6px 2px; font-size: 13px; }
  .preference-row { gap: 4px 8px; padding-block: 7px; }
  .preference-row small { font-size: 12px; line-height: 1.25; }
  .preference-row select { width: 100%; min-height: 40px; }
  .dash-dialog { width: min(520px,calc(100% - 16px)); max-height: calc(100dvh - 16px); padding: 15px; }
  .dash-dialog .dialog-fields { grid-template-columns: minmax(0,1fr); }
  .dash-dialog input[type=file] { width: 100%; min-width: 0; }
  .profile-photo-preview { width: 92px; height: 92px; }
}

@media (max-width: 360px) {
  .top-actions { gap: 5px; }
  .top-actions .primary-action .dash-icon { display: none; }
  .section-assist .section-assist-grid .section-button { font-size: 12px; }
  .reference-intro .aps-workspace-hero p { max-width: 78%; }
}

.settings-intro {
  display: grid;
  grid-template-columns: minmax(0,1.55fr) minmax(0,1fr);
  gap: 14px;
  margin-bottom: 15px;
}
.settings-intro .settings-hero { margin-bottom: 0; }
.settings-intro .settings-hero::after { width: 47%; right: 0; }
.settings-intro .settings-hero > div { flex: 1 1 auto; }
.settings-intro .settings-hero p { max-width: 65%; }
.aps-banner-context {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: 8px 16px;
  max-width: 100%;
  margin-top: 14px;
}
.aps-banner-context-item {
  display: grid;
  grid-template-columns: 22px minmax(0,1fr);
  align-content: center;
  align-items: center;
  column-gap: 7px;
  min-width: 0;
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.aps-banner-context-item .aps-reference-icon { grid-row: span 2; width: 22px; }
.aps-banner-context-item small { font-size: inherit; color: inherit; }

#view-dashboard #hero-heading {
  font-size: clamp(20px,calc(17px + 1vw),26px);
  font-size: clamp(20px,2.25cqw,26px);
  line-height: 1.14;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace[data-theme="dark"] :is(#view-dashboard .hero,.aps-module-banner) {
  border-color: #385a80;
  background: linear-gradient(120deg,#142b48,#1d3e62);
  color: #f3f8ff;
}
.workspace[data-theme="dark"] #view-dashboard #hero-heading strong { color: #8acaff; }
.workspace[data-theme="dark"] .aps-module-banner h1 { color: #f3f8ff; }
.workspace[data-theme="dark"] .aps-module-banner :is(h1 b,h1 > span:not(.aps-reference-icon),.section-welcome b) { color: #8acaff; }
.workspace[data-theme="dark"] :is(#view-dashboard .hero,.aps-module-banner) p { color: #dceaff; }
.workspace[data-theme="dark"] :is(#view-dashboard .hero,.aps-module-banner)::after,
.workspace[data-theme="dark"] .aps-module-banner .aps-workspace-illustration { filter: brightness(.76) saturate(.84); }

.workspace :is(.section-hero,.reference-intro .aps-workspace-hero).aps-module-banner {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,39%);
  grid-template-areas: "copy artwork" "context context";
  grid-template-rows: minmax(min-content,1fr) auto;
  align-items: center;
  gap: 9px 14px;
  padding: clamp(14px,1.55vw,24px);
}
.workspace .aps-module-banner .aps-module-banner-copy {
  grid-area: copy;
  min-width: 0;
  width: auto;
  padding: 0;
}
.workspace .aps-module-banner :is(h1,p,.section-welcome) {
  max-width: none;
  overflow-wrap: anywhere;
}
.workspace .aps-module-banner .aps-banner-context {
  grid-area: context;
  width: min(100%,580px);
  padding: 0;
  margin: 0;
}
.workspace .aps-module-banner.section-hero::after,
.workspace .aps-module-banner > .aps-workspace-illustration {
  grid-area: artwork;
  position: relative;
  inset: auto;
  z-index: 0;
  width: 100%;
  max-width: 310px;
  height: auto;
  justify-self: end;
  align-self: center;
  border-radius: 10px;
  opacity: 1;
}
.workspace .aps-module-banner.section-hero::after {
  aspect-ratio: var(--aps-module-art-ratio);
  background-size: contain;
  background-position: right center;
}
.agenda-hero { --aps-module-art-ratio: 258 / 150; }
.patients-hero { --aps-module-art-ratio: 272 / 200; }
.queue-hero { --aps-module-art-ratio: 270 / 222; }
.reports-hero { --aps-module-art-ratio: 294 / 179; }
.settings-hero { --aps-module-art-ratio: 391 / 173; }
.workspace .aps-module-banner:has(> .aps-workspace-illustration[hidden]) :is(.aps-module-banner-copy,.aps-module-banner-description) {
  grid-column: 1 / -1;
}
.workspace[data-theme="dark"] .aps-module-banner .aps-banner-context-item {
  color: #edf5ff;
  background: #193551;
  padding: 4px 6px;
  border-radius: 6px;
}
.workspace[data-theme="dark"] .aps-module-banner .section-button:not([aria-pressed="true"]) {
  color: #edf6ff;
  background: #25486c;
  border-color: #50749b;
}
.workspace[data-theme="dark"] .aps-module-banner .section-button:not([aria-pressed="true"]) .dash-icon { color: #9ed0ff; }

@media (max-width: 740px) {
  #view-dashboard .hero {
    display: grid;
    grid-template-columns: minmax(0,1.58fr) minmax(0,1fr);
    grid-template-areas:
      "greeting greeting"
      "welcome artwork"
      "description artwork"
      "context context";
    align-items: start;
    gap: 6px 10px;
    min-height: 0;
  }
  #view-dashboard #hero-heading {
    grid-area: greeting;
    font-size: clamp(15px,4.7vw,23px);
  }
  #view-dashboard .hero p { max-width: none; margin: 0; }
  #view-dashboard .hero .welcome { grid-area: welcome; }
  #view-dashboard .hero p:not(.welcome) { grid-area: description; }
  #view-dashboard .hero .aps-banner-context {
    grid-area: context;
    width: 100%;
    margin-top: 4px;
  }
  #view-dashboard .hero::after {
    grid-area: artwork;
    position: static;
    inset: auto;
    z-index: 0;
    align-self: center;
    justify-self: end;
    width: 100%;
    max-width: 208px;
    height: auto;
    aspect-ratio: 221 / 222;
    border-radius: 10px;
    background-size: 654.75% auto;
    background-position: 38.66% 40%;
    opacity: 1;
  }

  .settings-intro {
    grid-template-columns: minmax(0,1fr);
    gap: var(--aps-panel-gap);
    margin-bottom: var(--aps-panel-gap);
  }
  .workspace :is(.section-hero,.reference-intro .aps-workspace-hero).aps-module-banner {
    grid-template-columns: minmax(0,1fr) minmax(0,39%);
    grid-template-areas: var(--aps-mobile-banner-areas,"heading heading" "description artwork" "context context");
    grid-template-rows: auto;
    gap: 8px 10px;
    min-height: 0;
  }
  .aps-module-banner-with-actions {
    --aps-mobile-banner-areas: "heading heading" "description artwork" "actions actions" "context context";
  }
  .workspace .aps-module-banner .aps-module-banner-copy { display: contents; }
  .workspace .aps-module-banner h1 { grid-area: heading; margin: 0; }
  .workspace .aps-module-banner-description { grid-area: description; min-width: 0; align-self: start; }
  .workspace .aps-module-banner :is(.hero-actions,.reference-hero-actions) {
    grid-area: actions;
    margin-top: 0;
    padding-top: 0;
  }
  .workspace .aps-module-banner.section-hero::after {
    aspect-ratio: 1 / 1.08;
    background-size: cover;
  }
  .workspace .aps-module-banner.reports-hero::after { background-position: 32% center; }
  .workspace .aps-module-banner.settings-hero::after { background-position: 65% center; }
  .workspace .aps-module-banner.section-hero::after,
  .workspace .aps-module-banner > .aps-workspace-illustration { max-width: 208px; }
  [data-painel="prontuario"] { --reference-art-x: 875; --reference-art-width: 230; }
  [data-painel="documentos"] { --reference-art-x: 826; --reference-art-width: 255; }
  .mobile-overview {
    display: grid;
    grid-template-columns: minmax(0,1fr);
    gap: var(--aps-panel-gap);
    min-width: 0;
  }
  .aps-workspace-body > .mobile-overview { margin-bottom: var(--aps-panel-gap); }
  .mobile-overview .reference-reminders-card { min-height: 0; }
  .mobile-overview .section-reminders { display: grid; gap: 4px; }
  .mobile-overview .reminder-list { gap: 4px; }

  .aps-banner-context {
    display: grid;
    grid-template-columns: minmax(0,1.2fr) minmax(0,1fr);
    gap: 6px 9px;
    width: min(100%,355px);
    margin-top: 12px;
  }
  .aps-banner-context-item {
    grid-template-columns: 20px minmax(0,1fr);
    column-gap: 5px;
    padding: 3px 2px;
    border-radius: 6px;
    background: linear-gradient(110deg,#eaf5ffd9,#eaf5ff90);
  }
  .workspace[data-theme="dark"] .aps-banner-context-item { background: #193551; color: #edf5ff; }
  .aps-banner-context-item .aps-reference-icon { width: 20px; }
  .aps-banner-context-item strong { font-weight: 700; }

  .workspace :is(.upper-heading,.section-panel-head h2,.lower-head h2,.reference-table-head > h2) > :is(.dash-icon,.aps-reference-icon) {
    width: 22px;
    flex: 0 0 22px;
  }
  .workspace :is(.assist .upper-heading,.section-assist .section-panel-head h2) > :is(.dash-icon,.aps-reference-icon) {
    width: 26px;
    flex-basis: 26px;
  }
  .workspace :is(.metric-icon,.reference-metric-icon) { width: 36px; height: 36px; flex-basis: 36px; }
  .workspace :is(.metric-icon,.reference-metric-icon) > :is(.dash-icon,.aps-reference-icon) { width: 23px; }
  .workspace :is(.assist-action,.section-assist-grid .section-button,.reference-quick-grid .section-button) > :is(.dash-icon,.aps-reference-icon) {
    width: 20px;
    flex: 0 0 20px;
  }
  .workspace :is(.top-button,.top-actions .primary-action) > .dash-icon { width: 21px; height: 21px; }
  .workspace .reference-table-head .primary-action .aps-reference-icon { display: block; width: 18px; }
}

@media (min-width: 520px) and (max-width: 740px) {
  .mobile-overview { grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; }
}

:is(.workspace,#dash-dialog)[data-theme="dark"] {
  --aps-dark-panel: #193551;
  --aps-dark-field: #132b45;
  --aps-dark-control: #254564;
  --aps-dark-hover: #315575;
  --aps-dark-border: #5d7fa1;
  --aps-dark-separator: #3c5e7f;
  --aps-dark-text: #edf5ff;
  --aps-dark-muted: #c5daee;
  --aps-dark-link: #a6d4ff;
  --aps-dark-positive: #a5e9c4;
  --aps-dark-warning: #ffdfa5;
  --aps-dark-danger: #ffc5cf;
  --ink: var(--aps-dark-text);
  --blue: var(--aps-dark-link);
  --line: var(--aps-dark-separator);
}
.workspace[data-theme="dark"] :is(.dashboard-header,.metric,.assist,.reference-assistant,.top-pop,.search-results,
  .reference-more-actions .aps-workspace-controls,.mobile-overview > .section-panel,.aps-workspace-body > .tile.section-panel) {
  background: var(--aps-dark-panel);
  border-color: var(--aps-dark-separator);
  color: var(--aps-dark-text);
}
body:has(#screen.dashboard-view[data-theme="dark"]) { background: #10233b; }
.workspace[data-theme="dark"] :is(.profile-button .avatar,.settings-avatar,.agenda-initials,.patient-initials,
  .badge,.lower-list.meds em,.history-list time) {
  background: var(--aps-dark-control);
  border-color: var(--aps-dark-border);
  color: var(--aps-dark-text);
}
.workspace[data-theme="dark"] :is(.dashboard-header small,.notice-row small,.assist p,.section-panel-head small,.metric small,.aps-workspace-side small) {
  color: var(--aps-dark-muted);
}
.workspace[data-theme="dark"] .profile-button { border-color: var(--aps-dark-separator); }
.workspace[data-theme="dark"] :is(.top-button,.profile-button,.search-field,.chat-form) .dash-icon { color: var(--aps-dark-link); }
.workspace[data-theme="dark"] .notice-row { background: transparent; color: var(--aps-dark-text); }
.workspace[data-theme="dark"] .notice-row:is(:hover,:focus-visible) { background: var(--aps-dark-hover); }
.workspace[data-theme="dark"] kbd { color: var(--aps-dark-text); background: var(--aps-dark-control); }

:is(.workspace,#dash-dialog)[data-theme="dark"] :is(.search-field,.chat-form,.reference-notes-preview,.aps-workspace-search input,
  .settings-user-tools input,textarea,select,.dialog-fields input) {
  background: var(--aps-dark-field);
  border-color: var(--aps-dark-border);
  color: var(--aps-dark-text);
}
:is(.workspace,#dash-dialog)[data-theme="dark"] :is(input,textarea)::placeholder { color: var(--aps-dark-muted); opacity: 1; }
.workspace[data-theme="dark"] :is(.schedule-filters,.queue-tools,.patient-extra-filters) label:not(.search-field) {
  background: var(--aps-dark-field);
  border-color: var(--aps-dark-border);
  color: var(--aps-dark-muted);
}
.workspace[data-theme="dark"] :is(.search-field,.chat-form) input { background: transparent; color: var(--aps-dark-text); }
:is(.workspace,#dash-dialog)[data-theme="dark"] :is(.section-button,.assist-action,.quick-grid button,.chat-options button,
  .result-metrics button,.reference-card button:not([class])) {
  background: var(--aps-dark-control);
  border-color: var(--aps-dark-border);
  color: var(--aps-dark-text);
}
:is(.workspace,#dash-dialog)[data-theme="dark"] :is(.section-button,.assist-action,.quick-grid button,.chat-options button,
  .result-metrics button,.reference-card button:not([class])):hover:not(:disabled) { background: var(--aps-dark-hover); }
:is(.workspace,#dash-dialog)[data-theme="dark"] :is(.primary-action,.section-button[aria-pressed="true"],.reference-card button[aria-pressed="true"]) {
  background: #1653b5;
  border-color: #78aaff;
  color: #fff;
}
:is(.workspace,#dash-dialog)[data-theme="dark"] :is(.primary-action,.section-button[aria-pressed="true"],
  .reference-card button[aria-pressed="true"]):hover:not(:disabled) { background: #1b5bc2; }
:is(.workspace,#dash-dialog)[data-theme="dark"] :is(.primary-action,.section-button,.reference-card button):disabled {
  background: #233d58;
  border-color: var(--aps-dark-separator);
  color: #b5c9df;
  opacity: 1;
}
:is(.workspace,#dash-dialog)[data-theme="dark"] :focus-visible { outline-color: #b7dcff; }
.workspace[data-theme="dark"] :is(.reference-table-disclosure summary,.reference-more-actions summary,.text-action,.detail-link,.table-action,
  .aps-workspace-row-action,.lower-head > button,.result-metrics span,.med-reminder > span,.calendar-step .dash-icon) {
  color: var(--aps-dark-link);
}
.workspace[data-theme="dark"] :is(.calendar-days .day-button,.month-grid button) { color: var(--aps-dark-text); }
.workspace[data-theme="dark"] :is(.calendar-days small,.calendar-days span,.month-grid span,.month-grid .other-month) { color: var(--aps-dark-muted); }
.workspace[data-theme="dark"] :is(.calendar-step,.calendar-days button,.month-grid button):hover { background: var(--aps-dark-hover); }
.workspace[data-theme="dark"] :is(.calendar-days button,.month-grid button)[aria-pressed="true"] {
  background: #1653b5;
  color: #fff;
}
.workspace[data-theme="dark"] .calendar-days [aria-pressed="true"] small { color: #fff; }
@container (min-width: 1060px) {
  .workspace[data-theme="dark"] .calendar-days .day-button[aria-pressed="true"] { background: transparent; }
  .workspace[data-theme="dark"] .calendar-days .day-button[aria-pressed="true"] > b { background: #1653b5; color: #fff; }
}

.workspace[data-theme="dark"] :is(.reminder,.status-chip,.aps-workspace-status-chip) {
  background: #264562;
  border-color: #496787;
  color: var(--aps-dark-text);
}
.workspace[data-theme="dark"] :is(.reminder.red,.status-chip.red,
  .aps-workspace-status-chip:is([data-status="Sinalizado"],[data-status="Cancelada"])) {
  background: #4b2a3a;
  border-color: #90536b;
  color: var(--aps-dark-danger);
}
.workspace[data-theme="dark"] :is(.reminder.yellow,.status-chip.amber,
  .aps-workspace-status-chip:is([data-status="Pendente"],[data-status="Em análise"],[data-status="Aguardando coleta"])) {
  background: #43361f;
  border-color: #7c673d;
  color: var(--aps-dark-warning);
}
.workspace[data-theme="dark"] :is(.status-chip.green,
  .aps-workspace-status-chip:is([data-status="Ativa"],[data-status="Concluído"],[data-status="Disponível"],[data-status="Validado"])) {
  background: #1c403b;
  color: var(--aps-dark-positive);
}
.workspace[data-theme="dark"] .reminder .dash-icon { color: inherit; }
.workspace[data-theme="dark"] :is(.trend,.chat-mode) { color: var(--aps-dark-positive) !important; }
.workspace[data-theme="dark"] .chat-feed .chat-user { background: #1a4b84; color: #fff; }
.workspace[data-theme="dark"] :is(.metric-icon,.reference-metric-icon) { background: #244867; color: var(--aps-dark-link); }
.workspace[data-theme="dark"] :is(.metric-icon,.reference-metric-icon) > .dash-icon { color: var(--aps-dark-link); }
.workspace[data-theme="dark"] :is(.clinical-tab table,.aps-workspace-table-scroll table) { color: var(--aps-dark-text); }
.workspace[data-theme="dark"] :is(.clinical-tab th,.aps-workspace-table-scroll th) { background: #254667; color: var(--aps-dark-text); }
.workspace[data-theme="dark"] :is(.clinical-tab th,.clinical-tab td,.aps-workspace-table-scroll th,.aps-workspace-table-scroll td,
  .patients-scroll,.report-donut li,.settings-profile dl > div,.patient-record dl > div,.queue-selected dl > div,
  .preference-row,.reference-list li) { border-color: var(--aps-dark-separator); }
.workspace[data-theme="dark"] :is(.clinical-tab,.aps-workspace-table-scroll) tr:nth-child(even):not([data-selected="true"]) > td { background: #17314b; }
.workspace[data-theme="dark"] :is(.clinical-tab,.aps-workspace-table-scroll) tr[data-selected="true"] > td { background: #2b4e71; }
.workspace[data-theme="dark"] :is(.table-name small,.aps-workspace-paging,.patient-footer) { color: var(--aps-dark-muted); }
#dash-dialog[data-theme="dark"] .aps-workspace-results li small { color: var(--aps-dark-muted); }
#dash-dialog[data-theme="dark"] .aps-workspace-results li { border-color: var(--aps-dark-separator); }

#dash-dialog[data-theme="dark"] {
  border-color: var(--aps-dark-border);
  scrollbar-color: #819bb7 var(--aps-dark-panel);
  overscroll-behavior: contain;
}
#dash-dialog[data-theme="dark"] .dialog-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-bottom: 8px;
  background: var(--aps-dark-panel);
}
#dash-dialog[data-theme="dark"] .dialog-head h2 { min-width: 0; overflow-wrap: anywhere; }
#dash-dialog[data-theme="dark"] .dialog-close {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
}
#dash-dialog[data-theme="dark"] .dialog-close,
#dash-dialog[data-theme="dark"] input[type="file"]::file-selector-button {
  background: var(--aps-dark-control);
  border: 1px solid var(--aps-dark-border);
  color: var(--aps-dark-text);
}
#dash-dialog[data-theme="dark"] .dialog-close:hover,
#dash-dialog[data-theme="dark"] input[type="file"]::file-selector-button:hover {
  background: var(--aps-dark-hover);
}
#dash-dialog[data-theme="dark"] input[type="file"]::file-selector-button {
  padding: 6px 10px;
  border-radius: 6px;
  margin-inline-end: 8px;
}
:is(.workspace,#dash-dialog)[data-theme="dark"] select :is(option,optgroup) {
  color: var(--aps-dark-text);
  background: var(--aps-dark-field);
}
.workspace[data-theme="dark"] :is(.top-pop,.search-results,.reference-more-actions .aps-workspace-controls) {
  border-color: var(--aps-dark-border);
  box-shadow: 0 12px 28px #0917288c;
}
.workspace[data-theme="dark"] .reference-more-actions[open] > summary { color: var(--aps-dark-text); }

.workspace {
  --aps-chart-blue: #226fd1;
  --aps-chart-teal: #15826d;
  --aps-chart-violet: #7555c7;
  --aps-chart-amber: #9d680e;
  --aps-chart-rose: #c44c63;
  --aps-chart-slate: #5c7593;
  --aps-chart-green: #168046;
  --aps-chart-empty: #d6e3f1;
  --aps-chart-edge: #f3f8ff;
  --aps-chart-surface: #eff6ff;
  --aps-chart-label: #3b5674;
  --aps-chart-rule: #b6cbe2;
  --aps-chart-line: #155dbe;
  --aps-chart-area: #2a84df26;
}
.workspace[data-theme="dark"] {
  --aps-chart-blue: #79baff;
  --aps-chart-teal: #55d9ba;
  --aps-chart-violet: #c6a5ff;
  --aps-chart-amber: #f5c36d;
  --aps-chart-rose: #ff9aa7;
  --aps-chart-slate: #b2c0d3;
  --aps-chart-green: #82df91;
  --aps-chart-empty: #476481;
  --aps-chart-edge: #152940;
  --aps-chart-surface: #152940;
  --aps-chart-label: var(--aps-dark-muted);
  --aps-chart-rule: #496584;
  --aps-chart-line: #a6d4ff;
  --aps-chart-area: #71baff35;
}
.workspace :is(.queue-chart,.report-donut,.reference-distribution) { flex-wrap: wrap; justify-content: center; gap: 10px; }
.workspace .ring.aps-data-ring {
  flex: 0 0 clamp(82px,8cqw,112px);
  background: var(--aps-chart-fill, var(--aps-chart-empty));
}
.workspace .ring.aps-data-ring > span:first-child {
  width: 74%;
  height: 74%;
  background: var(--aps-chart-surface);
  color: var(--aps-chart-label);
  box-shadow: inset 0 0 0 1px var(--aps-chart-rule);
  font-size: 10px;
  line-height: 1.2;
}
.workspace .ring.aps-data-ring strong { color: var(--ink); font-size: clamp(15px,1.55cqw,20px); font-variant-numeric: tabular-nums; }
.workspace .aps-chart-legend { flex: 1 1 148px; min-width: 0; display: grid; gap: 0; }
.aps-chart-legend > li .legend-swatch { width: 9px; height: 9px; border-radius: 50%; }
.workspace .aps-chart-legend > li {
  display: grid;
  grid-template-columns: 9px minmax(0,1fr) minmax(0,max-content);
  align-items: center;
  gap: 6px;
  padding: 5px 1px;
  border: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
}
.workspace .aps-chart-legend > li + li { border-top: 1px solid var(--line); }
.aps-chart-label { min-width: 0; overflow-wrap: anywhere; }
.aps-chart-figures { display: flex; align-items: center; justify-content: end; gap: 6px; }
.aps-chart-count { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.aps-chart-share {
  min-width: 36px;
  border-radius: 5px;
  padding: 3px 4px;
  background: var(--aps-chart-surface);
  color: var(--aps-chart-label);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.workspace .aps-chart-legend > .aps-chart-no-data { display: block; color: var(--aps-chart-label); }
.aps-trend, .aps-trend-empty {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--aps-chart-surface);
  color: var(--aps-chart-label);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.aps-trend { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 4px 9px; }
.aps-trend-scale { display: flex; flex-direction: column; justify-content: space-between; text-align: right; line-height: 16px; }
.aps-trend-frame { display: grid; min-height: 122px; padding: 8px 4px; }
.aps-trend-surface { position: relative; display: grid; min-width: 0; }
.aps-trend-surface svg { position: absolute; inset: 0; height: 100%; overflow: visible; }
.aps-trend-grid { stroke: var(--aps-chart-rule); vector-effect: non-scaling-stroke; }
.aps-trend-area { fill: var(--aps-chart-area); }
.aps-trend-line {
  fill: none;
  stroke: var(--aps-chart-line);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.aps-trend-marker {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 2px solid var(--aps-chart-line);
  border-radius: 50%;
  background: var(--aps-chart-surface);
  transform: translate(-50%,-50%);
}
.aps-trend-dates { grid-column: 2; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px; }
.workspace[data-theme="dark"] :is(.recent-list,.file-list) button .dash-icon { color: var(--aps-dark-link); }
.workspace[data-theme="dark"] .result-metrics em,
.workspace[data-theme="dark"] .recent-notices button:first-child .dash-icon { color: var(--aps-dark-positive); }
.workspace[data-theme="dark"] .result-metrics button:first-child :is(em,.dash-icon) { color: var(--aps-dark-danger); }
.workspace[data-theme="dark"] :is(.patients-hero h1,.med-reminder,.recent-notices button:last-child) > .dash-icon { color: var(--aps-dark-warning); }
:is(.workspace,#dash-dialog)[data-theme="dark"] :is(.primary-action,.section-button[aria-pressed="true"]) .dash-icon { color: #f3f8ff; }

.workspace #view-agenda .visit-card {
  --booking-tone: var(--aps-chart-blue);
  --booking-surface: #f7fbff;
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid color-mix(in srgb,var(--booking-tone) 32%,var(--booking-surface));
  border-inline-start: 4px solid var(--booking-tone);
  background: color-mix(in srgb,var(--booking-tone) 9%,var(--booking-surface));
  color: var(--ink);
}
.workspace[data-theme="dark"] #view-agenda .visit-card { --booking-surface: var(--aps-dark-panel); }
.workspace #view-agenda .visit-card:is([data-state="Confirmada"],[data-state="Compareceu"],[data-state="Concluída"]) { --booking-tone: var(--aps-chart-green); }
.workspace #view-agenda .visit-card[data-state="Em atendimento"] { --booking-tone: var(--aps-chart-violet); }
.workspace #view-agenda .visit-card[data-state="Aguardando"] { --booking-tone: var(--aps-chart-amber); }
.workspace #view-agenda .visit-card:is([data-state="Reagendada"],[data-state="Cancelada"]) { --booking-tone: var(--aps-chart-rose); }
.workspace #view-agenda .visit-card:is([data-state="Falta"],[data-state="Intervalo"]) { --booking-tone: var(--aps-chart-slate); }
.workspace #view-agenda .visit-card:hover { background: color-mix(in srgb,var(--booking-tone) 17%,var(--booking-surface)); }
.workspace #view-agenda .visit-card time {
  max-width: max-content;
  padding: 3px 5px;
  border-radius: 5px;
  background: var(--booking-surface);
  color: var(--ink);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.workspace #view-agenda .visit-card :is(b,small) { overflow-wrap: anywhere; }
.workspace #view-agenda .visit-card small { color: var(--aps-chart-label); }
.workspace #view-agenda .schedule-slot > time { color: var(--aps-chart-label); font-variant-numeric: tabular-nums; }
.schedule-slot-hint {
  margin: 0;
  padding: 6px 10px;
  color: var(--aps-chart-label);
  font-size: .78rem;
}
.schedule-slot-actions {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 5px;
}
.schedule-slot-action {
  min-height: 44px;
  padding: 3px 8px;
  border: 1px dashed #9abddd;
  border-radius: 8px;
  color: #174d84;
  background: #edf6fe;
  font: 650 .81rem system-ui,sans-serif;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.schedule-slot-action:is(:hover,:focus-visible) { border-style: solid; background: #d8edff; }
:is(.workspace,#dash-dialog)[data-theme="dark"] .schedule-slot-action {
  background: var(--aps-dark-field);
  border-color: var(--aps-dark-border);
  color: var(--aps-dark-link);
}
:is(.workspace,#dash-dialog)[data-theme="dark"] .schedule-slot-action:is(:hover,:focus-visible) { background: var(--aps-dark-hover); }

.workspace :is(#view-pacientes,#view-prontuario,#view-prescricoes,#view-configuracoes) .patient-initials {
  border: 1px solid var(--aps-chart-rule);
  background: var(--aps-chart-surface);
  color: var(--aps-chart-line);
  font-weight: 750;
}
.workspace #view-pacientes #patient-statuses .section-button { gap: 6px; }
.patient-tab-count {
  min-width: 22px;
  padding: 3px 5px;
  border-radius: 6px;
  background: color-mix(in srgb,currentColor 12%,transparent);
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.workspace #view-pacientes #patient-rows tr[data-selected="true"] > td:first-child {
  box-shadow: inset 3px 0 0 var(--aps-chart-line);
}
.workspace #view-pacientes .patient-profile-line {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--aps-chart-surface);
}
.workspace #view-pacientes .patient-profile-line :is(b,small) { overflow-wrap: anywhere; }
.workspace #view-pacientes .patient-profile-line small { color: var(--aps-chart-label); }

.reference-timeline { padding-inline-start: 11px; }
.reference-timeline li {
  position: relative;
  padding-inline-start: 13px;
  border-inline-start: 1px solid var(--aps-chart-rule);
}
.reference-card .reference-timeline li + li { border-top: 0; }
.reference-timeline li::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 16px;
  inset-inline-start: -5px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--aps-chart-line);
  border-radius: 50%;
  background: var(--aps-chart-surface);
}
.reference-timeline .reference-item-button {
  flex-wrap: wrap;
  padding: 7px 5px;
  border-radius: 6px;
}
.reference-timeline .reference-item-button > span:first-child { flex: 1 1 108px; min-width: 0; overflow-wrap: anywhere; }
.reference-entry-date {
  display: inline-block;
  margin-bottom: 4px;
  padding: 3px 5px;
  border-radius: 5px;
  background: var(--aps-chart-surface);
  color: var(--aps-chart-label);
  font-size: 11px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.workspace[data-theme="dark"] button.reference-item-button:hover { background: var(--aps-dark-hover); }
.reference-care-active .reference-item-button { border-inline-start: 3px solid var(--aps-chart-blue); padding-inline-start: 8px; }

.workspace .aps-workspace-row-action.aps-record-title {
  display: inline-grid;
  grid-template-columns: 39px minmax(0,1fr);
  align-items: center;
  gap: 8px;
  text-align: start;
  white-space: normal;
  overflow-wrap: anywhere;
}
.aps-record-mark {
  display: grid;
  place-items: center;
  width: 39px;
  height: 31px;
  border: 1px solid var(--aps-chart-rule);
  border-radius: 7px;
  background: var(--aps-chart-surface);
  color: var(--aps-chart-line);
  font-size: 10px;
  font-weight: 750;
}
.aps-record-mark .aps-reference-icon { width: 17px; }
.aps-record-mark[data-format="pdf"] { color: #9c2139; background: #fff0f3; border-color: #e5b5be; }
.aps-record-mark[data-format="image"] { color: #0e6651; background: #e6f8f2; border-color: #a1cbbf; }
.workspace[data-theme="dark"] .aps-record-mark[data-format="pdf"] { color: #ffb9c5; background: #4b293b; border-color: #946077; }
.workspace[data-theme="dark"] .aps-record-mark[data-format="image"] { color: #a3ead5; background: #21433d; border-color: #537a75; }
.workspace :is(#view-prescricoes,#view-exames,#view-documentos) .aps-workspace-status-chip {
  border: 1px solid color-mix(in srgb,currentColor 34%,transparent);
  font-weight: 650;
}

.workspace #settings-theme {
  width: max-content;
  max-width: 100%;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--aps-chart-surface);
}
.workspace #settings-theme [aria-pressed="true"] { box-shadow: 0 1px 4px #10274230; }
.workspace #view-configuracoes .preference-row input[role="switch"] {
  width: 44px;
  height: 25px;
  border-color: #6c819c;
  background: #647d9b;
}
.workspace #view-configuracoes .preference-row input[role="switch"]:checked { background: #1653b5; border-color: #1653b5; }
.workspace[data-theme="dark"] #view-configuracoes .preference-row input[role="switch"] { background: #344e6d; border-color: #879fbc; }
.workspace[data-theme="dark"] #view-configuracoes .preference-row input[role="switch"]:checked { background: #2b6bc5; border-color: #8fbfff; }
.workspace[data-theme="dark"] #view-configuracoes .settings-photo-button { background: var(--aps-dark-control); color: var(--aps-dark-link); border-color: var(--aps-dark-border); }
.workspace[data-theme="dark"] #view-configuracoes .settings-photo-button:hover { background: var(--aps-dark-hover); }
.workspace[data-theme="dark"] #view-configuracoes .profile-camera::after { border-color: var(--aps-dark-control); }
@container (max-width: 570px) {
  .workspace #view-configuracoes .preference-row:has(input[role="switch"]) { grid-template-columns: auto minmax(0,1fr) auto; }
  .workspace #view-configuracoes .preference-row input[role="switch"] { grid-column: 3; }
}

.sidebar .vitanex-brand { justify-content: flex-start; min-width: 0; }
.vitanex-icon {
  display: block;
  flex: 0 0 42px;
  aspect-ratio: 1;
  background: url('/assets/vitanex-ai.png') 14.5% 4% / 337% auto no-repeat;
  border-radius: 8px;
}
.vitanex-wordmark { display: none; width: min(100%,204px); height: auto; }
.sidebar:is(.is-open,:focus-within,:hover):not([data-dismissed]) .vitanex-wordmark,
.sidebar.is-open .vitanex-wordmark { display: block; }
.sidebar:is(.is-open,:focus-within,:hover):not([data-dismissed]) .vitanex-icon,
.sidebar.is-open .vitanex-icon { display: none; }
@media (max-width: 740px) {
  .sidebar .vitanex-brand .vitanex-icon { display: none; }
  .sidebar .vitanex-brand .vitanex-wordmark { display: block; width: min(58vw,160px); }
}

#view-fila .queue-workspace { grid-template-columns: minmax(0,1fr); align-items: start; }
#view-fila .queue-list .patients-scroll { min-width: 0; }
#view-fila .queue-list table { width: max-content; min-width: 100%; }
#view-fila .queue-list :is(th,td,.table-name,.status-chip) { white-space: nowrap; }
#view-fila .queue-list :is(th,td) { padding-inline: 8px; }
#view-fila .queue-selected .section-panel-head h2 { font-size: clamp(14px,1.45cqw,18px); white-space: nowrap; }
#view-fila .queue-selected dt { white-space: nowrap; }
#view-fila .queue-selected dd { overflow-wrap: break-word; }
@container (min-width: 926px) {
  #view-fila .queue-workspace {
    grid-template-columns: minmax(0,1fr) minmax(225px,26%);
    grid-template-areas: "lista paciente" "apoio paciente";
    gap: 11px;
  }
  #view-fila .queue-list { grid-area: lista; }
  #view-fila .queue-selected { grid-area: paciente; }
  #view-fila .queue-side { grid-area: apoio; grid-template-columns: repeat(2,minmax(0,1fr)); }
}

.idle-warning {
  position: fixed;
  z-index: 60;
  inset: auto max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) auto;
  width: min(390px,calc(100vw - 24px));
  padding: 12px 14px;
  border: 1px solid #6e879e;
  border-radius: 10px;
  background: #f1f7ff;
  color: #102b47;
  box-shadow: 0 8px 26px #07193240;
}
.idle-warning p { margin: 0 0 8px; font-size: 14px; line-height: 1.4; }
#screen[data-theme="dark"] .idle-warning {
  background: #183753;
  color: #edf6ff;
  border-color: #9cb8d3;
}

#screen:has(.login-page) { min-height: 0; }
.login-page {
  color: #102b47;
}
.login-layout {
  display: grid;
  grid-template-areas: "art form";
  grid-template-columns: min(61%,calc(100dvh * 1068 / 897)) minmax(0,1fr);
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(ellipse at 20% 20%,#e1f5fd 12%,transparent 66%),linear-gradient(155deg,#abdff7 30%,#a2d9f6 62%,#208cdd);
}
.login-art {
  grid-area: art;
  position: relative;
  display: grid;
  place-items: center;
  align-self: stretch;
  min-width: 0;
  min-height: 92px;
  container-type: size;
}
.login-artwork {
  /* The original image's login mockup begins after the 1068px illustration. */
  justify-self: start;
  width: min(100%,calc(100cqh * 1068 / 897));
  aspect-ratio: 1068 / 897;
  overflow: clip;
}
.login-artwork img {
  display: block;
  width: calc(100% * 1753 / 1068);
  max-width: none;
  height: auto;
}
.login-layout .signin {
  grid-area: form;
  width: min(calc(100% - clamp(32px,6vw,96px)),520px);
  max-width: none;
  margin: clamp(8px,2dvh,22px) auto;
  gap: 0;
  padding: clamp(14px,2.7dvh,30px) clamp(16px,2.5vw,34px);
  border: 1px solid #d8efff;
  border-radius: clamp(17px,3vw,42px);
  background: linear-gradient(155deg,#f8fcff,#e6f3fd);
  box-shadow: 0 12px 32px #174a8133;
}
.login-intro { margin-bottom: 16px; text-align: center; }
.login-intro h1 {
  margin: 0 0 8px;
  font-size: clamp(25px,3.05vw,45px);
  line-height: 1.12;
  letter-spacing: -.025em;
  font-weight: 780;
}
.login-intro p { margin: 0 auto; max-width: 36ch; color: #345575; line-height: 1.45; }
.login-intro strong { color: #0754ad; }
.login-shield {
  display: grid;
  place-items: center;
  width: 59px;
  height: 65px;
  margin: 0 auto 9px;
  clip-path: polygon(50% 0,94% 18%,93% 56%,80% 78%,50% 100%,20% 78%,7% 56%,6% 18%);
  background: linear-gradient(150deg,#03c9ef,#0647ac 78%);
}
.login-shield::after {
  content: "";
  width: 24px; height: 24px;
  background: #fff;
  clip-path: polygon(34% 0,66% 0,66% 34%,100% 34%,100% 66%,66% 66%,66% 100%,34% 100%,34% 66%,0 66%,0 34%,34% 34%);
}
.login-layout .signin label { margin: 6px 0 4px 6px; font-size: 14px; font-weight: 680; }
.login-input { position: relative; display: grid; }
.login-input > svg {
  position: absolute;
  top: 50%; left: 13px;
  width: 20px; height: 20px;
  transform: translateY(-50%);
  color: #124d87;
  pointer-events: none;
}
.login-input svg,#login-passkey svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.login-layout .signin input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border-color: #82aaca;
  border-radius: 17px;
  background: #fff;
  color: #102b47;
  font-size: 16px;
  padding-inline-start: 42px;
}
.login-layout .signin input::placeholder { color: transparent; }
#login-password { padding-inline-end: 48px; }
.login-layout .signin .login-submit {
  min-height: 49px;
  margin-top: 16px;
  border-color: #084d9c;
  border-radius: 17px;
  background: linear-gradient(130deg,#0972be,#06255f 87%);
  color: #fff;
  font-weight: 750;
}
.login-layout .signin .login-submit:hover:not(:disabled) { background: #10477d; }
#password-visibility {
  position: absolute;
  inset: 2px 3px 2px auto;
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #194b7e;
}
#password-visibility svg,#login-passkey svg { width: 22px; height: 22px; flex: none; }
#password-visibility:not([data-revealed="true"]) .eye-slash { display: none; }
#password-visibility:hover { background: #e6f3ff; }
.login-divider {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 11px 0;
  color: #365773;
  font-size: 13px;
}
.login-divider::before,.login-divider::after { content: ""; height: 1px; background: #a5c6e0; flex: 1; }
#login-passkey {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 48px;
  padding: 7px 9px;
  background: #e7f6ff;
  border: 1px solid #177cc1;
  border-radius: 17px;
  color: #064b92;
  font-weight: 730;
}
#login-passkey:hover:not(:disabled) { background: #d5efff; }
#login-passkey-help { margin: 8px 0 0; text-align: center; font-size: 12px; color: #345575; }
.signin-feedback:has(#feedback:empty) { display: none; }
.signin-feedback #feedback {
  max-width: none;
  margin: 0;
  padding: 8px 10px;
  border-inline-start: 3px solid #a64543;
  border-radius: 4px;
  background: #fff4f4;
  color: #842625;
  font-size: 14px;
}
#screen:not(.dashboard-view):has(.login-page) ~ #feedback:empty { display: none; }
@media (max-width: 800px) {
  .login-layout { grid-template-areas: "art" "form"; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(auto,1fr) auto; }
  .login-layout .signin { width: min(calc(100% - 16px),540px); margin: 0 auto 8px; padding: clamp(10px,3vw,20px); }
  .login-intro { margin-bottom: 10px; }
  .login-shield { display: none; }
}
@media (max-height: 670px) {
  .login-shield { display: none; }
  .login-intro { margin-bottom: 7px; }
  .login-intro h1 { font-size: clamp(22px,3vw,33px); margin-bottom: 4px; }
  .login-intro p { font-size: 14px; line-height: 1.3; }
  .login-layout .signin label { margin-top: 4px; }
  .login-layout .signin :is(.login-submit,#login-passkey) { min-height: 44px; }
  .login-layout .signin .login-submit { margin-top: 10px; }
  .login-divider { margin-block: 6px; }
  #login-passkey-help { margin-top: 5px; }
}
@media (max-width: 480px) and (max-height: 670px) {
  .login-intro p { display: none; }
  .login-layout .signin label { margin-block: 2px; }
}
@media (min-width: 560px) and (max-height: 515px) and (orientation: landscape) {
  .login-layout { grid-template-areas: "art form"; grid-template-columns: min(50%,calc(100dvh * 1068 / 897)) minmax(260px,1fr); grid-template-rows: auto; }
  .login-layout .signin { width: min(calc(100% - 32px),520px); margin: 8px auto; padding: 10px 14px; }
  .login-intro { margin-bottom: 5px; }
  .login-intro p { display: none; }
  .login-layout .signin label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .login-layout .signin input::placeholder { color: #345575; }
  .login-input + label + .login-input { margin-top: 7px; }
  .login-layout .signin .login-submit { margin-top: 8px; }
  .login-divider { margin-block: 4px; }
}
.passkey-settings { margin-top: 14px; }
.passkey-settings p { margin: 0; }
.passkey-list { margin: 5px 0 12px; padding: 0; list-style: none; }
.passkey-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid currentColor; }
