/*
 * AQUILA_PLATFORM_VISUAL_HARMONIZATION_R1
 *
 * WHOLE-SYSTEM PRESENTATION SUPPORT.
 *
 * This stylesheet:
 * - does not render workspaces;
 * - does not own routes;
 * - does not intercept clicks;
 * - does not load or transform business data;
 * - does not replace native workflows;
 * - does not restyle the approved Accounting canonical UI;
 * - does not alter the Menu-Deck.
 */


/* ==========================================================
   1. UBuzima+ SHARED VISUAL TOKENS
   ========================================================== */

:root {
    --aq-ui-page-space: 24px;
    --aq-ui-card-space: 20px;
    --aq-ui-grid-gap: 16px;
    --aq-ui-control-gap: 12px;

    --aq-ui-radius-lg: 16px;
    --aq-ui-radius-md: 12px;
    --aq-ui-radius-sm: 9px;

    --aq-ui-bg: #f8fafc;
    --aq-ui-surface: #ffffff;

    --aq-ui-ink: #0f172a;
    --aq-ui-heading: #173a75;
    --aq-ui-muted: #64748b;
    --aq-ui-soft: #94a3b8;

    --aq-ui-border: rgba(15, 23, 42, 0.10);
    --aq-ui-border-soft: rgba(15, 23, 42, 0.07);

    --aq-ui-shadow:
        0 4px 18px rgba(15, 23, 42, 0.04);

    --aq-ui-focus:
        0 0 0 3px rgba(37, 99, 235, 0.14);
}


/* ==========================================================
   2. KNOWN BUSINESS WORKSPACE ROOTS
   ========================================================== */

:where(
    .section-page,
    .dedicated-module-page,
    .dashboard-overview-page,
    .dashboard-operating-page,
    .pos-sales-overview,
    .inventory-module-home,
    .inventory-workspace-shell,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
) {
    box-sizing: border-box;
    color: var(--aq-ui-ink);
}


/* Approved Accounting is deliberately protected. */

[data-aquila-accounting-reference-ui="1"] {
    --aq-platform-harmonization-protected: 1;
}


/* ==========================================================
   3. PAGE RHYTHM
   ========================================================== */

:where(
    .dashboard-overview-page,
    .dashboard-operating-page,
    .pos-sales-overview,
    .inventory-module-home,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
) {
    width: 100%;
    min-width: 0;
}

:where(
    .dedicated-module-page,
    .dashboard-overview-page,
    .dashboard-operating-page,
    .pos-sales-overview,
    .inventory-module-home,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home
) {
    gap: var(--aq-ui-grid-gap);
}


/* ==========================================================
   4. HUMANIZED TYPOGRAPHY
   ========================================================== */

:where(
    .section-page,
    .dedicated-module-page,
    .dashboard-overview-page,
    .pos-sales-overview,
    .inventory-module-home,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
)
:where(h1, h2, h3) {
    color: var(--aq-ui-heading);
    letter-spacing: -0.018em;
}

:where(
    .section-page,
    .dedicated-module-page,
    .dashboard-overview-page,
    .pos-sales-overview,
    .inventory-module-home,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
)
h1 {
    line-height: 1.18;
}

:where(
    .section-page,
    .dedicated-module-page,
    .dashboard-overview-page,
    .pos-sales-overview,
    .inventory-module-home,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
)
:where(
    .eyebrow,
    [class*="eyebrow"]
) {
    color: var(--aq-ui-muted);
    font-size: 11px;
    line-height: 1.35;
    font-weight: 800;
    letter-spacing: 0.075em;
    text-transform: uppercase;
}

:where(
    .section-page,
    .dedicated-module-page,
    .dashboard-overview-page,
    .pos-sales-overview,
    .inventory-module-home,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
)
:where(
    .muted,
    small
) {
    color: var(--aq-ui-muted);
}


/* ==========================================================
   5. HERO / INTRO SURFACES
   ========================================================== */

