/* ==========================================================================
   Daily report (the list and the report page): layout only. Tab group, tables, chips, buttons, fields, callouts, rows, dialogs and the empty
   state come from components/ui.css and Web Awesome.
   ========================================================================== */
@layer app-pages {

    /* A wa-button sets its own display, so the hidden attribute needs this (the Try again button) */
    #viewDailyReport wa-button[hidden], #viewDailyReportDetail wa-button[hidden] { display: none; }
    #dr2Error:not([hidden]) { margin: 0 0 1rem; }
    .daily-report-error { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
    #dr2MineLoading:not([hidden]), #dr2TeamLoading:not([hidden]) { margin: 0 0 1rem; }
    #viewDailyReport .ui-hint { margin: 0 0 0.75rem; }

    /* A whole row opens the report (the date button is still the way in for the keyboard) */
    .daily-report-row { cursor: pointer; }
    .daily-report-row:hover td { background: var(--d26-surface); }
    .daily-report-nav[hidden], #viewDailyReportDetail .ui-chip[hidden] { display: none; }
    #viewDailyReportDetail .ui-hint { margin: 0 0 0.75rem; }
    .daily-report-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0 0 1rem; }
    .daily-report-chips { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }

    .daily-report-snippet { max-width: 22rem; overflow-wrap: anywhere; }
    .daily-report-table td { vertical-align: top; }
    @container (width > 40rem) {                                                   /* files and comments are numbers: right-aligned in a table, left in a card */
        .daily-report-table th:nth-last-child(-n+2),
        .daily-report-table td:nth-last-child(-n+2) { text-align: right; font-variant-numeric: tabular-nums; }
    }

    /* "Showing n of m" and the Show more button under a table */
    .daily-report-more { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin: 1rem 0; }
    .daily-report-more[hidden] { display: none; }

    /* ---- The report page ---- */
    .daily-report-back { margin: 0 0 0.5rem; }
    .daily-report-detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(18rem, 1fr); gap: 1rem; align-items: start; }
    .daily-report-detail-grid .daily-report-section { margin-top: 0; }
    #dr2ReadCard .daily-report-detail-grid, #dr2EditorCard .daily-report-detail-grid { margin-top: 0.75rem; }
    @media (max-width: 960px) { .daily-report-detail-grid { grid-template-columns: minmax(0, 1fr); } }
    .daily-report-side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
    #dr2Progress .ui-card-title { margin: 0 0 0.25rem; }
    #dr2Steps .ui-chip { min-width: 5.5rem; justify-content: center; }
    .daily-report-facts { margin: 0.75rem 0 0; }
    #dr2DetailError:not([hidden]), #dr2FormError:not([hidden]), #dr2EditError:not([hidden]), #dr2CommentError:not([hidden]), #dr2LeaveError:not([hidden]) { margin: 0 0 1rem; }
    #dr2DetailLoading:not([hidden]), #dr2TodayLoading:not([hidden]) { margin: 0 0 1rem; }
    .daily-report-form { padding: 1rem; }
    .daily-report-form-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin: 0 0 1rem; }
    .daily-report-section { margin: 1.5rem 0 0.5rem; }
    .daily-report-filefield { margin: 1rem 0; }
    .daily-report-file { box-sizing: border-box; width: 100%; min-height: var(--d26-target); padding: 0.5rem; font: inherit; border: 1px solid var(--d26-line); border-radius: var(--d26-radius-control); background: var(--d26-card); }
    .daily-report-file:focus-visible { outline: 2px solid var(--d26-accent); outline-offset: 2px; }
    .daily-report-file-link { color: var(--d26-accent-hover); font-weight: 600; overflow-wrap: anywhere; }
    .daily-report-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 1rem; padding: 0.75rem; border: 1px solid var(--d26-line); border-radius: var(--d26-radius-control); background: var(--d26-surface); color: var(--d26-ink); }
    .daily-report-comment { white-space: pre-wrap; overflow-wrap: anywhere; }
    #dr2Files:empty, #dr2DetailFiles:empty { display: none; }

    /* What is saved and what is not: always a word and an icon, never colour alone */
    .daily-report-save { margin-top: 0.25rem; font-size: 0.8125rem; color: var(--d26-ink-2); }
    .daily-report-save:empty { display: none; }
    .daily-report-save--unsaved { color: var(--d26-wait-fg); font-weight: 600; }
    .daily-report-save--error { color: var(--d26-bad-fg); font-weight: 600; }
    .daily-report-save--saved { color: var(--d26-ok-fg); }

    @container (width <= 40rem) { .daily-report-snippet { max-width: none; } }      /* the card switch itself is the shared data_table(cards="narrow") */
}
