:root {
  color-scheme: light;
  --ink: #22291e; --muted: #535d50; --olive: #404632; --lime: #cbc62a;
  --line: #dce1d8; --canvas: #f6f7f3; --white: #fff;
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink); background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 1rem; line-height: 1.5; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--olive); text-underline-offset: .2em; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid #607f39; outline-offset: 3px; }
button { cursor: pointer; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: absolute; z-index: 2; background: white; padding: .75rem; }
.top { background: var(--white); border-bottom: 1px solid var(--line); }
.top-inner, .workspace { max-width: 77rem; padding-inline: clamp(1rem, 4vw, 3.5rem); margin-inline: auto; }
.top-inner, .top-right, .panel-head, .heading, .queue-foot, .stage-label, .path, figcaption, .queue-foot nav { display: flex; align-items: center; }
.top-inner { min-height: 4.9rem; gap: 1.3rem; }
.brand { display: block; width: 7.15rem; height: auto; }
.top-label { border-left: 1px solid var(--line); padding-left: 1.25rem; color: var(--muted); font-size: .93rem; }
.top-right { margin-left: auto; gap: 1.25rem; font-size: .9rem; }
.top-back { font-weight: 550; }
.account { overflow-wrap: anywhere; font-weight: 600; }
.workspace { padding-bottom: 4rem; }
.path { gap: .65rem; color: var(--muted); font-size: .88rem; margin: 2.5rem 0 1rem; }
.path a { font-weight: 600; }
.heading { justify-content: space-between; gap: 1rem; margin-bottom: 1.7rem; }
h1, h2, p, dl, dd, figure { margin: 0; }
h1, h2 { font-family: "Avenir Next", system-ui, sans-serif; }
h1 { font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.13; font-weight: 630; letter-spacing: -.045em; }
h2 { font-size: 1.23rem; line-height: 1.25; letter-spacing: -.027em; font-weight: 650; }
.lede { color: var(--muted); margin-top: .45rem; }
.stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem; margin-bottom: 1.55rem; }
.stage { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; padding: 1.05rem 1.4rem; border: 1px solid var(--line); border-radius: 1rem; text-decoration: none; color: var(--ink); background: var(--white); }
.stage:hover { border-color: #838c76; }
.stage[aria-current] { background: var(--olive); color: white; border-color: var(--olive); }
.stage-label { gap: .6rem; font-size: .93rem; font-weight: 580; }
.mark { width: .63rem; height: .63rem; flex: none; border-radius: 50%; border: 1.6px solid currentColor; color: #7b7531; }
.stage-em-analise .mark { border-left-color: transparent; color: #426474; }
.stage-encerrados .mark { background: #5b7453; color: #5b7453; }
.stage[aria-current] .mark { background: var(--lime); border-color: var(--lime); }
.count { font-variant-numeric: tabular-nums; font-size: 2.3rem; font-weight: 540; line-height: 1.12; letter-spacing: -.06em; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 1rem; min-width: 0; overflow: hidden; }
.panel-head, .queue-foot, figcaption { justify-content: space-between; gap: 1rem; }
.panel-head { padding: 1.2rem 1.45rem; border-bottom: 1px solid var(--line); }
.queue-head { gap: 1.5rem; }
.search { display: flex; align-items: center; gap: .45rem; }
.search input, textarea { border: 1px solid #acb4a6; border-radius: .5rem; padding: .58rem .8rem; background: white; }
.search input { width: min(22vw, 16rem); min-width: 12.5rem; }
.search button, .open { display: inline-flex; justify-content:center; align-items:center; padding: .55rem .9rem; font-size: .9rem; font-weight: 600; border: 1px solid #cdd3c7; border-radius: .55rem; background: white; text-decoration: none; color: var(--olive); }
.search button:hover, .open:hover { background: #f0f2eb; }
.queue table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .98rem 1rem; }
th:first-child, td:first-child { padding-left: 1.45rem; }
th:last-child, td:last-child { padding-right: 1.45rem; }
th { font-size: .875rem; font-weight: 550; color: var(--muted); background: #f5f6f2; }
td { border-top: 1px solid #e7eae3; font-size: .94rem; }
td:last-child { text-align: right; }
.person { font-weight: 625; }
.ticket, .count { font-variant-numeric: tabular-nums; }
.ticket, .doctor, .muted, .queue-foot, figcaption, .report-meta { color: var(--muted); }
.queue-foot { border-top: 1px solid var(--line); padding: .9rem 1.45rem; font-size: .875rem; }
.queue-foot nav { gap: .8rem; }
.empty td { padding-block: 3rem; text-align: center; color: var(--muted); }
.details-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(15.5rem, 1fr); align-items: start; gap: 1.2rem; }
.details-main { display: grid; gap: 1.2rem; min-width: 0; }
.pill { display: inline-flex; align-items: center; padding: .37rem .8rem; border: 1px solid #d4cf9b; background: #f6f3d8; border-radius: 3rem; color: #60581e; font-size: .9rem; font-weight: 600; white-space: nowrap; }
.pill.em-analise { background: #edf3f6; border-color: #cadce4; color: #375a69; }
.pill.encerrados { background: #eaf2e7; border-color: #cbdac6; color: #3d5b36; }
.trace { margin: 1.05rem 1.4rem; }
.trace img { display: block; width: 100%; max-height: 31rem; object-fit: contain; background: #f8f8f5; border: 1px solid var(--line); border-radius: .55rem; }
figcaption { padding-top: .55rem; font-size: .875rem; }
.inset { padding: 1.2rem 1.45rem; }
.info dt, .field-label { font-size: .88rem; font-weight: 600; }
.info dt { color: var(--muted); }
.info dd { margin-top: .12rem; white-space: pre-line; overflow-wrap: anywhere; }
.info dd + dt { margin-top: .95rem; border-top: 1px solid #eceee8; padding-top: .8rem; }
.field-label { display: block; margin-bottom: .45rem; }
textarea { display: block; width: 100%; min-height: 8rem; resize: vertical; }
#report-note, .before-action { margin: .7rem 0 1rem; }
.primary { background: var(--olive); color: white; border: 0; border-radius: .65rem; font-weight: 600; min-height: 2.8rem; padding: .65rem 1.1rem; }
.primary:hover { background: #303624; }
.report-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.report-meta { margin-top: 1rem; font-size: .88rem; }
.notice { border-radius: .7rem; padding: .8rem 1.1rem; margin-top: 1.4rem; border: 1px solid; }
.notice.success { color: #365732; background: #edf5ec; border-color: #bdceb6; }
.notice.error { color: #873529; background: #fff3f1; border-color: #e5c9c3; }
@media (max-width: 45rem) {
  .top-inner { min-height: 4.1rem; gap: .75rem; flex-wrap: wrap; }
  .top-label { display: none; }
  .top-right { gap: .7rem; font-size: .8rem; }
  .brand { width: 5.7rem; }
  .path { margin-top: 1.55rem; }
  .stages { gap: .38rem; }
  .stage { padding: .78rem .55rem; gap: .55rem; border-radius: .7rem; }
  .stage-label { font-size: .875rem; line-height: 1.25; }
  .mark { display: none; }
  .count { font-size: 1.75rem; }
  .heading.detail-heading { flex-wrap: wrap; }
  .details-grid { grid-template-columns: 1fr; }
  .queue-head { align-items: stretch; flex-direction: column; gap: .75rem; }
  .search { flex-wrap: wrap; }
  .search input { flex: 1; min-width: 9rem; }
  .queue table, .queue tbody { display: block; }
  .queue thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .queue tr { display: grid; grid-template-columns: 1fr auto; gap: .25rem .7rem; border-top: 1px solid var(--line); padding: .85rem 1.1rem; }
  .queue td, .queue td:first-child, .queue td:last-child { padding: 0; border: 0; text-align: left; }
  .queue td[data-label] { grid-column: 1; font-size: .86rem; }
  .queue td[data-label]::before { content: attr(data-label) " · "; color: var(--muted); }
  .queue td:last-child:not(:first-child) { grid-column: 2; grid-row: 1 / 5; align-self: center; }
  .queue .empty td { grid-column: 1 / -1; padding: 1rem 0; }
  .panel-head, .inset { padding-inline: 1.05rem; }
  .trace { margin-inline: 1.05rem; }
}
/* Sugestão da IA (pré-laudo) */
.ai .beta { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .12rem .45rem; border-radius: .4rem; background: #edf3f6; color: #375a69; vertical-align: middle; }
.ai-label { margin: .2rem 0 .4rem; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ai-chips { list-style: none; margin: 0 0 .9rem; padding: 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.ai-chips .chip { padding: .35rem .75rem; border-radius: 3rem; font-size: .92rem; border: 1px solid; }
.ai-chips .chip b { font-weight: 700; margin-left: .2rem; }
.ai-chips .likely { background: #eaf2e7; border-color: #cbdac6; color: #3d5b36; }
.ai-chips .possible { background: #f6f3d8; border-color: #d4cf9b; color: #60581e; }
.ai-alert { margin: 0 0 .9rem; padding: .7rem .9rem; border-radius: .6rem; background: #fbeee9; border: 1px solid #ecc9bd; color: #7a3420; }
.ai-draft { margin: .2rem 0 .7rem; font-style: italic; }
.ai-note { margin: .9rem 0 0; font-size: .85rem; }
