/* Unified screen composition. Screen-only: printed invoices and reports retain their templates. */
@media screen {
    body.erp-formal-theme article.content { --screen-line:#dce6e8; --screen-soft:#f4f8f8; --screen-ink:#263f47; --screen-muted:#657d86; }
    body.erp-formal-theme article.content .erp-page-header {
        padding:22px 26px!important; margin-bottom:22px; min-height:92px; display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:16px;
        background:linear-gradient(110deg,#edf4f4,#fff 75%)!important; border:1px solid #dce6e8!important; border-radius:14px!important; box-shadow:none;
    }
    body.erp-formal-theme article.content .erp-page-header::before { display:none; }
    body.erp-formal-theme article.content .erp-page-header>.d-flex { min-width:0; flex:1; gap:14px; }
    body.erp-formal-theme article.content .erp-page-header>.d-flex>div:last-child { min-width:0; }
    body.erp-formal-theme article.content .erp-page-title { font-size:clamp(1.2rem,1.8vw,1.65rem); line-height:1.6; letter-spacing:-.25px; }
    body.erp-formal-theme article.content .erp-page-subtitle { font-size:.78rem; line-height:1.85; margin-top:4px; }
    body.erp-formal-theme article.content .erp-page-header .page-icon-wrapper { flex:0 0 44px; height:44px; margin:0!important; border-radius:11px; }
    body.erp-formal-theme article.content .erp-page-header :is(.btn,.searchable-select-trigger) { flex-shrink:0; }

    /* Shared cards; dense list bodies and dedicated dashboards keep their own interior layout. */
    body.erp-formal-theme article.content .card.erp-card { border-color:var(--screen-line)!important; border-radius:14px!important; overflow:visible; }
    body.erp-formal-theme article.content .card.erp-card>.card-header { border-radius:13px 13px 0 0; padding:16px 22px!important; min-height:56px; }
    body.erp-formal-theme article.content .card.erp-card>.card-header :is(h5,strong) { font-size:.93rem; line-height:1.7; }
    body.erp-formal-theme article.content .card.screen-control-card:not(.master-data-editor)>.card-header { background:#f6f9f9!important; border-bottom:1px solid var(--screen-line)!important; }
    body.erp-formal-theme article.content .card.screen-control-card:not(.master-data-editor)>.card-body:not(.p-0) { padding:24px!important; }
    body.erp-formal-theme article.content .screen-control-card.crud-editor-page::before { display:none; }

    /* Container-sized grids: a narrow editor beside a list gets the same care as a phone. */
    body.erp-formal-theme .screen-field-grid {
        display:grid; grid-template-columns:repeat(12,minmax(0,1fr)); gap:20px; align-items:start!important;
        margin-inline:0!important; --bs-gutter-x:0; --bs-gutter-y:0; container:erp-fields / inline-size;
    }
    body.erp-formal-theme .screen-field-grid>.screen-grid-cell { grid-column:span var(--screen-field-span,3); min-width:0; width:auto!important; max-width:100%; padding-inline:0!important; margin-top:0!important; }
    body.erp-formal-theme .screen-grid-single { --screen-field-span:12; }
    body.erp-formal-theme .screen-grid-pair { --screen-field-span:6; }
    body.erp-formal-theme .screen-grid-triple { --screen-field-span:4; }
    body.erp-formal-theme .screen-field-grid>.screen-cell-wide { grid-column:span 6; }
    body.erp-formal-theme .screen-field-grid>.screen-cell-full { grid-column:1/-1; }
    body.erp-formal-theme .screen-field-grid>.screen-field { padding-top:0!important; padding-bottom:0!important; }
    body.erp-formal-theme .screen-field .form-label { display:block; margin:0 0 8px; font-size:.79rem; line-height:1.7; font-weight:500!important; color:#415e68!important; }
    body.erp-formal-theme .screen-field :is(.form-control,.form-select,.searchable-select-trigger) { min-height:45px; width:100%; font-size:.86rem; border-radius:8px; padding:.6rem .75rem; border-color:#c5d7dc; }
    body.erp-formal-theme .screen-field .searchable-select { min-width:0; max-width:100%; }
    body.erp-formal-theme .screen-field .searchable-select-trigger { display:flex; align-items:center; gap:8px; }
    body.erp-formal-theme .screen-field .searchable-select-value { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:start; }
    body.erp-formal-theme .screen-field .searchable-select-icon { flex-shrink:0; }
    body.erp-formal-theme .screen-field textarea.form-control { min-height:96px; resize:vertical; }
    body.erp-formal-theme .screen-field :is(small,.form-text) { display:block; font-size:.69rem; line-height:1.8; margin-top:5px; color:#6c828b; }
    body.erp-formal-theme .screen-field .input-group { flex-wrap:nowrap; }
    body.erp-formal-theme .screen-field .input-group>:is(input,.searchable-select) { flex:1; width:0; min-width:0; }
    body.erp-formal-theme .screen-field .input-group>.input-group-text { font-size:.8rem; padding-inline:12px; }
    body.erp-formal-theme .screen-field :is(.form-control,.form-select,.searchable-select-trigger):focus-visible { outline:2px solid #397d88; outline-offset:2px; box-shadow:none; }
    body.erp-formal-theme .screen-section-heading { padding-top:18px; border-top:1px solid #e1eaec; margin-bottom:0!important; }
    body.erp-formal-theme .screen-section-heading:first-child { padding-top:0; border:0; }
    body.erp-formal-theme .screen-section-heading :is(h2,h3,h4,h5,h6) { color:#315963!important; font-size:.94rem; font-weight:600!important; line-height:1.8; }
    body.erp-formal-theme .screen-section-heading>h6 { border-bottom:0!important; padding-bottom:0!important; margin-bottom:0; }
    body.erp-formal-theme .screen-section-heading:has(>.table-responsive) { border-top:0; padding-top:0; }
    body.erp-formal-theme .screen-form-actions { display:flex; flex-wrap:wrap; align-items:center; gap:10px; border-top:1px solid #dce6e8; padding-block:18px 4px!important; margin-top:20px!important; }
    body.erp-formal-theme .screen-form-actions>.btn { min-height:44px; min-width:120px; margin:0!important; font-size:.81rem; }
    body.erp-formal-theme .screen-form-actions[hidden] { display:none!important; }
    body.erp-formal-theme .screen-switch { display:flex!important; align-items:center; gap:12px; min-height:45px; width:100%; padding:12px 15px!important; margin:0!important; background:#f5f9f9!important; border:1px solid #d8e4e7!important; border-radius:9px!important; }
    body.erp-formal-theme .screen-switch .form-check-input { flex:0 0 38px; float:none; width:38px; height:22px; margin:0!important; cursor:pointer; }
    body.erp-formal-theme .screen-switch .form-check-label { margin:0!important; font-size:.78rem; font-weight:500!important; color:#415e68; cursor:pointer; line-height:1.7; }
    body.erp-formal-theme .screen-switch:has(input:checked) { background:#eef6f5!important; border-color:#bcd6d9!important; }
    body.erp-formal-theme .screen-cell-full>.screen-switch { max-width:520px; }
    body.erp-formal-theme :is(.screen-editor-tabs,.system-settings-tabs) { display:flex; flex-wrap:wrap; gap:8px!important; padding-bottom:18px!important; border-bottom:1px solid #dce6e8!important; }
    body.erp-formal-theme :is(.screen-editor-tabs>.btn,.system-settings-tabs .nav-link) { min-width:0; min-height:44px; padding:10px 16px!important; border:1px solid #d6e3e6!important; border-radius:8px; font-size:.79rem; font-weight:500!important; color:#506d78!important; background:#fff!important; box-shadow:none!important; transform:none!important; }
    body.erp-formal-theme :is(.screen-editor-tabs>.btn-primary,.screen-editor-tabs>.btn-success,.screen-editor-tabs>.btn-info,.screen-editor-tabs>.btn-warning,.system-settings-tabs .nav-link.active) { color:#fff!important; background:#205e66!important; border-color:#205e66!important; }
    body.erp-formal-theme .screen-entry-form .validation-errors { padding:12px 28px; border:1px solid #ead1cd; border-radius:8px; background:#fff7f6; font-size:.8rem; }
    body.erp-formal-theme .screen-entry-form :is(.validation-message,.alert) { overflow-wrap:anywhere; }

    /* List search uses the table width; pagination and row limits retain their handlers. */
    body.erp-formal-theme .screen-table-tools { width:100%; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; margin:0; padding:14px 0; }
    body.erp-formal-theme .screen-table-tools>.table-search-box { grid-column:1/-1; width:100%; max-width:none; min-height:45px; }
    body.erp-formal-theme .screen-table-tools .table-row-limit { justify-self:start; }
    body.erp-formal-theme .screen-table-tools .table-pager { justify-self:end; }
    body.erp-formal-theme .screen-table-tools .table-row-limit label { margin:0; font-size:.75rem; }
    body.erp-formal-theme .screen-table-tools .table-row-limit :is(input,select) { width:76px; min-height:36px; border-radius:7px; }
    body.erp-formal-theme article.content .table-tools-toolbar:has(>.screen-table-tools) { display:block; padding:0 20px; }
    body.erp-formal-theme article.content .crud-list-toolbar:has(>.screen-table-tools) { flex-wrap:wrap; padding:16px 20px; gap:12px; }
    body.erp-formal-theme article.content :is(.table-responsive,.erp-table-scroll) { max-width:100%; overscroll-behavior-inline:contain; }
    body.erp-formal-theme article.content :is(.screen-entry-form,.screen-control-card) table :is(.form-control,.form-select,.searchable-select-trigger) { min-height:38px; font-size:.8rem; }
    body.erp-formal-theme article.content :is(.screen-entry-form,.screen-control-card) table .searchable-select { min-width:145px; }
    body.erp-formal-theme article.content :is(.screen-entry-form,.screen-control-card) table input:not([type=checkbox]):not([type=radio]) { min-width:100px; }
    body.erp-formal-theme article.content :is(.screen-entry-form,.screen-control-card) table input[type=text] { min-width:150px; }

    /* Compact document lists: title, count and create action share the page heading. */
    body.erp-formal-theme article.content .document-workspace .document-list-heading { min-height:0; padding:12px 16px!important; margin-bottom:12px; gap:12px; flex-wrap:wrap; }
    body.erp-formal-theme article.content .document-workspace .document-list-heading>.d-flex { flex:0 1 auto; }
    body.erp-formal-theme article.content .document-list-heading .page-icon-wrapper { width:40px; height:40px; flex-basis:40px; }
    body.erp-formal-theme article.content .document-list-heading .erp-page-title { font-size:1.25rem; margin:0; }
    body.erp-formal-theme article.content .document-list-heading .erp-page-subtitle { margin:3px 0 0; }
    .document-list-heading__title { display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
    body.erp-formal-theme article.content .document-list-heading__add { margin-inline-start:0; margin-inline-end:auto; white-space:nowrap; }
    html.crud-editor-page-open .document-list-heading__add, html.crud-editor-page-open .document-list-count { display:none!important; }
    body.erp-formal-theme article.content .document-list-card .table-tools-toolbar { padding:0 12px!important; }
    body.erp-formal-theme .document-list-card .screen-table-tools { display:flex; align-items:center; flex-wrap:wrap; padding:10px 0; gap:8px; }
    body.erp-formal-theme .document-list-card .screen-table-tools>.table-search-box { flex:1 1 260px; width:auto; min-height:36px; }
    body.erp-formal-theme .document-list-card .screen-table-tools .table-row-limit :is(input,select) { min-height:34px; }
    body.erp-formal-theme article.content .document-list-card .erp-modern-table :is(th,td) { padding:7px 10px!important; line-height:1.5; }

    /* Existing module overviews follow the HR panel language without changing their data. */
    body.erp-formal-theme article.content .dashboard-hero { padding:30px; min-height:140px; background:linear-gradient(110deg,#edf4f4,#fff 75%); border:1px solid #dce6e8; border-radius:16px!important; }
    body.erp-formal-theme article.content .dashboard-hero h1 { font-size:1.7rem; line-height:1.65; }
    body.erp-formal-theme article.content .dashboard-panel { border-radius:14px!important; overflow:hidden; }
    body.erp-formal-theme article.content .dashboard-panel__header { padding:18px 22px!important; background:#f8fafb!important; }
    body.erp-formal-theme article.content .dashboard-kpi { height:100%; min-height:150px; padding:22px; border-radius:14px!important; display:flex; flex-direction:column; justify-content:center; gap:6px; }
    body.erp-formal-theme article.content .dashboard-kpi__value { font-size:2.15rem; }
    body.erp-formal-theme article.content .dashboard-kpi__label { font-size:.83rem; color:#415e68; }
    body.erp-formal-theme article.content .dashboard-kpi__hint { font-size:.7rem; }
    body.erp-formal-theme article.content .dashboard-action { min-height:76px; gap:14px; padding:17px 22px; }
    body.erp-formal-theme article.content .dashboard-action strong { font-size:.86rem; }
    body.erp-formal-theme article.content .dashboard-action small { font-size:.72rem; line-height:1.8; }

    @container erp-fields (max-width:1000px) {
        body.erp-formal-theme .screen-field-grid>.screen-grid-cell { grid-column:span var(--screen-field-span,4); }
        body.erp-formal-theme .screen-field-grid>.screen-cell-wide { grid-column:span 8; }
        body.erp-formal-theme .screen-field-grid>.screen-cell-full { grid-column:1/-1; }
    }
    @container erp-fields (max-width:760px) {
        body.erp-formal-theme .screen-field-grid>.screen-grid-cell { grid-column:span 6; }
        body.erp-formal-theme .screen-field-grid>.screen-cell-wide,body.erp-formal-theme .screen-field-grid>.screen-cell-full { grid-column:1/-1; }
    }
    @container erp-fields (max-width:500px) { body.erp-formal-theme .screen-field-grid>.screen-grid-cell { grid-column:1/-1; } }
    @media (max-width:767px) {
        body.erp-formal-theme article.content .erp-page-header { padding:18px!important; min-height:0; margin-bottom:18px; gap:14px; }
        body.erp-formal-theme article.content .erp-page-header>.d-flex { flex-wrap:wrap; }
        body.erp-formal-theme article.content .erp-page-header .page-icon-wrapper { flex-basis:36px; width:36px; height:36px; }
        body.erp-formal-theme article.content .erp-page-title { font-size:1.2rem; }
        body.erp-formal-theme article.content .erp-page-subtitle { font-size:.71rem; }
        body.erp-formal-theme article.content .card.erp-card>.card-header { padding:15px 16px!important; }
        body.erp-formal-theme article.content .card.screen-control-card:not(.master-data-editor)>.card-body:not(.p-0) { padding:18px 15px!important; }
        body.erp-formal-theme .screen-field-grid { gap:17px; }
        body.erp-formal-theme .screen-form-actions { gap:8px; }
        body.erp-formal-theme .screen-form-actions>.btn { flex:1 1 125px; min-width:0; }
        body.erp-formal-theme article.content .table-tools-toolbar:has(>.screen-table-tools) { padding-inline:12px; }
        body.erp-formal-theme article.content .crud-list-toolbar:has(>.screen-table-tools) { padding:14px 12px; }
        body.erp-formal-theme .screen-table-tools { grid-template-columns:minmax(0,1fr); }
        body.erp-formal-theme .screen-table-tools .table-pager { justify-self:start; }
        body.erp-formal-theme article.content .dashboard-hero { padding:22px; }
        body.erp-formal-theme article.content .dashboard-hero h1 { font-size:1.4rem; }
        body.erp-formal-theme article.content .dashboard-kpi { min-height:130px; padding:18px; }
        body.erp-formal-theme article.content .dashboard-kpi__value { font-size:1.7rem; }
    }
}
