/* CuraLink · tema PRD §6: #F7F5F0 fundo · #5F8575 sálvia · #2C3E50 grafite · #D9534F alerta */
:root {
  --bg: #F7F5F0;
  --surface: #FFFFFF;
  --surface-2: #F0ECE3;
  --sage: #5F8575;
  --sage-soft: #DDE8E2;
  --sage-deep: #4A6B5D;
  --ink: #2C3E50;
  --ink-soft: #5C6B7A;
  --muted: #8A95A0;
  --line: #E3DED3;
  --danger: #D9534F;
  --danger-soft: #FBE3E2;
  --amber: #C98B2E;
  --amber-soft: #F7E6C4;
  --caregiver: #EADFC8;
  --blue: #4C7FB1;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(44, 62, 80, .06), 0 4px 14px rgba(44, 62, 80, .06);
  --tap: 44px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.4; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--sage-deep); text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.2; }
p { margin: 0; }
ul, ol { margin: 0; padding-left: 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.soft { color: var(--ink-soft); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 700; }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.danger { color: var(--danger); }
.amber { color: var(--amber); }
.sage { color: var(--sage-deep); }

/* ------------------------------------------------------------ cores do semáforo / selos */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.dot.green { background: var(--sage); } .dot.yellow { background: var(--amber); } .dot.red { background: var(--danger); }
.dot.gray { background: var(--muted); } .dot.blue { background: var(--blue); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.badge.sage { background: var(--sage); }
.badge.muted { background: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-soft); white-space: nowrap; }
.pill.green { background: var(--sage-soft); color: var(--sage-deep); }
.pill.amber { background: var(--amber-soft); color: #8A5A10; }
.pill.red { background: var(--danger-soft); color: #A8302C; }
.pill.blue { background: #DCE8F4; color: #2E5A85; }
.pill.gray { background: var(--surface-2); color: var(--ink-soft); }
.pill.dark { background: var(--ink); color: #fff; }
.tag-light { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.section-title:first-child { margin-top: 0; }

/* ------------------------------------------------------------ cards e listas */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card.sage { background: var(--sage); color: #fff; }
.card.sage .muted, .card.sage .soft { color: rgba(255, 255, 255, .8); }
.card.soft { background: var(--sage-soft); }
.card.amber { background: var(--amber-soft); border: 1px solid #ECD3A0; }
.card.danger { background: var(--danger-soft); border: 1px solid #F3B9B6; }
.card.warn-border { border: 2px solid var(--amber); }
.card + .card { margin-top: 12px; }
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: var(--tap); border-top: 1px solid var(--line); width: 100%; text-align: left; color: inherit; }
.list-item:first-child { border-top: 0; }
.list-item .icon { width: 30px; text-align: center; font-size: 20px; flex-shrink: 0; }
.list-item .body { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; display: block; }
.list-item .sub { font-size: 13px; color: var(--ink-soft); display: block; }
.list-item .chev { color: var(--muted); font-size: 20px; }
.list-item.done .title { text-decoration: line-through; color: var(--ink-soft); }
.list-item.missed .title { color: var(--danger); }
.list-item.done .sub { color: var(--ink-soft); }
.list-item.disabled { opacity: .6; }
.status-ico { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; border: 2px solid var(--line); color: var(--muted); }
.status-ico.done { background: var(--sage); border-color: var(--sage); color: #fff; }
.status-ico.next { border-color: var(--sage); color: var(--sage); }
.status-ico.missed { background: var(--danger); border-color: var(--danger); color: #fff; }
.status-ico.skipped { background: var(--amber); border-color: var(--amber); color: #fff; }

/* ------------------------------------------------------------ botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 10px 18px; border-radius: 12px; font-weight: 700; font-size: 15px; background: var(--surface-2); color: var(--ink); transition: filter .1s; border: 1px solid transparent; }
.btn:active { filter: brightness(.95); }
.btn.primary { background: var(--sage); color: #fff; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.amber { background: var(--amber-soft); color: #7A4F0D; border-color: #E6C88E; }
.btn.outline { background: transparent; border-color: var(--line); }
.btn.outline.danger { color: var(--danger); background: transparent; border-color: #F0B5B2; }
.btn.outline.amber { color: #8A5A10; background: transparent; border-color: #E6C88E; }
.btn.ghost { background: transparent; color: var(--sage-deep); }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn.lg { min-height: 52px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.link { color: var(--sage-deep); font-weight: 600; background: none; padding: 0; min-height: var(--tap); display: inline-flex; align-items: center; }
.link.sm { min-height: 32px; font-size: 13px; }
.icon-btn { width: var(--tap); height: var(--tap); display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 20px; position: relative; color: var(--ink); }
.icon-btn .badge { position: absolute; top: 4px; right: 2px; }

/* ------------------------------------------------------------ chips / formulários */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: var(--tap); min-width: var(--tap); padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--ink); }
.chip.on { background: var(--sage); border-color: var(--sage); color: #fff; }
.chip.warn { border-color: var(--amber); color: #8A5A10; }
.chip.sm { min-height: 34px; padding: 4px 12px; font-size: 13px; }
.chip.filter { background: var(--surface-2); border-color: transparent; }
.chip.filter.on { background: var(--ink); border-color: var(--ink); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.input, textarea.input, select.input { width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.input:focus, textarea.input:focus, select.input:focus { outline: 2px solid var(--sage); outline-offset: 0; border-color: var(--sage); }
textarea.input { min-height: 90px; resize: vertical; }
.input.sm { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.input.num { width: 84px; text-align: right; }
.checkbox { display: flex; align-items: flex-start; gap: 12px; min-height: var(--tap); padding: 6px 0; cursor: pointer; }
.checkbox input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--sage); flex-shrink: 0; }
.radio-list { display: flex; flex-direction: column; gap: 8px; }
.radio-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.radio-card.on { border-color: var(--sage); background: var(--sage-soft); }
.radio-card .mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--muted); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.radio-card.on .mark { border-color: var(--sage); background: var(--sage); color: #fff; font-size: 13px; }
.radio-inline { display: flex; flex-wrap: wrap; gap: 6px; }
.radio-inline .chip { min-height: 34px; padding: 4px 12px; font-size: 13px; }
.scale { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.scale .chip { padding: 0; min-width: 0; }
.scale-row2 { grid-template-columns: repeat(5, 1fr); margin-top: 8px; }
.progress { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.progress > div { height: 100%; background: var(--sage); border-radius: 4px; }
.note { font-size: 13px; color: var(--ink-soft); background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.note.danger { background: var(--danger-soft); color: #A8302C; }
.note.amber { background: var(--amber-soft); color: #7A4F0D; }
.note.sage { background: var(--sage-soft); color: var(--sage-deep); }
.strip { padding: 10px 14px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px; display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.strip.danger { background: var(--danger); color: #fff; }
.strip.amber { background: var(--amber-soft); color: #7A4F0D; }
.strip.sage { background: var(--sage-soft); color: var(--sage-deep); }
.strip.gray { background: var(--surface-2); color: var(--ink-soft); }
.strip .btn { margin-left: auto; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--sage-soft); color: var(--sage-deep); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.avatar.ms { background: #DCE8F4; color: #2E5A85; }
.avatar.pa { background: var(--amber-soft); color: #7A4F0D; }
.avatar.hm, .avatar.cm { background: var(--sage-soft); color: var(--sage-deep); }
.avatar.sys { background: var(--surface-2); color: var(--muted); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv:first-child { border-top: 0; }
.kv b { text-align: right; }
.thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--surface-2); flex-shrink: 0; }
.thumb.sm { width: 44px; height: 44px; }
.thumb.lg { width: 100%; height: auto; aspect-ratio: 4/3; border-radius: var(--radius); }
.photo-pair { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.photo-pair img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius-sm); }
.photo-pair .arrow { font-size: 22px; color: var(--muted); }
.photo-pair .cap { text-align: center; font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

/* ------------------------------------------------------------ shell mobile (paciente) */
.app-mobile { max-width: 430px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; background: var(--bg); position: relative; display: flex; flex-direction: column; box-shadow: 0 0 0 1px var(--line); }
.m-header { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 12px 16px 8px; display: flex; align-items: center; gap: 8px; min-height: 56px; }
.m-header .titles { flex: 1; min-width: 0; }
.m-header h1 { font-size: 20px; }
.m-header .sub { font-size: 13px; color: var(--ink-soft); }
.m-header .back { width: var(--tap); height: var(--tap); margin-left: -10px; font-size: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.m-content { flex: 1; padding: 4px 16px 150px; }
.m-content.no-tab { padding-bottom: 32px; }
.caregiver-banner { background: var(--caregiver); color: #5A4A2A; font-size: 13px; font-weight: 600; padding: 8px 16px; text-align: center; position: sticky; top: 56px; z-index: 19; }
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 430px; background: var(--surface); border-top: 1px solid var(--line); display: flex; z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; font-size: 11px; font-weight: 600; color: var(--ink-soft); position: relative; }
.tabbar a .ico { font-size: 22px; line-height: 1; }
.tabbar a.on { color: var(--sage-deep); }
.tabbar a .badge { position: absolute; top: 6px; right: calc(50% - 22px); }
.sos-fab { position: fixed; bottom: 74px; right: calc(50% - 215px + 16px); z-index: 31; width: 60px; height: 60px; border-radius: 50%; background: var(--danger); color: #fff; font-weight: 800; font-size: 15px; box-shadow: 0 6px 16px rgba(217, 83, 79, .4); display: inline-flex; align-items: center; justify-content: center; letter-spacing: .04em; }
@media (max-width: 430px) { .sos-fab { right: 16px; } }
.offline-pill { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); }
.offline-pill.on { background: var(--amber-soft); color: #7A4F0D; }
.hero-task { background: var(--sage); color: #fff; border-radius: 18px; padding: 16px; box-shadow: var(--shadow); }
.hero-task .tag-light { color: rgba(255, 255, 255, .75); }
.hero-task h2 { font-size: 22px; margin: 6px 0 2px; }
.hero-task .btn.primary { background: #fff; color: var(--sage-deep); }
.hero-task .btn.ghost { color: #fff; background: rgba(255, 255, 255, .15); }
.hero-task.done { background: var(--sage-soft); color: var(--sage-deep); }
.indicators { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; margin: 12px 0; }
.indicator { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; text-align: left; color: inherit; }
.indicator .lbl { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.indicator .val { font-size: 22px; font-weight: 800; line-height: 1.2; }
.indicator .sub { font-size: 11px; color: var(--ink-soft); }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.numpad button { min-height: 64px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); font-size: 26px; font-weight: 700; color: var(--ink); }
.numpad button.ok { background: var(--ink); color: #fff; }
.numpad button.ok:disabled { opacity: .35; }
.numpad button.del { color: var(--danger); }
.display { text-align: center; padding: 18px 8px; }
.display .val { font-size: 48px; font-weight: 800; letter-spacing: -1px; }
.display .val small { font-size: 20px; color: var(--muted); font-weight: 600; margin-left: 6px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 110px; margin-top: 12px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; font-size: 11px; color: var(--ink-soft); background: none; }
.bars .bar > div { width: 100%; background: var(--sage); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.bars .bar.empty > div { background: var(--surface-2); }
.bars .bar.partial > div { background: repeating-linear-gradient(135deg, var(--sage) 0 6px, #8FB3A3 6px 12px); }
.bars .bar.high > div { background: var(--amber); }
.bars .bar .v { font-weight: 700; color: var(--ink); }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.calendar .wd { font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.calendar .day { min-height: 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 10px; font-size: 14px; color: var(--ink); background: none; gap: 2px; }
.calendar .day.other { color: var(--muted); opacity: .6; }
.calendar .day.today { outline: 2px solid var(--sage); outline-offset: -2px; font-weight: 700; }
.calendar .day .dots { display: flex; gap: 2px; height: 6px; }
.calendar .day .dots i { width: 6px; height: 6px; border-radius: 50%; display: block; }
.calendar .day .dots i.surgeon { background: var(--sage); }
.calendar .day .dots i.nurse { background: var(--amber); }
.calendar .day .dots i.hyper { background: var(--blue); }
.viewfinder { position: relative; background: #111; border-radius: 18px; overflow: hidden; aspect-ratio: 3/4; max-height: 60vh; }
.viewfinder video, .viewfinder .fallback { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.viewfinder .ghost { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: .3; pointer-events: none; transition: opacity .15s; }
.viewfinder .ghost.full { opacity: 1; }
.viewfinder .corners { position: absolute; inset: 12%; border: 2px dashed rgba(255, 255, 255, .7); border-radius: 12px; pointer-events: none; }
.viewfinder .fallback { display: flex; align-items: center; justify-content: center; color: #ddd; font-size: 14px; text-align: center; padding: 24px; background: #222; }
.viewfinder .spinner { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .5); color: #fff; font-weight: 700; }
.shutter { width: 76px; height: 76px; border-radius: 50%; background: #fff; border: 5px solid var(--sage); display: inline-flex; align-items: center; justify-content: center; }
.shutter:disabled { opacity: .5; }
.sensor { width: 130px; height: 130px; border-radius: 50%; background: var(--sage-soft); margin: 24px auto; display: flex; align-items: center; justify-content: center; font-size: 56px; transition: transform .2s; }
.sensor.pulse { animation: pulse .8s ease-in-out; }
.sensor.ok { background: var(--sage); color: #fff; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.12); } 100% { transform: scale(1); } }
.bubbles { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; }
.bubble { max-width: 84%; padding: 10px 12px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); font-size: 15px; position: relative; }
.bubble .meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.bubble.mine { align-self: flex-end; background: var(--sage-soft); border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.system { align-self: center; background: var(--surface-2); box-shadow: none; font-size: 13px; color: var(--ink-soft); max-width: 92%; text-align: center; }
.bubble.team { background: #EEECE7; border: 1.5px dashed var(--muted); align-self: flex-start; }
.bubble.team.mine { align-self: flex-end; }
.bubble .who { font-size: 11px; font-weight: 700; color: var(--ink-soft); margin-bottom: 2px; }
.bubble .attach { margin-top: 8px; border-radius: 10px; background: var(--ink); color: #fff; padding: 10px; display: flex; align-items: center; gap: 10px; font-size: 13px; width: 100%; text-align: left; }
.day-sep { text-align: center; font-size: 12px; color: var(--muted); margin: 8px 0; }
.composer { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0 12px; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-height: var(--tap); max-height: 120px; resize: none; }
.composer .btn { min-width: 84px; }
.player { background: var(--ink); border-radius: var(--radius); color: #fff; position: relative; aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.player img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .6; }
.player .play { position: relative; z-index: 2; width: 64px; height: 64px; border-radius: 50%; background: var(--sage); color: #fff; font-size: 26px; display: inline-flex; align-items: center; justify-content: center; }
.player .bar { position: absolute; left: 12px; right: 12px; bottom: 10px; z-index: 2; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.player .track { flex: 1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .3); overflow: hidden; cursor: pointer; }
.player .track > div { height: 100%; background: var(--sage); }
.chapters .list-item.on { background: var(--sage-soft); }
.video-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.video-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; text-align: left; color: inherit; padding: 0; }
.video-card img { width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.video-card .body { padding: 10px 12px; }
.video-card .title { font-weight: 700; font-size: 14px; }
.video-card .dur { font-size: 12px; color: var(--muted); }
.video-card.locked { opacity: .7; }
.timeline-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.timeline-strip .tcard { flex: 0 0 96px; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 8px; font-size: 11px; text-align: center; color: var(--ink-soft); border: 2px solid transparent; }
.timeline-strip .tcard.on { border-color: var(--sage); }
.timeline-strip .tcard img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; margin: 4px 0; }
.timeline-strip .tcard b { color: var(--ink); }
.tripartite { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; position: relative; margin: 8px 0; }
.tripartite .step { text-align: center; font-size: 12px; color: var(--muted); }
.tripartite .step .mark { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; margin-bottom: 4px; }
.tripartite .step.done .mark { background: var(--sage); border-color: var(--sage); color: #fff; }
.tripartite .step.rejected .mark { background: var(--danger); border-color: var(--danger); color: #fff; }
.tripartite .step.wait .mark { border-color: var(--amber); color: var(--amber); }
.tripartite .step b { display: block; color: var(--ink); font-size: 13px; }
.tripartite .step .who { display: block; }

/* ------------------------------------------------------------ toasts, modais */
.toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(94vw, 420px); pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: #fff; padding: 12px 14px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); display: flex; align-items: center; gap: 12px; font-size: 14px; animation: slide .2s ease-out; }
.toast.danger { background: var(--danger); }
.toast.sage { background: var(--sage-deep); }
.toast .act { margin-left: auto; font-weight: 800; color: #fff; text-decoration: underline; white-space: nowrap; min-height: 32px; display: inline-flex; align-items: center; }
@keyframes slide { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.modal-bg { position: fixed; inset: 0; background: rgba(44, 62, 80, .45); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-bg.sheet { align-items: flex-end; padding: 0; }
.modal { background: var(--surface); border-radius: 18px; width: min(100%, 460px); max-height: 92vh; overflow: auto; padding: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal-bg.sheet .modal { border-radius: 18px 18px 0 0; width: min(100%, 430px); }
.modal-bg.wide .modal { width: min(100%, 720px); }
.modal h3 { font-size: 18px; margin-bottom: 10px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.modal .actions .btn { min-width: 110px; }
.modal.critical { background: var(--danger); color: #fff; }
.modal.critical .btn { background: #fff; color: var(--danger); }
.modal.critical .btn.ghost { background: rgba(255, 255, 255, .2); color: #fff; }

/* ------------------------------------------------------------ shell desktop (profissionais) */
.app-desktop { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: var(--ink); color: #fff; display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.sidebar .logo { font-weight: 800; font-size: 20px; padding: 6px 10px 18px; letter-spacing: -.3px; }
.sidebar .logo small { display: block; font-size: 11px; font-weight: 500; color: rgba(255, 255, 255, .6); }
.sidebar nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 10px; color: rgba(255, 255, 255, .8); font-weight: 600; font-size: 14px; min-height: var(--tap); }
.sidebar nav a.on { background: rgba(255, 255, 255, .12); color: #fff; }
.sidebar nav a:hover { color: #fff; }
.sidebar .foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .15); padding-top: 12px; }
.sidebar .me { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 6px; border-radius: 10px; color: #fff; text-align: left; }
.sidebar .me .sub { font-size: 12px; color: rgba(255, 255, 255, .6); }
.sidebar .menu { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.sidebar .menu button, .sidebar .menu a { text-align: left; padding: 8px 10px; border-radius: 8px; color: rgba(255, 255, 255, .85); font-size: 13px; min-height: 36px; }
.sidebar .menu button:hover, .sidebar .menu a:hover { background: rgba(255, 255, 255, .1); }
.d-main { padding: 20px 28px 40px; min-width: 0; }
.d-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.d-header h1 { font-size: 24px; }
.d-header .sub { color: var(--ink-soft); font-size: 14px; margin-top: 2px; }
.d-header .meta { font-size: 13px; color: var(--ink-soft); text-align: right; white-space: nowrap; }
.d-back { color: var(--sage-deep); font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; min-height: 32px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button, .tabs a { padding: 10px 14px; font-weight: 600; color: var(--ink-soft); border-bottom: 3px solid transparent; margin-bottom: -1px; min-height: var(--tap); }
.tabs button.on, .tabs a.on { color: var(--sage-deep); border-bottom-color: var(--sage); }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; margin: 10px 0; }
.seg button { flex: 1; min-height: 44px; border-radius: 10px; font-weight: 600; color: var(--ink-soft); font-size: 14px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; font-size: 14px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-top: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-top: 0; background: var(--surface-2); }
.table tr.click { cursor: pointer; }
.table tr.click:hover td, .table tr.click:focus-visible td { background: #FAF8F3; }
.table tr.click:focus-visible { outline: 2px solid var(--sage); outline-offset: -2px; }
.table tr.dim td { color: var(--muted); }
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.queue-card { display: grid; grid-template-columns: 84px 1fr auto; gap: 14px; align-items: center; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; border-left: 5px solid transparent; }
.queue-card.high { border-left-color: var(--danger); }
.queue-card + .queue-card { margin-top: 10px; }
.queue-card img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; }
.queue-card .name { font-weight: 700; font-size: 16px; }
.queue-card .meta { font-size: 13px; color: var(--ink-soft); }
.queue-card.flash { animation: flash 3s ease-out; }
@keyframes flash { from { background: var(--sage-soft); } to { background: var(--surface); } }
.d-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.d-cols-3 { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; min-height: 70vh; }
.indicator-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 14px 0; }
.indicator-row .indicator { min-height: 78px; }
.svg-chart { width: 100%; height: 140px; display: block; }
.d-bubbles .bubble { max-width: 70%; }
.alert-card { border-left: 5px solid var(--amber); background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 10px 12px; font-size: 13px; margin-bottom: 8px; }
.alert-card.high { border-left-color: var(--danger); }
.alert-card .t { font-weight: 700; }
.conv { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); width: 100%; text-align: left; color: inherit; }
.conv.on { background: var(--sage-soft); }
.conv:hover { background: var(--surface-2); }
.conv .sub { font-size: 12px; color: var(--ink-soft); }
.chat-pane { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; height: calc(100vh - 40px); min-height: 480px; }
.chat-pane .head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-pane .body { flex: 1; min-height: 0; padding: 14px 16px; overflow: auto; }
.chat-pane .foot { padding: 12px 16px; border-top: 1px solid var(--line); background: var(--bg); border-radius: 0 0 var(--radius) var(--radius); }
.ctx { background: var(--danger-soft); border: 1px solid #F3B9B6; border-radius: var(--radius-sm); padding: 8px 12px; font-size: 12px; margin: 10px 16px 0; }
.ctx summary { cursor: pointer; list-style: none; }
.ctx summary::-webkit-details-marker { display: none; }
.ctx .row .btn { min-height: 34px; }
.ctx.answered { background: var(--amber-soft); border-color: #ECD3A0; }
.ctx b { color: #A8302C; }
.eval-form .field { margin-bottom: 10px; }
.eval-form .inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.eval-form .inline label { font-size: 13px; color: var(--ink-soft); min-width: 96px; }
.week-grid { display: grid; grid-template-columns: 56px repeat(7, 1fr); gap: 2px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; font-size: 12px; overflow: auto; }
.week-grid .h { font-weight: 700; text-align: center; color: var(--ink-soft); padding: 6px 2px; }
.week-grid .h.today { color: var(--sage-deep); }
.week-grid .hr { color: var(--muted); text-align: right; padding: 6px 4px; }
.week-grid .cell { min-height: 40px; border-top: 1px solid var(--line); padding: 2px; }
.week-grid .ev { border-radius: 6px; padding: 3px 5px; font-size: 11px; font-weight: 600; margin-bottom: 2px; cursor: pointer; color: #fff; background: var(--sage); }
.week-grid .ev.nurse { background: var(--amber); }
.week-grid .ev.dashed { background: transparent; border: 1.5px dashed var(--sage); color: var(--sage-deep); }
.week-grid .ev.dashed.nurse { border-color: var(--amber); color: #7A4F0D; }
.week-grid .ev.draft { background: transparent; border: 1.5px dotted var(--muted); color: var(--ink-soft); }
.steps-edit .list-item { padding: 8px 12px; min-height: 40px; }
.steps-edit input { flex: 1; }

.app-mobile .chip.sm, .app-mobile .link.sm, .app-mobile .bubble .attach, .app-mobile .calendar .day { min-height: 44px; }
.app-mobile .link.sm { padding: 0 4px; }

@media (max-width: 900px) {
  .app-desktop { grid-template-columns: 1fr; }
  .chat-pane { height: auto; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px; }
  .sidebar .logo { padding: 4px 8px; font-size: 16px; }
  .sidebar .logo small { display: none; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .sidebar nav a { padding: 6px 10px; min-height: 36px; font-size: 13px; }
  .sidebar .foot { margin-top: 0; border-top: 0; padding-top: 0; margin-left: auto; }
  .d-main { padding: 14px; }
  .d-cols, .d-cols-3 { grid-template-columns: 1fr; }
  .indicator-row { grid-template-columns: repeat(2, 1fr); }
}
