/* Shared ATLAS presentation layer. Navigation data still comes from NavigationRegistry. */
body.atlas-shell,
body.atlas-shell.module-panel-is-visible,
body.atlas-shell.module-panel-is-collapsed {
    display: block;
    background: var(--valcrena-bg);
}

.atlas-shell .main {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 16px 28px 48px;
}

.atlas-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 22px;
    min-height: 66px;
    padding: 0 28px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.atlas-topbar-brand {
    flex: 0 0 auto;
    color: var(--ink);
    font: 700 31px/1 var(--valcrena-font-display);
}
.atlas-topbar-brand:hover { text-decoration: none; }
.atlas-environment-badge { display: inline-block; padding: 5px 8px; border: 1px solid #a84433; background: #fff1ed; color: #8f281b; font: 700 11px/1.2 Arial, sans-serif; white-space: nowrap; }
.atlas-topnav { display: flex; align-items: stretch; gap: 4px; min-width: 0; height: 66px; }
.atlas-nav-dropdown { position: relative; flex: 0 0 auto; }
.atlas-nav-dropdown > summary {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 100%;
    padding: 0 12px;
    border-bottom: 2px solid transparent;
    color: var(--ink);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    list-style: none;
    white-space: nowrap;
}
.atlas-nav-dropdown > summary::-webkit-details-marker,
.atlas-mobile-menu > summary::-webkit-details-marker,
.dashboard-quick-actions > summary::-webkit-details-marker { display: none; }
.atlas-nav-dropdown.active > summary,
.atlas-more-menu:has(a[aria-current="page"]) > summary,
.atlas-nav-dropdown[open] > summary { border-bottom-color: var(--atlas-navy); color: var(--atlas-navy); }
.atlas-nav-dropdown > summary:hover { background: var(--surface-soft); }
.atlas-nav-dropdown .nav-icon { color: currentColor; width: 19px; flex-basis: 19px; }
.atlas-nav-dropdown .nav-icon svg { width: 18px; height: 18px; }
.atlas-nav-menu,
.atlas-mobile-menu-content,
.dashboard-quick-menu {
    position: absolute;
    top: calc(100% + 1px);
    min-width: 250px;
    max-height: min(72vh, 620px);
    overflow-y: auto;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    box-shadow: var(--shadow-floating);
}
.atlas-nav-menu { left: 0; }
.atlas-more-content { right: 0; left: auto; min-width: 320px; }
.atlas-nav-subgroup { display: grid; gap: 2px; padding: 5px 0; }
.atlas-nav-subgroup + .atlas-nav-subgroup { border-top: 1px solid var(--line); }
.atlas-nav-subgroup strong { padding: 7px 10px 4px; color: var(--ink); font-size: 12px; }
.atlas-nav-subgroup small { padding: 4px 10px 2px; color: var(--muted); font-size: 11px; }
.atlas-nav-subgroup a {
    display: block;
    padding: 8px 10px;
    border-radius: 4px;
    color: var(--ink);
    font-size: 12px;
}
.atlas-nav-subgroup a:hover,
.atlas-nav-subgroup a[aria-current="page"] { background: var(--surface-soft); color: var(--atlas-navy); text-decoration: none; }
.atlas-mobile-menu { display: none; position: relative; }

.atlas-topbar .global-user-header {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 0;
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
    background: transparent;
    position: static;
}
.atlas-topbar .global-search { flex: 0 1 250px; }
.atlas-topbar .global-search input { height: 38px; }
.atlas-topbar .global-user-menu summary strong { white-space: nowrap; }
.atlas-topbar .global-user-actions { z-index: 120; }
.atlas-shell .context-navigation { margin-bottom: 14px; }
.atlas-shell .panel,
.atlas-shell .form-card,
.atlas-shell .metric { border-radius: 8px; box-shadow: var(--shadow-surface); }
.atlas-shell .btn { border-radius: 6px; }
.atlas-shell .page-header { margin-bottom: 16px; }
.atlas-shell .page-header h1 { color: var(--ink); }

.atlas-shell .dashboard-shell { gap: 14px; }
.atlas-shell .dashboard-home { gap: 8px; }
.atlas-shell .dashboard-header { flex-direction: row; align-items: center; justify-content: space-between; margin-bottom: 0; text-align: left; }
.atlas-shell .dashboard-header h1 { font-size: 34px; }
.atlas-shell .dashboard-header .data-freshness { margin-top: 4px; }
.dashboard-quick-actions { position: relative; flex: 0 0 auto; }
.dashboard-quick-actions > summary { display: flex; align-items: center; gap: 12px; width: auto; cursor: pointer; list-style: none; }
.dashboard-quick-menu { right: 0; z-index: 60; min-width: 250px; }
.dashboard-quick-menu a { display: block; padding: 10px 12px; border-radius: 4px; color: var(--ink); font-size: 13px; }
.dashboard-quick-menu a:hover { background: var(--surface-soft); text-decoration: none; }
.atlas-shell .dashboard-segmented { border-radius: 6px; background: #fff; box-shadow: none; padding: 3px; }
.atlas-shell .dashboard-segmented a { border-radius: 4px; }
.atlas-shell .dashboard-segmented a.active { background: var(--atlas-navy); color: #fff; box-shadow: none; }
.atlas-shell .dashboard-filter-panel { background: #fff; }
.atlas-shell .dashboard-filter-summary { min-height: 48px; padding: 9px 15px; }
.atlas-shell .dashboard-command-center { gap: 14px; padding: 14px; border: 1px solid var(--line); background: #fff; color: var(--ink); box-shadow: var(--shadow-surface); }
.atlas-shell .dashboard-command-heading { align-items: center; }
.atlas-shell .dashboard-command-heading h2 { color: var(--ink); font-size: 19px; }
.atlas-shell .dashboard-command-heading > span { color: var(--muted); }
.atlas-shell .dashboard-command-kpis { gap: 10px; overflow: visible; border: 0; background: transparent; }
.atlas-shell .dashboard-command-kpis a { min-height: 102px; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
.atlas-shell .dashboard-command-kpis a:hover { background: var(--surface-soft); }
.atlas-shell .dashboard-command-kpis span,
.atlas-shell .dashboard-command-kpis small { color: var(--muted); }
.atlas-shell .dashboard-command-kpis strong { color: var(--atlas-navy); font-size: 22px; }
.atlas-shell .dashboard-kpi { border-radius: 8px; box-shadow: var(--shadow-surface); }
.atlas-shell .dashboard-kpi:hover { box-shadow: var(--shadow-elevated); }
.atlas-shell .dashboard-shell .panel { padding: 18px; border-radius: 8px; box-shadow: var(--shadow-surface); }
.atlas-shell .treasury-account-section { margin: 18px 0 12px; }
.atlas-shell .treasury-account-section .panel-header { margin-bottom: 8px; }
.atlas-shell .treasury-account-grid { display: flex; gap: 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.atlas-shell .treasury-account-grid > a { flex: 1 0 240px; min-height: 86px; padding: 12px 16px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: transparent; }
.atlas-shell .treasury-account-grid > a:last-child { border-right: 0; }
.atlas-shell .treasury-account-grid > .empty { padding: 16px; }
.atlas-shell .treasury-account-grid strong { font-size: 19px; }
.atlas-shell .treasury-main { margin-bottom: 18px; }
.atlas-shell .treasury-main th,
.atlas-shell .treasury-main td { padding: 11px 12px; }
.atlas-shell .treasury-position { gap: 0; margin-bottom: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.atlas-shell .treasury-position > div { min-height: 82px; padding: 12px 16px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: transparent; }
.atlas-shell .treasury-position > div:last-child { border-right: 0; }
.atlas-shell .treasury-position strong { font-size: 18px; }
.atlas-shell .invoice-review-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 1fr); align-items: start; gap: 16px; }
.atlas-shell .invoice-inbox-hero > div:first-child { min-width: 0; }
.atlas-shell .invoice-inbox-hero h1 { overflow-wrap: anywhere; }
.atlas-shell .invoice-review-details { display: grid; min-width: 0; gap: 16px; }
.atlas-shell .invoice-document-panel { min-width: 0; }
.atlas-shell .invoice-document-preview { display: block; width: 100%; min-height: 700px; border: 1px solid var(--line); background: var(--surface-soft); }
.atlas-shell .invoice-pdf-viewer { min-width: 0; border: 1px solid var(--line); background: var(--surface-soft); }
.atlas-shell .invoice-pdf-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px; border-bottom: 1px solid var(--line); background: #fff; }
.atlas-shell .invoice-pdf-toolbar button { min-height: 34px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); cursor: pointer; }
.atlas-shell .invoice-pdf-toolbar button:disabled { opacity: .45; cursor: default; }
.atlas-shell .invoice-pdf-toolbar span { margin-right: auto; color: var(--ink); white-space: nowrap; }
.atlas-shell .invoice-pdf-status { margin: 0; padding: 16px; color: var(--muted); }
.atlas-shell .invoice-pdf-stage { min-height: 600px; padding: 12px; overflow: auto; text-align: center; }
.atlas-shell .invoice-pdf-canvas { display: block; max-width: none; margin: 0 auto; background: #fff; box-shadow: 0 2px 12px #101f3826; }
.atlas-shell .invoice-pdf-toolbar[hidden], .atlas-shell .invoice-pdf-stage[hidden] { display: none; }
.atlas-shell .invoice-document-image { height: auto; min-height: 0; max-height: 800px; object-fit: contain; }
.atlas-shell .invoice-preview-fallback { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.atlas-shell .budget-search-form { display: flex; align-items: stretch; gap: 8px; margin-bottom: 12px; }
.atlas-shell .budget-search-form input { flex: 1 1 auto; min-width: 0; }
.atlas-shell .budget-search-form button { flex: 0 0 auto; }
.atlas-shell .invoice-extracted-fields { margin: 0; }
.atlas-shell .invoice-extracted-fields > div { display: grid; grid-template-columns: minmax(120px, 36%) minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.atlas-shell .invoice-extracted-fields > div:last-child { border-bottom: 0; }
.atlas-shell .invoice-extracted-fields dt { color: var(--muted); font-weight: 600; }
.atlas-shell .invoice-extracted-fields dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.atlas-shell .invoice-extracted-fields dd span { display: block; color: var(--ink); font-weight: 600; }
.atlas-shell .invoice-extracted-fields dd small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.atlas-shell .invoice-inbox-summary { display: flex; gap: 0; margin: 14px 0; overflow-x: auto; border-radius: 8px; background: #fff; }
.atlas-shell .invoice-inbox-summary a { display: grid; flex: 1 0 130px; align-content: center; min-height: 70px; padding: 10px 14px; border-right: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.atlas-shell .invoice-inbox-summary a:last-child { border-right: 0; }
.atlas-shell .invoice-inbox-summary a:hover { background: var(--surface-soft); }
.atlas-shell .invoice-inbox-summary strong { font-size: 18px; color: var(--atlas-navy); }
.atlas-shell .invoice-inbox-summary + .search-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(175px, 230px) auto; align-items: center; gap: 8px; margin-bottom: 12px; }
.atlas-shell .invoice-inbox-summary + .search-form > * { min-width: 0; width: 100%; }
.atlas-shell #invoice-bulk-form + .panel .table-wrap table,
.atlas-shell .tabs + .search-form + .panel .table-wrap table,
.atlas-shell .payment-list-table .table-wrap table { min-width: 1040px; }
.atlas-shell .purchase-order-list-table { min-width: 1120px; }
.atlas-shell .purchase-order-list-table th:first-child,
.atlas-shell .purchase-order-list-table td:first-child { min-width: 145px; white-space: nowrap; }
.atlas-shell .purchase-order-list-table th:last-child,
.atlas-shell .purchase-order-list-table td:last-child { min-width: 115px; white-space: nowrap; }
.atlas-shell .certification-list-table { min-width: 1150px; }
.atlas-shell .certification-list-table th:first-child,
.atlas-shell .certification-list-table td:first-child { min-width: 145px; white-space: nowrap; }
.atlas-shell .certification-list-table th:nth-last-child(-n+2),
.atlas-shell .certification-list-table td:nth-last-child(-n+2) { min-width: 110px; white-space: nowrap; }
.atlas-shell .formalization-list-table { min-width: 1250px; }
.atlas-shell .formalization-list-table th:first-child,
.atlas-shell .formalization-list-table td:first-child { min-width: 145px; white-space: nowrap; }
.atlas-shell .formalization-list-table th:nth-child(6),
.atlas-shell .formalization-list-table td:nth-child(6) { min-width: 135px; white-space: nowrap; }
.atlas-shell .financing-list-table { min-width: 1100px; }
.atlas-shell .financing-list-table th:first-child,
.atlas-shell .financing-list-table td:first-child { min-width: 145px; white-space: nowrap; }
.atlas-shell .financing-list-table th:nth-child(4),
.atlas-shell .financing-list-table td:nth-child(4) { min-width: 115px; white-space: nowrap; }
.atlas-shell .financing-target-kind { min-width: 0; margin: 0; padding: 0; border: 0; }
.atlas-shell .financing-target-kind > legend { margin-bottom: 8px; font-weight: 600; }
.atlas-shell .financing-target-kind > .boolean-control { display: flex; flex-wrap: wrap; gap: 8px; }
.atlas-shell .financing-target-kind > .boolean-control > div { min-width: 0; }
.atlas-shell .financing-target-kind label { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 5px; cursor: pointer; }
.atlas-shell .financing-target-kind label:has(input:checked) { border-color: var(--atlas-navy); background: var(--surface-soft); color: var(--atlas-navy); }
.atlas-shell .financing-target-kind label input { margin: 0; accent-color: var(--atlas-navy); }
.atlas-shell .order-cancel-details { margin: 0 0 16px; }
.atlas-shell .order-cancel-details > summary { width: fit-content; color: var(--muted); cursor: pointer; font-size: 13px; }
.atlas-shell .order-cancel-details > form { max-width: 680px; margin-top: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--valcrena-surface); }
.atlas-shell .contract-management-details { margin: 16px 0; }
.atlas-shell .contract-management-details > summary { width: fit-content; color: var(--muted); cursor: pointer; font-size: 13px; }
.atlas-shell .contract-management-actions { display: grid; gap: 12px; max-width: 680px; margin-top: 10px; }
.atlas-shell .contract-management-actions > form { padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--valcrena-surface); }
.atlas-shell .purchase-request-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(170px, 230px) auto; align-items: center; gap: 8px; margin-bottom: 14px; }
.atlas-shell .purchase-request-toolbar > * { min-width: 0; width: 100%; }
.atlas-shell .purchase-request-list-table { min-width: 860px; }
.atlas-shell .purchase-request-list-table th:first-child,
.atlas-shell .purchase-request-list-table td:first-child,
.atlas-shell .purchase-request-list-table th:nth-child(4),
.atlas-shell .purchase-request-list-table td:nth-child(4) { white-space: nowrap; }
.atlas-shell .page-return { display: flex; margin-bottom: 12px; }
.atlas-shell .procurement-form { display: grid; gap: 16px; }
.atlas-shell .procurement-form .form-section { min-width: 0; }
.atlas-shell .procurement-form .form-section + .form-section { margin-top: 0; padding-top: 20px; border-top: 0; }
.atlas-shell .procurement-form .form-actions { margin-top: 0; }
.atlas-shell .tabs + .search-form { display: grid; grid-template-columns: minmax(200px, 1fr) repeat(3, minmax(120px, 180px)) auto; align-items: center; gap: 8px; margin-bottom: 12px; }
.atlas-shell .tabs + .search-form > * { min-width: 0; width: 100%; }
.atlas-shell .auth-card { max-width: 460px; margin: 8vh auto; }
.atlas-shell .auth-brand { margin-bottom: 14px; }
.atlas-shell .auth-brand strong { font-size: 36px; }

@media (min-width: 1181px) {
    .atlas-shell .dashboard-home { grid-template-columns: max-content minmax(0, 1fr); }
    .atlas-shell .dashboard-home .dashboard-header > div:first-child { display: flex; align-items: baseline; gap: 16px; }
    .atlas-shell .dashboard-home .dashboard-header .data-freshness { margin-top: 0; }
    .dashboard-home > :not(.dashboard-segmented):not(.dashboard-filter-panel) { grid-column: 1 / -1; }
    .dashboard-home > .dashboard-segmented { grid-column: 1; }
    .dashboard-home > .dashboard-filter-panel { grid-column: 2; min-width: 0; }
}

@media (max-width: 1180px) {
    .atlas-shell .invoice-review-layout { grid-template-columns: minmax(0, 1fr); }
    .atlas-shell .invoice-document-preview { min-height: 540px; }
    .atlas-topbar { gap: 12px; padding: 0 18px; }
    .atlas-topnav { display: none; }
    .atlas-mobile-menu { display: block; }
    .atlas-mobile-menu > summary { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; list-style: none; }
    .atlas-mobile-menu-content { left: 0; z-index: 110; width: min(380px, calc(100vw - 28px)); }
    .atlas-topbar .global-user-header { margin-left: auto; }
    .atlas-topbar .global-search { flex-basis: 220px; }
    .atlas-shell .dashboard-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .atlas-shell .dashboard-kpi,
    .atlas-shell .dashboard-kpi.kpi-primary { grid-column: auto; }
}
@media (max-width: 720px) {
    .atlas-shell .data-list > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .atlas-shell .data-list dd { min-width: 0; overflow-wrap: anywhere; }
    .atlas-shell .budget-search-form { flex-wrap: wrap; }
    .atlas-shell .budget-search-form input { flex-basis: 100%; }
    .atlas-shell .invoice-pdf-stage { min-height: 360px; }
    .atlas-shell .purchase-request-toolbar { grid-template-columns: minmax(0, 1fr); }
    .atlas-shell .invoice-extracted-fields > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .atlas-shell .invoice-inbox-summary + .search-form { grid-template-columns: minmax(0, 1fr); }
    .atlas-shell .tabs + .search-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .atlas-shell .tabs + .search-form > :first-child { grid-column: 1 / -1; }
    .atlas-shell .invoice-document-preview { min-height: 420px; }
    .atlas-shell .main { padding: 16px 14px 36px; }
    .atlas-topbar { gap: 8px; min-height: 58px; padding: 0 12px; }
    .atlas-topbar-brand { font-size: 25px; }
    .atlas-topbar .global-user-header { gap: 6px; }
    .atlas-topbar .global-search { flex: 1 1 auto; }
    .atlas-topbar .global-search input { width: 100%; min-width: 0; }
    .atlas-topbar .global-user-menu summary strong { display: none; }
    .atlas-shell .dashboard-header { flex-direction: row; align-items: flex-start; gap: 10px; }
    .atlas-shell .dashboard-header h1 { font-size: 29px; }
    .dashboard-quick-actions > summary { width: auto; padding: 9px; font-size: 12px; }
    .dashboard-quick-menu { right: 0; min-width: min(260px, calc(100vw - 28px)); }
    .atlas-shell .dashboard-command-kpis { grid-template-columns: 1fr; }
    .atlas-shell .dashboard-kpi-grid { grid-template-columns: 1fr; }
    .atlas-shell .treasury-position > div { border-right: 0; border-bottom: 1px solid var(--line); }
    .atlas-shell .treasury-position > div:last-child { border-bottom: 0; }
}
@media (max-width: 500px) {
    .atlas-topbar { flex-wrap: wrap; padding: 9px 12px; }
    .atlas-mobile-menu-content { position: fixed; inset: 107px 14px auto; width: auto; max-height: calc(100dvh - 121px); }
    .atlas-topbar .global-user-header { flex: 1 1 100%; }
    .atlas-topbar .global-search { flex: 1 1 auto; }
    .atlas-shell .dashboard-header { flex-direction: column; }
    .dashboard-quick-actions > summary { width: fit-content; }
    .dashboard-quick-menu { left: 0; right: auto; }
    .atlas-shell .dashboard-segmented { display: flex; flex-wrap: wrap; overflow: visible; }
    .atlas-shell .dashboard-segmented a { flex: 1 1 auto; text-align: center; white-space: normal; }
    .atlas-shell .dashboard-filter-summary { align-items: flex-start; gap: 8px; }
    .atlas-shell .dashboard-filter-summary span:first-child { display: grid; flex: 1 1 auto; gap: 2px; }
    .atlas-shell .dashboard-filter-summary small { white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
    .atlas-shell .dashboard-filter-summary-action { flex: 0 0 auto; }
}
