/* Screen layout rhythm: approved controls and document/viewer geometry stay intact. */
@media screen{
:root{--arkhe-space-unit:4px;--arkhe-space-controls:8px;--arkhe-space-group:12px;--arkhe-space-section:16px;--arkhe-space-panel:20px}
html:is([data-layout-page=perfil],[data-layout-page=recepcao]) .profile-main{padding-top:20px;padding-bottom:24px}
html:is([data-layout-page=perfil],[data-layout-page=recepcao],[data-layout-page=agenda]) .profile-heading{margin-bottom:16px;gap:12px}
html:is([data-layout-page=perfil],[data-layout-page=recepcao],[data-layout-page=agenda]) .profile-heading h1{margin-bottom:6px;line-height:1.2}
html:is([data-layout-page=perfil],[data-layout-page=recepcao],[data-layout-page=agenda]) .profile-heading p{margin-top:0;margin-bottom:0;line-height:1.4}
html:is([data-layout-page=perfil],[data-layout-page=recepcao]) .profile-main .panel{padding:20px;margin-bottom:16px}
html[data-layout-page=perfil] .profile-grid{gap:16px}
/* A grade controla a distância entre linhas; margens nos labels somavam 22px. */
html[data-layout-page=perfil] .profile-main .field-grid{gap:5px 14px;align-items:end}
html[data-layout-page=perfil] .profile-main label{font-size:11px}
html[data-layout-page=perfil] .profile-main label > :is(input,select,textarea){margin-top:3px}
html[data-layout-page=perfil] .profile-main .field-grid > label{margin:0;min-width:0}
html[data-layout-page=perfil] .profile-main .field-grid > button{margin:0;align-self:end}
html[data-layout-page=perfil] .profile-main .panel > label{margin:12px 0 8px}
html[data-layout-page=perfil] #profile-form + .panel{margin-top:16px!important}
html[data-layout-page=perfil] #password-form{grid-template-columns:minmax(0,240px) minmax(0,240px) max-content}
html[data-layout-page=perfil] #user-form{grid-template-columns:minmax(0,280px) minmax(0,300px) minmax(0,170px) max-content}
html[data-layout-page=perfil] #user-form > label:has(select){width:100%;max-width:170px}
html[data-layout-page=perfil] #user-form > button{margin:0;align-self:end}
@media(max-width:950px){
html[data-layout-page=perfil] #user-form{grid-template-columns:repeat(2,minmax(0,300px))}
}
@media(max-width:700px){
html[data-layout-page=perfil] :is(#password-form,#user-form){grid-template-columns:minmax(0,300px)}
}
html[data-layout-page=recepcao] .registration-layout .field-grid{gap:8px 12px}
html[data-layout-page=agenda] .agenda-main{padding-top:16px}
html[data-layout-page=agenda] .section-head{margin-bottom:10px}
html[data-layout-page=baby] main > .topline{gap:12px;margin-bottom:16px}
html[data-layout-page=baby] main > .topline h1{margin-bottom:4px;line-height:1.2}
html[data-layout-page=baby] main > .hero{padding:20px;margin-bottom:16px;gap:16px}
html[data-layout-page=baby] main > :is(.panel,.cards){margin-bottom:16px}
html[data-layout-page=baby] main > .panel{padding:20px}
html[data-layout-page=metodo] main{margin-top:20px;margin-bottom:24px}
html[data-layout-page=composer] .workspace > .controls{padding:16px}
html[data-layout-page=composer] .controls > .step{margin-bottom:18px}
html[data-layout-page=composer] .workspace > .preview{padding:16px}
html[data-layout-page=planejamento] .workflow-card{padding:8px 14px}
html[data-layout-page=planejamento] .tool-panel .hint{margin-top:6px;margin-bottom:6px}
html:is([data-layout-page=portal],[data-layout-page=portal_manage]) .page-heading{padding-top:16px;margin-bottom:18px;gap:16px}
html:is([data-layout-page=portal],[data-layout-page=portal_manage]) :is(.family-grid,.clinic-grid){gap:16px}
html:is([data-layout-page=portal],[data-layout-page=portal_manage]) :is(.scan-card,.document-card,.access-card,.publish-card){padding:20px}
html[data-layout-page=portal_manage] .history-card{margin-top:16px;padding:16px 20px}
@media(max-width:700px){
html:is([data-layout-page=perfil],[data-layout-page=recepcao]) .profile-main{padding:16px 12px}
html:is([data-layout-page=perfil],[data-layout-page=recepcao]) .profile-main .panel{padding:16px}
html[data-layout-page=composer] .workspace > :is(.controls,.preview){padding:12px}
html:is([data-layout-page=portal],[data-layout-page=portal_manage]) :is(.scan-card,.document-card,.access-card,.publish-card){padding:16px}
}
}

/* Section boundaries: avoid stacking panel margins with heading margins. */
@media screen{
html[data-layout-page=index] #assessment-actions{margin-bottom:10px}
html[data-layout-page=index] #tela-avaliacao > .resultados-cab{margin:0 0 8px;gap:12px;align-items:center}
html[data-layout-page=index] #tela-avaliacao > .resultados-cab h2{margin:0;line-height:1.25}
html[data-layout-page=index] #painel-metricas:not(.classic-metrics-empty){padding:16px 20px;margin-bottom:12px}
html[data-layout-page=index] .classic-unified-history{margin-top:16px}
html[data-layout-page=index] #painel-metricas .met{padding:12px}
html:is([data-layout-page=perfil],[data-layout-page=recepcao]) .profile-main .panel > h2{margin-top:0;margin-bottom:12px;line-height:1.25}
html:is([data-layout-page=perfil],[data-layout-page=recepcao]) .profile-main .panel > p{margin-top:0;margin-bottom:12px}
html[data-layout-page=baby] main > h2{margin:16px 0 8px;line-height:1.25}
html[data-layout-page=baby] main > .panel > h2{margin-top:0;margin-bottom:12px;line-height:1.25}
html[data-layout-page=agenda] .section-head :is(h2,h3){margin:0;line-height:1.25}
html[data-layout-page=metodo] main > h2{margin:18px 0 8px;line-height:1.25}
html[data-layout-page=composer] .controls > .step > h2{margin-top:0;margin-bottom:10px;line-height:1.3}
html[data-layout-page=composer] .preview-head :is(h2,h3){margin:0;line-height:1.3}
html:is([data-layout-page=portal],[data-layout-page=portal_manage]) .page-heading h1{margin-bottom:6px;line-height:1.2}
html:is([data-layout-page=portal],[data-layout-page=portal_manage]) .card-heading :is(h2,h3){margin:0;line-height:1.25}
}

@media screen{
html[data-layout-page=index] #tela-paciente.classic-unified-history{margin-top:8px}
html[data-layout-page=index] #tela-paciente > .classic-assessment-title-row{margin:0 0 8px}
html[data-layout-page=index] #frame-panel.classic-technical-panel{margin-bottom:8px}
html[data-layout-page=index] #tela-paciente > .cartao{padding:16px 20px;margin-bottom:12px}
}

@media screen{
html[data-layout-page=laboratorio] body:not(.embedded) > aside{gap:12px}
html[data-layout-page=laboratorio] body:not(.embedded) > aside > .panel{margin:0;padding:14px}
html[data-layout-page=laboratorio] body:not(.embedded) > aside > h3{margin:0 0 4px}
html[data-layout-page=planejamento] .tool-panel .section > h3{margin-top:0;margin-bottom:10px;line-height:1.3}
}

@media screen{
html[data-layout-page=portal_manage] .publish-card fieldset{margin:12px 0}
html[data-layout-page=portal_manage] .publish-card legend{margin-bottom:6px}
html[data-layout-page=portal_manage] .publish-footer{padding:12px 0 0;margin-top:8px}
html[data-layout-page=portal_manage] .section-divider{margin:16px 0}
html[data-layout-page=portal_manage] #guardians:empty::before{padding:10px 0}
}

/* Seven summary metrics share one row on desktop; text remains readable below it. */
@media screen and (min-width:1050px){
html[data-layout-page=index] #painel-metricas .metricas{grid-template-columns:repeat(7,minmax(0,1fr));gap:8px}
html[data-layout-page=index] #painel-metricas .metricas .met{padding:10px 8px;min-width:0}
html[data-layout-page=index] #painel-metricas .metricas .met .v{font-size:20px;line-height:1.3;white-space:nowrap}
html[data-layout-page=index] #painel-metricas .metricas .met .r{font-size:9px;letter-spacing:0;overflow-wrap:anywhere}
html[data-layout-page=index] #painel-metricas .metricas .met .c{font-size:10px;line-height:1.3;overflow-wrap:anywhere}
}

@media screen{
html[data-layout-page=index] #painel-metricas .metricas-secondary{display:grid;grid-column:1/-1;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;min-width:0}
html[data-layout-page=index] #painel-metricas .metricas .metricas-secondary .met{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:5px 10px;min-width:0}
html[data-layout-page=index] #painel-metricas .metricas .metricas-secondary .r{font-size:10px;letter-spacing:0}
html[data-layout-page=index] #painel-metricas .metricas .metricas-secondary .v{font-size:16px;line-height:1.2;margin:0;white-space:nowrap}
html[data-layout-page=index] #painel-metricas .metricas-secondary .c:empty{display:none}
}
@media screen and (min-width:1050px){
html[data-layout-page=index] #painel-metricas .metricas{grid-template-columns:repeat(4,minmax(0,1fr)) 170px;gap:8px}
html[data-layout-page=index] #painel-metricas .metricas-secondary{grid-column:5;grid-template-columns:minmax(0,1fr);gap:4px}
}

@media screen and (min-width:1050px){
html[data-layout-page=index] #painel-metricas .metricas > .met{padding:12px}
html[data-layout-page=index] #painel-metricas .metricas > .met .r{font-size:10px;letter-spacing:.03em}
html[data-layout-page=index] #painel-metricas .metricas > .met .v{font-size:25px;line-height:1.3;margin:6px 0}
html[data-layout-page=index] #painel-metricas .metricas > .met .c{font-size:11px;line-height:1.35}
}

@media screen and (min-width:850px){
html[data-layout-page=index] #painel-metricas .projection-comparison:has(.projection-image){display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:20px;align-items:center;margin-top:12px}
html[data-layout-page=index] #painel-metricas .projection-comparison > .projection-metrics{grid-column:2;grid-row:1;min-width:0}
html[data-layout-page=index] #painel-metricas .projection-comparison > .projection-visual{grid-column:1;grid-row:1;min-width:0}
html[data-layout-page=index] #painel-metricas .projection-comparison .projection-image{max-height:380px;margin:0 auto}
html[data-layout-page=index] #painel-metricas .projection-comparison table{font-size:12px}
html[data-layout-page=index] #painel-metricas .projection-comparison td,html[data-layout-page=index] #painel-metricas .projection-comparison th{padding:7px 4px}
}

@media screen{html[data-layout-page=index] #painel-metricas .projection-stage-controls{min-width:0}html[data-layout-page=index] #painel-metricas .projection-visual{min-width:0}html[data-layout-page=index] #painel-metricas .projection-stage-controls .projection-stage{padding-top:8px}}

@media screen{.projection-panel select[aria-label="Versão do planejamento"]{display:block;width:auto!important;field-sizing:content;max-width:100%!important;min-width:0;padding-right:30px}}

@media screen and (min-width:850px){
html[data-layout-page=index] #painel-metricas .projection-comparison:not(:has(.projection-image)){display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:20px;align-items:start;margin-top:12px}
html[data-layout-page=index] #painel-metricas .projection-comparison:not(:has(.projection-image)) > .projection-metrics{grid-column:1;grid-row:1}
html[data-layout-page=index] #painel-metricas .projection-comparison:not(:has(.projection-image)) > .projection-visual{grid-column:2;grid-row:1}
html[data-layout-page=index] #painel-metricas .projection-comparison:not(:has(.projection-image)) > .projection-visual:not(:has(.projection-stage)){display:none}
}

/* Patient identity is centralized in the editor heading; keep legacy data hooks. */
@media screen{html[data-layout-page=index] :is(#a-nome,#a-idade,.classic-assessment-patient){display:none!important}}
