:root { --same: #1c6949; --same-2: #27845d; }
.bg-same { background: var(--same); }
.text-same { color: var(--same); }
.row-item:hover { background: #f1f5f9; }
.row-item.selected { background: #e0f2fe; }
.drop-active { outline: 3px dashed var(--same-2); outline-offset: -8px; background: #ecfeff; }
.spinner { border: 3px solid #cbd5e1; border-top-color: var(--same); border-radius: 50%; width: 28px; height: 28px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.nav-link { display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left; padding: .5rem .75rem; border-radius: .375rem; font-size: .875rem; }
.nav-link:hover { background: #e2e8f0; }
.nav-link.active { background: var(--same); color: #fff; }
.nav-link i { width: 1.1rem; text-align: center; }
:focus-visible { outline: 3px solid #f59e0b !important; outline-offset: 2px; }
pre.preview { white-space: pre-wrap; word-break: break-word; }
.badge { display: inline-flex; align-items: center; gap: .25rem; font-size: .7rem; font-weight: 600; padding: .1rem .5rem; border-radius: 9999px; border: 1px solid transparent; white-space: nowrap; }
.b-gray { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }
.b-blue { background: #e0f2fe; color: #075985; border-color: #7dd3fc; }
.b-green { background: #dcfce7; color: #166534; border-color: #86efac; }
.b-amber { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.b-red { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.b-purple { background: #f3e8ff; color: #6b21a8; border-color: #d8b4fe; }
.card { background: #fff; border-radius: .75rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.btn { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; padding: .4rem .8rem; border-radius: .375rem; border: 1px solid #cbd5e1; background: #fff; }
.btn:hover { background: #f8fafc; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--same); color: #fff; border-color: var(--same); }
.btn-primary:hover { background: var(--same-2); }
.btn-danger { color: #b91c1c; border-color: #fca5a5; }
.inp { width: 100%; border: 1px solid #cbd5e1; border-radius: .375rem; padding: .4rem .6rem; font-size: .875rem; }
.lbl { display: block; font-size: .75rem; font-weight: 600; color: #475569; margin-bottom: .2rem; }
table.tbl { width: 100%; font-size: .85rem; }
table.tbl th { text-align: left; color: #64748b; font-weight: 600; padding: .5rem .75rem; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
table.tbl td { padding: .5rem .75rem; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.stepper { display: flex; flex-wrap: wrap; gap: .25rem; }
.stepper span { font-size: .7rem; padding: .2rem .5rem; border-radius: .25rem; background: #e2e8f0; color: #64748b; }
.stepper span.done { background: #bbf7d0; color: #166534; }
.stepper span.cur { background: var(--same); color: #fff; }

/* Shell SINNC Saúde V2: menu recolhível, grupos e cabeçalho em degradê. */
.v2-app-shell { display: flex; width: 100%; height: 100dvh; overflow: hidden; background: #f8fafc; color: #172b3a; }
.v2-sidebar { position: relative; z-index: 30; display: flex; width: 18rem; flex: 0 0 auto; flex-direction: column; border-right: 1px solid #d8e1e8; background: #f8fcfe; transition: width .18s ease, transform .18s ease; }
.v2-app-shell.sidebar-collapsed .v2-sidebar { width: 5rem; }
.v2-sidebar-brand { display: flex; height: 3rem; flex: 0 0 auto; align-items: center; justify-content: flex-start; gap: .7rem; overflow: hidden; padding: 0 .9rem; border: 0; border-bottom: 1px solid #c9dfd1; background: #e7f2eb; color: #1c6949; cursor: pointer; }
.v2-sidebar-brand img { display: block; width: 8.8rem; max-width: calc(100% - 1rem); height: auto; max-height: 2rem; flex: 0 0 auto; object-fit: contain; }
.v2-sidebar-brand .sidebar-brand-icon { display: none; width: 2rem; height: 2rem; }
.sidebar-collapsed .v2-sidebar-brand { justify-content: center; padding: 0; }
.sidebar-collapsed .v2-sidebar-brand .sidebar-brand-full { display: none; }
.sidebar-collapsed .v2-sidebar-brand .sidebar-brand-icon { display: block; }
.sidebar-collapsed .v2-sidebar-brand .v2-menu-label, .sidebar-collapsed .v2-menu-label, .sidebar-collapsed .v2-menu-search { display: none !important; }
.v2-menu-search { position: relative; display: flex; height: 2.7rem; flex: 0 0 auto; align-items: center; margin: .5rem .55rem .2rem; }
.v2-menu-search > i { position: absolute; left: .65rem; color: #647b8b; font-size: .75rem; }
.v2-menu-search input { width: 100%; height: 2rem; padding: 0 .55rem 0 1.9rem; border: 1px solid #d6e0e7; border-radius: .4rem; background: #fff; color: #18384d; font: inherit; font-size: .75rem; }
.v2-menu-search input:focus { border-color: #297598; outline: 2px solid rgba(41, 117, 152, .15); }
.v2-menu-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: .35rem .5rem; }
.v2-menu-group { margin-bottom: .2rem; }
.v2-menu-heading { display: flex; width: 100%; min-height: 2rem; align-items: center; gap: .6rem; padding: .4rem .55rem; border: 0; border-radius: .38rem; background: transparent; color: #243d4c; cursor: pointer; text-align: left; }
.v2-menu-heading:hover { background: #e1f0e6; }
.v2-menu-heading > i:first-child { width: 1rem; color: #1c6949; font-size: .78rem; text-align: center; }
.v2-menu-heading .v2-menu-label { flex: 1; font-size: .75rem; font-weight: 700; }
.v2-menu-chevron { color: #6d8290; font-size: .65rem; transition: transform .16s ease; }
.v2-menu-heading[aria-expanded="true"] .v2-menu-chevron { transform: rotate(90deg); }
.v2-menu-items { margin: .15rem 0 .3rem .7rem; padding: .25rem .3rem; border-left: 2px solid #27845d; border-radius: 0 .35rem .35rem 0; background: #eaf4ed; }
.v2-menu-items.is-collapsed { display: none; }
.v2-nav-link { display: flex; width: 100%; min-height: 2rem; align-items: center; gap: .6rem; padding: .4rem .55rem; border: 0; border-radius: .35rem; background: transparent; color: #31495a; cursor: pointer; text-align: left; }
.v2-nav-link:hover { background: #dcecdf; }
.v2-nav-link.active { background: #d2e9d9; color: #16583e; font-weight: 700; box-shadow: inset 2px 0 #27845d; }
.v2-nav-link > i { width: 1rem; color: #1c6949; font-size: .76rem; text-align: center; }
.v2-nav-link .v2-menu-label { font-size: .73rem; line-height: 1.2; }
.v2-menu-empty { padding: 1rem .7rem; color: #647b8b; font-size: .75rem; }
.v2-user-card { display: flex; min-height: 3.75rem; flex: 0 0 auto; align-items: center; gap: .65rem; padding: .5rem .75rem; border-top: 1px solid #d8e1e8; }
.v2-user-avatar { display: grid; width: 2rem; height: 2rem; flex: 0 0 auto; place-items: center; border-radius: .55rem; background: #e2f0f5; color: #195876; }
.v2-user-card .v2-menu-label { min-width: 0; color: #1b3343; font-size: .69rem; }
.v2-user-card b, .v2-user-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-user-card small { margin-top: .15rem; color: #718492; font-size: .61rem; }
.v2-main-column { display: flex; min-width: 0; flex: 1 1 auto; flex-direction: column; overflow: hidden; }
.v2-topbar { display: flex; min-height: 3rem; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: .8rem; padding: 0 1rem; background: linear-gradient(90deg, #15543d 0%, #98c7a7 100%); box-shadow: 0 2px 7px rgba(17, 66, 45, .16); }
.v2-topbar-title { display: flex; min-width: 0; align-items: center; gap: .35rem; color: #fff; font-size: .82rem; font-weight: 700; }
.v2-topbar-title small { overflow: hidden; color: rgba(255,255,255,.84); font-size: .72rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.v2-mobile-menu { display: none; border: 0; background: transparent; color: #fff; font-size: 1rem; }
.v2-topbar-actions { display: flex; align-items: center; gap: .45rem; }
.v2-site-chip, .v2-write-state { display: inline-flex; max-width: 15rem; min-height: 1.8rem; align-items: center; gap: .4rem; overflow: hidden; padding: .28rem .6rem; border: 1px solid rgba(255,255,255,.62); border-radius: 999px; background: rgba(255,255,255,.9); color: #194b62; font-size: .67rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.v2-site-chip { cursor: pointer; color: #1c6949; }
.v2-site-chip:hover { border-color: #d2ead9; background: #f4fbf5; box-shadow: 0 2px 8px rgba(16, 74, 48, .14); }
.v2-site-chip:focus-visible { outline-color: #fff; }
#active-site-label { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; }
.v2-site-chevron { margin-left: .1rem; font-size: .56rem; opacity: .75; }
.site-picker { display: flex; max-height: 78vh; min-height: 0; flex-direction: column; overflow: hidden; }
.site-picker-header { display: flex; flex: 0 0 auto; align-items: center; gap: .8rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid #e4eee7; background: linear-gradient(115deg, #f3faf5, #fff); }
.site-picker-mark { display: grid; width: 2.7rem; height: 2.7rem; flex: 0 0 auto; place-items: center; border-radius: .8rem; background: #dceee2; color: #1c6949; font-size: 1.1rem; }
.site-picker-header > div { min-width: 0; flex: 1; }
.site-picker-header h2 { margin: 0; color: #174a34; font-size: 1rem; font-weight: 750; }
.site-picker-header p { margin: .2rem 0 0; color: #647b6c; font-size: .72rem; }
.site-picker-close { display: grid; width: 2rem; height: 2rem; flex: 0 0 auto; place-items: center; border: 1px solid #dce8df; border-radius: .5rem; background: #fff; color: #41604c; cursor: pointer; font-size: 1.2rem; }
.site-picker-list { display: grid; min-height: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; overflow-y: auto; padding: 1rem 1.15rem 1.2rem; }
.site-choice { display: flex; width: 100%; min-width: 0; align-items: center; gap: .7rem; padding: .8rem; border: 1px solid #e0e8e2; border-radius: .75rem; background: #fff; color: #20392a; cursor: pointer; text-align: left; transition: border-color .15s, background .15s, box-shadow .15s; }
.site-choice:hover, .site-choice:focus-visible { border-color: #83b695; background: #f5faf6; box-shadow: 0 3px 12px rgba(23, 84, 53, .09); }
.site-choice.is-active { border-color: #58a574; background: #edf7ef; box-shadow: inset 0 0 0 1px #c5e1cd; }
.site-choice:disabled { cursor: wait; opacity: .65; }
.site-choice-icon { display: grid; width: 2.45rem; height: 2.45rem; flex: 0 0 auto; place-items: center; border-radius: .65rem; background: #e7f2ea; color: #1c6949; }
.site-choice-copy { display: grid; min-width: 0; flex: 1; gap: .18rem; }
.site-choice-copy b { color: #183b2b; font-size: .78rem; line-height: 1.3; }
.site-choice-copy small { overflow: hidden; color: #718176; font-size: .66rem; line-height: 1.35; text-overflow: ellipsis; }
.site-visibility { justify-self: start; margin-top: .1rem; padding: .1rem .45rem; border: 1px solid #dce9df; border-radius: 999px; background: #f3f8f4; color: #4e6b58; font-size: .56rem; font-weight: 700; text-transform: uppercase; }
.site-choice-check { flex: 0 0 auto; color: #238451; }
.site-picker-empty { grid-column: 1 / -1; margin: 0; padding: 2rem 1rem; color: #6b7e70; text-align: center; }
.site-directory { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
@media (max-width: 640px) {
  .site-picker { max-height: 82vh; }
  .site-picker-header { padding: .85rem; }
  .site-picker-list, .site-directory { grid-template-columns: 1fr; padding: .75rem; }
}
.v2-write-state.is-readonly { border-color: #f1ce73; background: #fff6da; color: #7a5100; }
.v2-write-state.is-create { border-color: #8ed6b0; background: #eafff1; color: #17613a; }
.v2-icon-button { display: grid; width: 2rem; height: 2rem; place-items: center; border: 0; border-radius: .4rem; background: rgba(255,255,255,.33); color: #174c65; cursor: pointer; }
.v2-icon-button:hover { background: rgba(255,255,255,.72); }
.v2-logout { display: inline-flex; min-height: 2rem; align-items: center; gap: .35rem; padding: 0 .7rem; border: 1px solid rgba(255,255,255,.5); border-radius: .4rem; background: rgba(255,255,255,.76); color: #174c65; cursor: pointer; font-size: .7rem; font-weight: 650; }
.v2-commandbar { display: flex; min-height: 3.1rem; flex: 0 0 auto; align-items: center; gap: .75rem; padding: .45rem 1rem; border-bottom: 1px solid #dce5eb; background: #fff; }
.v2-global-search { position: relative; display: flex; width: min(100%, 33rem); min-width: 12rem; align-items: center; }
.v2-global-search > i { position: absolute; left: .7rem; color: #6b7f8d; font-size: .72rem; }
.v2-global-search input { width: 100%; height: 2rem; padding: 0 5rem 0 2rem; border: 1px solid #d5e0e7; border-radius: .4rem; background: #f8fafc; color: #193445; font-size: .72rem; }
.v2-global-search button { position: absolute; right: .2rem; height: 1.65rem; padding: 0 .6rem; border: 0; border-radius: .3rem; background: #1c6949; color: #fff; cursor: pointer; font-size: .65rem; }
.v2-breadcrumb { display: flex; min-width: 0; align-items: center; gap: .45rem; margin-left: auto; color: #496273; font-size: .68rem; }
.v2-breadcrumb span, .v2-breadcrumb b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-breadcrumb i { color: #8da0ad; font-size: .55rem; }
.v2-content { flex: 1 1 auto; min-width: 0; min-height: 0; overflow: auto; padding: clamp(14px, 2vw, 26px); }
.v2-sidebar-backdrop { display: none; }
#app-shell.reader-open .v2-sidebar, #app-shell.reader-open .v2-topbar, #app-shell.reader-open .v2-commandbar { display: none; }
#app-shell.reader-open .v2-content { overflow: hidden; padding: 0; }
#app-shell.reader-open .viewer-route { height: 100dvh; }
@media (max-width: 900px) {
  .v2-sidebar { position: fixed; inset: 0 auto 0 0; width: min(18rem, 86vw); transform: translateX(-105%); box-shadow: 10px 0 30px rgba(8, 35, 55, .14); }
  .v2-app-shell.mobile-menu-open .v2-sidebar { transform: translateX(0); }
  .v2-app-shell.mobile-menu-open .v2-sidebar-backdrop { position: fixed; z-index: 20; inset: 0; display: block; background: rgba(13, 33, 47, .4); }
  .v2-app-shell.sidebar-collapsed .v2-sidebar { width: min(18rem, 86vw); }
  .v2-app-shell.sidebar-collapsed .v2-sidebar .v2-menu-label, .v2-app-shell.sidebar-collapsed .v2-sidebar .v2-menu-search { display: revert !important; }
  .v2-mobile-menu { display: inline-grid; width: 2rem; height: 2rem; place-items: center; }
  .v2-site-chip { max-width: 11rem; min-height: 1.7rem; padding: .2rem .42rem; font-size: .59rem; }
  #active-site-label { max-width: 6.7rem; }
  .v2-content { padding: 14px; }
}
@media (max-width: 560px) {
  .v2-topbar { flex-wrap: wrap; gap: .1rem; padding: .15rem .55rem .35rem; }
  .v2-topbar-title { min-height: 2.3rem; font-size: .72rem; }
  .v2-topbar-title small { display: none; }
  .v2-topbar-actions { width: 100%; justify-content: flex-end; gap: .25rem; flex-wrap: wrap; }
  .v2-write-state { max-width: 9.5rem; padding: .24rem .4rem; font-size: .58rem; }
  .v2-logout { padding: 0 .45rem; }
  .v2-commandbar { flex-wrap: wrap; gap: .35rem; padding: .4rem .55rem; }
  .v2-global-search { width: 100%; }
  .v2-breadcrumb { width: 100%; min-height: 1rem; margin-left: .15rem; }
}

/* Leitor de prontuários: primeiro o documento, depois os metadados. */
#modal.viewer-overlay { z-index: 60; padding: 0; align-items: stretch; justify-content: stretch; background: #0b1220; }
.viewer-shell { width: min(96vw, 1600px); height: min(94dvh, 1100px); max-width: none !important; max-height: none !important; overflow: hidden !important; border-radius: .8rem !important; display: flex; flex-direction: column; }
#modal.viewer-overlay .viewer-shell { width: 100vw; height: 100dvh; border-radius: 0 !important; }
.viewer-header { flex: 0 0 auto; min-height: 64px; padding: .6rem .9rem; border-bottom: 1px solid #dbe2ea; display: flex; align-items: center; gap: 1rem; background: #fff; z-index: 2; }
.viewer-title-group { display: flex; align-items: center; gap: .75rem; min-width: 0; flex: 1 1 20rem; }
.viewer-title { font-weight: 700; font-size: .95rem; line-height: 1.3; color: #102a43; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-subtitle { color: #64748b; font-size: .7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: .4rem; flex: 0 0 auto; }
.viewer-nav-btn:disabled { opacity: .4; cursor: not-allowed; }
.viewer-position { font-size: .72rem; color: #475569; white-space: nowrap; padding: 0 .25rem; }
.viewer-close { width: 2.35rem; height: 2.35rem; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #cbd5e1; border-radius: .45rem; color: #334155; }
.viewer-workspace { display: flex; flex: 1 1 auto; min-height: 0; overflow: hidden; background: #111827; }
.viewer-main { display: flex; flex: 1 1 auto; min-width: 0; min-height: 0; flex-direction: column; }
.viewer-toolbar { min-height: 44px; flex: 0 0 auto; padding: .35rem .7rem; display: flex; align-items: center; gap: .75rem; color: #e2e8f0; background: #1e293b; border-bottom: 1px solid #334155; }
.viewer-media-controls { display: flex; align-items: center; gap: .35rem; }
.viewer-media-controls .btn { min-height: 2rem; padding: .3rem .55rem; }
#viewer-zoom-label { min-width: 3.3rem; text-align: center; font-size: .75rem; font-variant-numeric: tabular-nums; }
.viewer-shortcut-help, .viewer-format { margin-left: auto; font-size: .7rem; color: #cbd5e1; white-space: nowrap; }
.viewer-canvas { display: flex; flex: 1 1 auto; min-height: 0; min-width: 0; overflow: auto; background: #30343a; }
.viewer-pdf-frame { display: block; flex: 1 1 auto; min-width: 0; min-height: 0; width: 100%; height: 100%; border: 0; background: #30343a; }
.viewer-image-stage { display: flex; flex: 1 1 auto; min-width: 0; min-height: 0; align-items: center; justify-content: center; overflow: auto; padding: 1rem; }
#viewer-image { display: block; max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center center; transition: transform .15s ease; }
.viewer-text { width: min(100%, 1100px); margin: 1.5rem auto; padding: 1.5rem; color: #1e293b; background: #fff; border-radius: .5rem; overflow: auto; }
.viewer-empty { margin: auto; text-align: center; padding: 2rem; color: #e2e8f0; }
.viewer-meta { flex: 0 0 310px; width: 310px; max-width: 36vw; overflow: auto; padding: 1rem; color: #0f172a; background: #fff; border-left: 1px solid #cbd5e1; }
.viewer-meta-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.viewer-meta-heading h3, .viewer-versions h3, .viewer-signature h3 { font-size: .86rem; font-weight: 700; color: #102a43; }
.viewer-meta-heading p { font-size: .68rem; color: #64748b; }
.close-meta { width: 2rem; height: 2rem; border-radius: .4rem; color: #475569; }
.viewer-meta-list { display: grid; gap: .65rem; }
.viewer-meta-list > div { min-width: 0; }
.viewer-meta-list dt { color: #64748b; font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.viewer-meta-list dd { margin-top: .12rem; font-size: .74rem; line-height: 1.35; overflow-wrap: anywhere; }
.viewer-details { margin-top: 1rem; padding-top: .7rem; border-top: 1px solid #e2e8f0; }
.viewer-details summary { cursor: pointer; font-size: .73rem; font-weight: 600; color: #334155; }
.viewer-versions, .viewer-signature { margin-top: 1.2rem; padding-top: .8rem; border-top: 1px solid #e2e8f0; }
.viewer-version-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .55rem 0; border-bottom: 1px solid #f1f5f9; font-size: .72rem; }
.viewer-version-row small { display: block; margin-top: .1rem; color: #64748b; }
.viewer-version-row a { color: #075985; padding: .35rem; }
.viewer-signature p { margin-top: .4rem; font-size: .7rem; color: #64748b; }
#modal.viewer-meta-hidden .viewer-meta { display: none; }
#modal.viewer-meta-hidden .viewer-main { width: 100%; }
@media (max-width: 900px) {
  .viewer-title-group { flex-basis: 10rem; }
  .viewer-header { gap: .5rem; padding: .45rem .55rem; }
  .viewer-header-actions { gap: .25rem; }
  .viewer-action-label, .viewer-shortcut-help, .viewer-nav-btn span { display: none; }
  .viewer-position { font-size: .65rem; }
  .viewer-meta { flex-basis: 270px; width: 270px; }
}
@media (max-width: 640px) {
  .viewer-shell { width: 100vw; height: 100dvh; border-radius: 0 !important; }
  .viewer-header { min-height: 58px; flex-wrap: wrap; }
  .viewer-title-group { flex: 1 1 100%; }
  .viewer-title { font-size: .82rem; }
  .viewer-subtitle { font-size: .62rem; }
  .viewer-header-actions { width: 100%; justify-content: space-between; }
  .viewer-position { margin-right: auto; }
  .viewer-meta { position: absolute; z-index: 3; top: 104px; right: 0; bottom: 0; width: min(88vw, 340px); max-width: none; box-shadow: -12px 0 30px rgba(0,0,0,.25); }
  #modal.viewer-meta-hidden .viewer-meta { display: none; }
  .viewer-toolbar { min-height: 40px; }
  .viewer-media-controls .btn { padding: .25rem .4rem; font-size: .72rem; }
}
.document-open { display: inline-flex; align-items: center; gap: .6rem; width: 100%; min-width: 18rem; text-align: left; color: #075985; font-weight: 600; }
.document-open span { flex: 1; overflow-wrap: anywhere; }
.document-open:hover { color: #0f3d5e; text-decoration: underline; }
.document-open:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; border-radius: .25rem; }

/* Tela de acesso SAME Digital — identidade SINNC e layout responsivo. */
#login-section.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(390px, .95fr);
  background: #f2f7fd;
  color: #102a43;
}
  .login-showcase {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
  overflow: hidden;
  padding: clamp(28px, 4.8vw, 58px) clamp(28px, 5vw, 64px) 28px;
  color: #183b2b;
  background: #eef3ef url('/static/same-login-background.jpg') center / cover no-repeat;
}
.login-showcase::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: '';
  background: linear-gradient(105deg, rgba(248, 251, 248, .88) 0%, rgba(244, 249, 245, .78) 55%, rgba(232, 243, 235, .56) 100%);
}
.login-showcase::after {
  position: absolute;
  z-index: -1;
  right: -4rem;
  bottom: 1.2rem;
  left: -2rem;
  height: 4rem;
  content: '';
  border-bottom: 1px solid rgba(77, 208, 255, .65);
  transform: skewY(-4deg);
  box-shadow: 0 12px 0 -11px rgba(77, 208, 255, .72), 0 25px 0 -24px rgba(77, 208, 255, .72);
}
.login-brand { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.login-brand img { display: block; width: clamp(166px, 18vw, 206px); height: auto; filter: none; }
.login-brand-divider { width: 1px; height: 34px; background: rgba(28, 105, 73, .28); }
.login-brand p { flex-basis: 100%; margin: 0; color: #1c6949; font-size: .67rem; font-weight: 800; letter-spacing: .19em; line-height: 1.4; text-transform: uppercase; }
.login-showcase-copy { width: min(100%, 530px); margin: clamp(24px, 3.7vh, 42px) 0 18px; }
.login-eyebrow { margin: 0 0 10px; color: #397856; font-size: .74rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.login-showcase-copy h2 { margin: 0; color: #173b2a; font-size: clamp(2rem, 3.3vw, 2.75rem); font-weight: 800; letter-spacing: -.045em; line-height: 1.08; }
.login-showcase-copy h2 span { color: #1c6949; }
.login-lead { margin: 12px 0 20px; color: rgba(24, 59, 43, .88); font-size: .9rem; line-height: 1.55; }
.login-benefits { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.login-benefits li { display: flex; min-height: 55px; align-items: center; gap: 12px; padding: 7px 12px; border: 1px solid rgba(28, 105, 73, .19); border-radius: 11px; background: rgba(255, 255, 255, .76); box-shadow: 0 8px 24px rgba(29, 79, 52, .09); backdrop-filter: blur(5px); }
.login-benefit-icon { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border: 1px solid rgba(28, 105, 73, .3); border-radius: 9px; background: rgba(28, 105, 73, .1); color: #1c6949; font-size: 1.05rem; }
.login-benefits b { display: block; color: #183b2b; font-size: .77rem; font-weight: 750; }
.login-benefits small { display: block; margin-top: 2px; color: rgba(24, 59, 43, .76); font-size: .65rem; line-height: 1.35; }
.login-showcase-foot { margin: 20px 0 0; color: rgba(24, 59, 43, .78); font-size: .67rem; }
.login-showcase-foot i { margin-right: 6px; color: #1c6949; }
.login-panel { display: grid; min-width: 0; place-items: center; padding: 28px clamp(20px, 4vw, 52px); background: radial-gradient(ellipse at 50% 35%, #fff 0%, #f8fbf8 55%, #e8f2eb 100%); }
.login-card { width: min(100%, 390px); padding: clamp(24px, 3vw, 32px); border: 1px solid rgba(225, 237, 228, .92); border-radius: 21px; background: rgba(255, 255, 255, .94); box-shadow: 0 18px 52px rgba(38, 91, 57, .12); }
.login-lock-icon { display: grid; width: 56px; height: 56px; margin: 0 auto 13px; place-items: center; border-radius: 50%; background: #e5f2e8; color: #1c6949; font-size: 1.15rem; box-shadow: inset 0 0 0 1px #cee5d4; }
.login-card h1 { margin: 0; color: #174a34; text-align: center; font-size: clamp(1.35rem, 2vw, 1.55rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.2; }
.login-card-subtitle { margin: 6px 0 26px; color: #8493a9; text-align: center; font-size: .74rem; }
.login-field { margin-top: 13px; }
.login-field > label { display: block; margin-bottom: 5px; color: #244b35; font-size: .7rem; font-weight: 750; }
.login-input-wrap { position: relative; display: flex; min-height: 42px; align-items: center; border: 1px solid #ceddd2; border-radius: 9px; background: #f5f8f5; box-shadow: inset 0 1px 2px rgba(24, 58, 35, .025); transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.login-input-wrap:focus-within { border-color: #27845d; background: #fff; box-shadow: 0 0 0 3px rgba(39, 132, 93, .13); }
.login-input-wrap > i { width: 38px; flex: 0 0 38px; color: #879a8c; text-align: center; font-size: .78rem; }
.login-input-wrap input { width: 100%; min-width: 0; height: 40px; border: 0; outline: 0; background: transparent; color: #244b35; font: inherit; font-size: .72rem; }
.login-input-wrap input::placeholder { color: #9aa9bc; opacity: 1; }
.login-input-wrap:focus-within input { outline: 0; }
.login-password-toggle { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border: 0; background: transparent; color: #8295ae; cursor: pointer; }
.login-password-toggle:hover { color: #1c6949; }
.login-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 11px 0 4px; }
.login-remember { display: inline-flex; align-items: center; gap: 6px; color: #687d98; cursor: pointer; font-size: .66rem; }
.login-remember input { width: 14px; height: 14px; margin: 0; accent-color: #1c6949; }
.login-text-action { padding: 3px 0; border: 0; background: transparent; color: #1c6949; cursor: pointer; font-size: .66rem; font-weight: 600; }
.login-text-action:hover { text-decoration: underline; }
.login-feedback { min-height: 17px; margin: 7px 0 4px; color: #b42318; font-size: .68rem; line-height: 1.4; }
.login-feedback.is-notice { color: #315b8f; }
.login-submit, .login-support { display: flex; width: 100%; min-height: 41px; align-items: center; justify-content: center; gap: 9px; border-radius: 9px; cursor: pointer; font: inherit; font-size: .8rem; font-weight: 750; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.login-submit { border: 1px solid #165b3e; background: linear-gradient(105deg, #27845d 0%, #165b3e 100%); color: #fff; box-shadow: 0 6px 13px rgba(22, 91, 62, .19); }
.login-submit:hover:not(:disabled) { transform: translateY(-1px); background: linear-gradient(105deg, #237751 0%, #104a33 100%); box-shadow: 0 9px 18px rgba(22, 91, 62, .24); }
.login-submit:disabled { cursor: wait; opacity: .75; }
.login-support { margin-top: 9px; border: 1px solid #86b899; background: #fff; color: #1c6949; }
.login-support:hover { background: #eff7f1; }
.login-card-footer { display: grid; gap: 3px; margin-top: 16px; padding-top: 13px; border-top: 1px solid #e7eee8; text-align: center; }
.login-card-footer b { color: #1c6949; font-size: .66rem; }
.login-card-footer span { color: #97a4b4; font-size: .62rem; }
.login-card :focus-visible { outline: 3px solid #f6b940; outline-offset: 2px; }
@media (max-width: 820px) {
  #login-section.login-page { grid-template-columns: 1fr; }
  .login-showcase { min-height: 430px; padding: 32px clamp(22px, 7vw, 56px) 24px; }
  .login-showcase-copy { margin: 28px 0 14px; }
  .login-showcase-copy h2 { font-size: clamp(2rem, 7vw, 2.7rem); }
  .login-benefits { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .login-benefits li { align-items: flex-start; flex-direction: column; gap: 8px; min-height: 124px; padding: 12px; }
  .login-panel { padding: 34px 20px; }
}
@media (max-width: 520px) {
  .login-showcase { min-height: 390px; padding: 24px 20px 18px; }
  .login-brand img { width: 145px; }
  .login-brand-divider { height: 28px; }
  .login-brand p { font-size: .58rem; }
  .login-showcase-copy { margin: 22px 0 12px; }
  .login-showcase-copy h2 { font-size: 2rem; }
  .login-lead { margin: 8px 0 13px; font-size: .8rem; }
  .login-benefits { grid-template-columns: 1fr; gap: 6px; }
  .login-benefits li { min-height: 54px; flex-direction: row; align-items: center; padding: 6px 9px; }
  .login-benefit-icon { width: 34px; height: 34px; flex-basis: 34px; }
  .login-benefits small { font-size: .61rem; }
  .login-showcase-foot { margin-top: 14px; font-size: .61rem; }
  .login-panel { padding: 22px 14px; }
  .login-card { padding: 24px 21px; border-radius: 17px; }
}
@media (min-width: 821px) and (max-height: 700px) {
  .login-showcase { padding-top: 24px; padding-bottom: 18px; }
  .login-brand img { width: 150px; }
  .login-showcase-copy { margin: 16px 0 10px; }
  .login-showcase-copy h2 { font-size: clamp(1.8rem, 3vw, 2.35rem); }
  .login-lead { margin: 8px 0 12px; }
  .login-benefits { gap: 6px; }
  .login-benefits li { min-height: 48px; }
  .login-benefit-icon { width: 34px; height: 34px; flex-basis: 34px; }
  .login-showcase-foot { margin-top: 12px; }
  .login-card { padding: 22px 28px; }
  .login-lock-icon { width: 46px; height: 46px; margin-bottom: 8px; }
  .login-card-subtitle { margin: 4px 0 17px; }
  .login-field { margin-top: 9px; }
  .login-input-wrap { min-height: 38px; }
  .login-input-wrap input { height: 36px; }
  .login-options { margin: 8px 0 2px; }
  .login-feedback { min-height: 13px; margin: 4px 0 2px; }
  .login-submit, .login-support { min-height: 38px; }
  .login-card-footer { margin-top: 10px; padding-top: 8px; }
}
/* Leitor em página, não em modal; o papel clínico ocupa a maior parte da área. */
.viewer-route { display: flex; min-height: calc(100dvh - 7.2rem); flex-direction: column; overflow: hidden; border: 1px solid #d8e2e9; border-radius: .7rem; background: #fff; box-shadow: 0 4px 18px rgba(20, 57, 79, .08); }
#app-shell.reader-open .viewer-route { height: 100%; min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
#app-shell.reader-open .viewer-header { min-height: 3.4rem; }
#app-shell.reader-open .viewer-workspace { flex: 1 1 0; }
#app-shell.reader-open .viewer-meta { flex-basis: 330px; width: 330px; }
.viewer-canvas { align-items: stretch; justify-content: stretch; }
.viewer-image-stage { padding: clamp(4px, 1vw, 14px); }
#viewer-image { width: 100%; height: 100%; object-fit: contain; }
#app-shell.reader-open .viewer-image-stage { padding: 6px; }
.viewer-meta-toggle { flex: 0 0 auto; }
.viewer-meta-collapsed { flex-basis: 0 !important; width: 0 !important; padding: 0 !important; overflow: hidden !important; border: 0 !important; }
.viewer-workspace.meta-collapsed .viewer-meta { display: none; }
.viewer-workspace.meta-collapsed .viewer-main { width: 100%; }

/* Fluxos de documento e AIH em área de trabalho sem modal. */
.capture-layout { display: grid; grid-template-columns: minmax(250px, .75fr) minmax(0, 1.8fr); gap: 1rem; align-items: start; }
.capture-drop { min-height: 150px; display: grid; place-items: center; padding: 1.5rem; border: 2px dashed #9cb7c7; border-radius: .7rem; background: #f6fafc; text-align: center; transition: background .15s ease, border-color .15s ease; }
.capture-drop.drop-active { border-color: #195876; background: #e7f4f9; }
.document-worklist { width: 100%; border-collapse: collapse; }
.document-worklist th { position: sticky; top: 0; z-index: 1; padding: .65rem .75rem; background: #f2f7fa; color: #4f6878; font-size: .67rem; text-align: left; }
.document-worklist td { padding: .58rem .75rem; border-top: 1px solid #edf1f4; color: #244153; font-size: .74rem; }
.document-worklist tr:hover { background: #f3f8fa; }
.billing-workbench { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, .9fr); gap: 1rem; min-height: calc(100dvh - 13rem); align-items: stretch; transition: grid-template-columns .2s ease; }
.billing-workbench.preview-collapsed { grid-template-columns: minmax(0, 1fr); }
.billing-workbench.preview-collapsed .billing-preview-card { display: none; }
.billing-preview-card, .billing-form-card { min-width: 0; overflow: hidden; border: 1px solid #d9e3e9; border-radius: .65rem; background: #fff; box-shadow: 0 3px 14px rgba(20,57,79,.06); }
.billing-preview-card { display: flex; min-height: 36rem; flex-direction: column; }
.billing-preview-head, .billing-form-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .7rem .85rem; border-bottom: 1px solid #e1e9ee; }
.billing-preview-head h2, .billing-form-head h2 { color: #174e68; font-size: .82rem; font-weight: 750; }
.billing-preview-viewport { display: flex; min-height: 0; flex: 1; align-items: center; justify-content: center; overflow: auto; background: #253744; }
.billing-preview-viewport img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center center; }
.billing-preview-viewport iframe { width: 100%; height: 100%; min-height: 32rem; border: 0; background: #46535b; }
.billing-empty { display: grid; min-height: 30rem; place-items: center; padding: 2rem; color: #dce8ee; text-align: center; }
.billing-form-card { display: flex; max-height: calc(100dvh - 13rem); flex-direction: column; }
.billing-form-scroll { flex: 1; overflow: auto; padding: .85rem; }
.billing-identity-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .65rem; }
.billing-field label { display: block; margin-bottom: .25rem; color: #3d5869; font-size: .65rem; font-weight: 700; }
.billing-field input, .billing-field select, .billing-field textarea { width: 100%; min-height: 2.15rem; padding: .45rem .55rem; border: 1px solid #d3e0e7; border-radius: .36rem; background: #fbfdfe; color: #193747; font: inherit; font-size: .72rem; }
.billing-field textarea { min-height: 4rem; resize: vertical; }
.billing-group { margin-top: .9rem; border: 1px solid #e1e9ee; border-radius: .5rem; overflow: hidden; }
.billing-group > summary { padding: .55rem .7rem; background: #f0f7fa; color: #205a74; cursor: pointer; font-size: .71rem; font-weight: 750; }
.billing-item { display: grid; grid-template-columns: minmax(0,1fr) 100px 72px minmax(90px,.75fr); gap: .4rem; align-items: center; padding: .42rem .55rem; border-top: 1px solid #edf1f4; }
.billing-item > span { color: #355164; font-size: .65rem; line-height: 1.25; }
.billing-item input, .billing-item select { width: 100%; min-width: 0; min-height: 1.85rem; padding: .25rem .35rem; border: 1px solid #d6e1e8; border-radius: .3rem; background: #fff; color: #193747; font: inherit; font-size: .62rem; }
.billing-savebar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; padding: .65rem .8rem; border-top: 1px solid #e1e9ee; background: #fbfdfe; }
.billing-quality { margin-top: .65rem; padding: .6rem .7rem; border: 1px solid #d6e8f1; border-radius: .4rem; background: #f0f8fb; color: #31566b; font-size: .66rem; line-height: 1.45; }
.billing-status-badge { display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px; padding: .22rem .55rem; background: #e8f2f7; color: #285b74; font-size: .62rem; font-weight: 750; }
.billing-tree-details { max-width: 24rem; margin-top: .35rem; color: #496273; font-size: .67rem; }
.billing-tree-details > summary { width: fit-content; cursor: pointer; color: #195876; font-weight: 650; }
.billing-tree-details > summary:hover { text-decoration: underline; }
.billing-file-tree, .billing-file-tree ol { margin: .25rem 0 0 .6rem; padding-left: .9rem; border-left: 1px solid #d7e2e9; list-style: none; }
.billing-file-tree li { position: relative; margin: .2rem 0; }
.billing-file-tree li::before { position: absolute; top: .7rem; left: -.9rem; width: .65rem; border-top: 1px solid #d7e2e9; content: ''; }
.billing-tree-folder button, .billing-tree-leaf span { display: inline-flex; max-width: 100%; align-items: center; gap: .4rem; padding: .12rem .25rem; border-radius: .25rem; color: #314c5d; text-align: left; overflow-wrap: anywhere; }
.billing-tree-folder button { cursor: pointer; }
.billing-tree-folder button:hover { background: #eaf4f8; color: #075985; }
.billing-tree-folder button i { color: #d89b22; }
.billing-tree-leaf span i { color: #b64a4a; }
.billing-tree-details.is-compact { max-width: 18rem; font-size: .62rem; }
.billing-tree-details.is-compact .billing-file-tree { max-height: 13rem; overflow: auto; }
@media (max-width: 1050px) {
  .billing-workbench { grid-template-columns: minmax(0,1fr); }
  .billing-preview-card { min-height: 48vh; }
  .billing-workbench.preview-collapsed { grid-template-columns: minmax(0,1fr); }
  .billing-form-card { max-height: none; }
  .capture-layout { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 640px) {
  .v2-write-state { max-width: 7.5rem; white-space: normal; line-height: 1.15; }
  .billing-item { grid-template-columns: minmax(0,1fr) 88px 68px; }
  .billing-item input[data-note] { grid-column: 1 / -1; }
  #app-shell.reader-open .viewer-header { flex-wrap: wrap; }
  #app-shell.reader-open .viewer-header-actions { flex-wrap: wrap; }
  #app-shell.reader-open .viewer-meta { position: absolute; z-index: 4; top: 6rem; right: 0; bottom: 0; width: min(85vw, 340px); max-width: none; box-shadow: -10px 0 24px rgba(0,0,0,.25); }
}
@media (prefers-reduced-motion: reduce) {
  .login-input-wrap, .login-submit, .login-support { transition: none; }
  .login-submit:hover:not(:disabled) { transform: none; }
}