:where(
    .module-page-intro,
    .dashboard-operating-hero,
    .insurance-hero
) {
    box-sizing: border-box;
    border: 1px solid var(--aq-ui-border);
    border-radius: var(--aq-ui-radius-lg);
    background: var(--aq-ui-surface);
    box-shadow: var(--aq-ui-shadow);
    padding: var(--aq-ui-card-space);
}


/* ==========================================================
   6. CARD SYSTEM
   ========================================================== */

:where(
    .dashboard-overview-page,
    .dashboard-operating-page,
    .pos-sales-overview,
    .inventory-module-home,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
)
:where(
    article,
    [class$="-card"],
    [class*="-card "],
    [class$="__card"],
    [class*="__card "]
) {
    box-sizing: border-box;
    border-radius: var(--aq-ui-radius-lg);
}

:where(
    .dashboard-overview-page,
    .dashboard-operating-page,
    .pos-sales-overview,
    .inventory-module-home,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
)
article {
    border-color: var(--aq-ui-border);
}


/* ==========================================================
   7. BUTTON / ACTION GEOMETRY
   Colors remain owned by each business workspace.
   ========================================================== */

:where(
    .section-page,
    .dedicated-module-page,
    .dashboard-overview-page,
    .pos-sales-overview,
    .inventory-module-home,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
)
:where(
    button,
    a[role="button"]
)
:not(
    nav button
)
:not(
    [class*="deck"]
)
:not(
    [class*="dock"]
)
:not(
    [class*="tree-"]
) {
    min-height: 36px;
    border-radius: var(--aq-ui-radius-sm);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

:where(
    .section-page,
    .dedicated-module-page,
    .dashboard-overview-page,
    .pos-sales-overview,
    .inventory-module-home,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
)
button:focus-visible {
    outline: none;
    box-shadow: var(--aq-ui-focus);
}

:where(
    .section-page,
    .dedicated-module-page,
    .dashboard-overview-page,
    .pos-sales-overview,
    .inventory-module-home,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
)
button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}


/* ==========================================================
   8. FORM CONTROLS
   ========================================================== */

:where(
    .section-page,
    .dedicated-module-page,
    .dashboard-overview-page,
    .pos-sales-overview,
    .inventory-module-home,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
)
:where(
    input:not([type="checkbox"]):not([type="radio"]),
    select,
    textarea
) {
    box-sizing: border-box;
    min-height: 38px;
    border-radius: var(--aq-ui-radius-sm);
    border-color: var(--aq-ui-border);
    font: inherit;
}

:where(
    .section-page,
    .dedicated-module-page,
    .dashboard-overview-page,
    .pos-sales-overview,
    .inventory-module-home,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
)
:where(
    input,
    select,
    textarea
):focus {
    outline: none;
    box-shadow: var(--aq-ui-focus);
}


/* ==========================================================
   9. TABLE SYSTEM
   ========================================================== */

:where(
    .dedicated-module-page,
    .dashboard-overview-page,
    .dashboard-operating-page,
    .pos-sales-overview,
    .inventory-module-home,
    .inventory-workspace-shell,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
)
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

:where(
    .dedicated-module-page,
    .dashboard-overview-page,
    .dashboard-operating-page,
    .pos-sales-overview,
    .inventory-module-home,
    .inventory-workspace-shell,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
)
thead th {
    color: #475569;
    background: #f8fafc;
    border-bottom-color: var(--aq-ui-border);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.025em;
}

:where(
    .dedicated-module-page,
    .dashboard-overview-page,
    .dashboard-operating-page,
    .pos-sales-overview,
    .inventory-module-home,
    .inventory-workspace-shell,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
)
tbody td {
    border-bottom-color: var(--aq-ui-border-soft);
    vertical-align: middle;
}


/* ==========================================================
   10. WORKSPACE TABS
   ========================================================== */

.insurance-workspace-tabs {
    gap: 8px;
}

.insurance-workspace-tabs button {
    min-height: 34px;
    border-radius: var(--aq-ui-radius-sm);
    font-size: 12px;
    font-weight: 750;
}


/* ==========================================================
   11. MESSAGE / STATUS STATES
   ========================================================== */

