/* ==========================================================================
   My overtime (the claim form): layout and print only. Cards, page header, tables, chips, fields, buttons and callouts come
   from components/ui.css and Web Awesome.
   ========================================================================== */
@layer app-pages {

    #viewPersonalClaim > .ui-page { display: flex; flex-direction: column; gap: 1.25rem; }
    #viewPersonalClaim wa-button[hidden] { display: none; }      /* a wa-button sets its own display, so hidden needs this */

    /* Pre-authorisation: three fields and the button on one line */
    .overtime-claim-preauth { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
    .overtime-claim-ask { display: flex; justify-content: flex-end; margin-bottom: 0.75rem; }
    #otPreauthCard .ui-hint { margin: 0 0 0.75rem; }
    .overtime-claim-preauth-table th:nth-child(2),
    .overtime-claim-preauth-table td:nth-child(2) { text-align: right; font-variant-numeric: tabular-nums; }

    /* Month picker */
    /* The month picker needs no visible caption (the month says what it is); the label stays for screen readers */
    .overtime-claim-month > .ui-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .overtime-claim-month-row { display: flex; align-items: center; gap: 0.5rem; }
    .overtime-claim-month-row .ui-pill { justify-content: center; min-width: var(--d26-target); padding: 0; }
    .overtime-claim-month-row .ui-input { width: 12rem; }

    #reviewModeBanner:not([hidden]), #claimStatusAlert:not([hidden]), #hrSupervisorWarning:not([hidden]) { margin: 0 0 1rem; }
    .overtime-claim-review { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; }
    .overtime-claim-note { margin: 0.25rem 0 0.5rem; padding: 0 0 0 0.75rem; border-left: 3px solid currentColor; white-space: pre-wrap; }

    /* The three steps: a small heading and a line over each part of the page */
    .overtime-claim-step .ui-section-title { margin: 0 0 0.375rem; }
    .overtime-claim-step .ui-hint { margin: 0 0 0.75rem; }
    .overtime-claim-step > .ui-hint { padding-bottom: 0.75rem; }     /* the hint's own margin cannot be changed from here, so the space is padding */
    .overtime-claim-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
    .overtime-claim-send { display: flex; flex-direction: column; gap: 0.125rem; min-width: 0; }
    .overtime-claim-send .ui-hint { margin: 0; }
    .overtime-claim-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; }

    /* The editable table */
    .overtime-claim-table td { vertical-align: top; padding: 0.625rem 0.75rem; }
    .overtime-claim-table th { padding-inline: 0.75rem; }          /* the column names start where the cells do */
    .overtime-claim-cell { width: 100%; min-width: 0; }
    .overtime-claim-table input[type="date"] { min-width: 9.5rem; }
    .overtime-claim-hours { max-width: 6rem; text-align: right; }
    .overtime-claim-project { min-width: 12rem; }
    .overtime-claim-desc { min-width: 14rem; min-height: var(--d26-target); resize: none; overflow: hidden; }
    .overtime-claim-manual { display: flex; flex-direction: column; align-items: flex-start; gap: 0.375rem; min-width: 11rem; }
    .overtime-claim-remove { min-width: var(--d26-target); min-height: var(--d26-target); }

    .overtime-claim-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-top: 1px solid var(--d26-line); }
    .overtime-claim-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-left: auto; }

    /* A narrow screen (not paper): the rows become cards by the shared data_table(cards="wide"), when the table's own box is under 55rem
       (the table needs about 58rem with the menu open; below that its last columns hid behind a sideways scroll with no cue).
       The rest is this form's own: the controls fill the card, and the remove button says what it does. */
    @media screen and (max-width: 760px) {
        #claimViewTabs wa-tab > i { display: none; }          /* both tabs fit without scroll arrows */
        .overtime-claim-footer .overtime-claim-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; margin-left: 0; }
    }
    @container (width <= 55rem) {
        #claimsTable input, #claimsTable textarea, #claimsTable wa-select { min-width: 0; width: 100%; max-width: none; }
        #claimsTable .overtime-claim-remove::after { content: "Remove row"; margin-left: 0.4rem; font-size: 0.8125rem; font-weight: 600; }
        .overtime-claim-manual { min-width: 0; }
    }

    /* Printing: as before, no buttons, footer, status message or review banner */
    @media print {
        #viewPersonalClaim wa-button,
        .overtime-claim-footer,
        #claimStatusAlert,
        #reviewModeBanner { display: none; }
        #claimStatusAlert:not([hidden]), #reviewModeBanner:not([hidden]) { display: none; }
        .overtime-claim-form { border: 0; box-shadow: none; }
        #viewPersonalClaim .ui-table-wrap { overflow: visible; }
        .overtime-claim-table .overtime-claim-cell, .overtime-claim-project, .overtime-claim-desc, .overtime-claim-manual { min-width: 0; }
    }
}