:where(
    .section-page,
    .dedicated-module-page,
    .dashboard-overview-page,
    .pos-sales-overview,
    .inventory-module-home,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
)
:where(
    [class*="message"],
    [class*="alert"],
    [class*="notice"]
) {
    border-radius: var(--aq-ui-radius-md);
}

:where(
    .section-page,
    .dedicated-module-page,
    .dashboard-overview-page,
    .pos-sales-overview,
    .inventory-module-home,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
)
:where(
    .success,
    [class*="success"]
) {
    border-color: rgba(22, 101, 52, 0.18);
}

:where(
    .section-page,
    .dedicated-module-page,
    .dashboard-overview-page,
    .pos-sales-overview,
    .inventory-module-home,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
)
:where(
    .error,
    [class*="error"]
) {
    border-color: rgba(185, 28, 28, 0.18);
}


/* ==========================================================
   12. EMPTY / LOADING STATE RHYTHM
   ========================================================== */

:where(
    .section-page,
    .dedicated-module-page,
    .dashboard-overview-page,
    .pos-sales-overview,
    .inventory-module-home,
    .procurement-module-home,
    .finance-overview,
    .insurance-management-workspace,
    .aquila-hrm-platform-home,
    .reporting-dashboard-panel--business
)
:where(
    [class*="empty"],
    [class*="loading"]
) {
    color: var(--aq-ui-muted);
    line-height: 1.5;
}


/* ==========================================================
   13. RESPONSIVE PLATFORM RHYTHM
   ========================================================== */

@media (max-width: 1280px) {
    :root {
        --aq-ui-page-space: 20px;
        --aq-ui-card-space: 18px;
        --aq-ui-grid-gap: 14px;
    }
}

@media (max-width: 768px) {
    :root {
        --aq-ui-page-space: 18px;
        --aq-ui-card-space: 16px;
        --aq-ui-grid-gap: 12px;
        --aq-ui-control-gap: 10px;
    }

    :where(
        .module-page-intro,
        .dashboard-operating-hero,
        .insurance-hero
    ) {
        padding: 16px;
        border-radius: 14px;
    }

    :where(
        .section-page,
        .dedicated-module-page,
        .dashboard-overview-page,
        .pos-sales-overview,
        .inventory-module-home,
        .procurement-module-home,
        .finance-overview,
        .insurance-management-workspace,
        .aquila-hrm-platform-home,
        .reporting-dashboard-panel--business
    )
    :where(
        button,
        a[role="button"]
    )
    :not(
        nav button
    ) {
        min-height: 38px;
    }
}

@media (max-width: 430px) {
    :root {
        --aq-ui-page-space: 14px;
        --aq-ui-card-space: 15px;
        --aq-ui-grid-gap: 10px;
        --aq-ui-control-gap: 8px;
    }

    :where(
        .module-page-intro,
        .dashboard-operating-hero,
        .insurance-hero
    ) {
        padding: 15px;
        border-radius: 13px;
    }

    :where(
        .dedicated-module-page,
        .dashboard-overview-page,
        .dashboard-operating-page,
        .pos-sales-overview,
        .inventory-module-home,
        .inventory-workspace-shell,
        .procurement-module-home,
        .finance-overview,
        .insurance-management-workspace,
        .aquila-hrm-platform-home,
        .reporting-dashboard-panel--business
    )
    .table-wrapper {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}


/* ==========================================================
   14. HARD PROTECTION:
   MENU-DECK + ACCOUNTING
   ========================================================== */

/*
 * Do not alter Menu-Deck geometry.
 */
[data-ubz-simple-top-center-owner],
[data-ubz-simple-deck-top-center-v3="1"],
[data-ubz-r5112-r1-deck-owner="1"],
[data-ubz-simple-deck-top-center-owner],
#ubz-global-deck-header-r5113 {
    --aq-platform-visual-harmonization-protected: 1;
}

/*
 * Do not restyle approved Accounting canonical presentation.
 */
[data-aquila-accounting-reference-ui="1"],
[data-aquila-accounting-reference-ui="1"] * {
    --aq-platform-visual-harmonization-protected: 1;
}
