/* request_record_export.css — 請假加班紀錄 Attendance Ledger overlay (ledger view + XLSX export) */

.rre-overlay {
    --rre-surface: #ffffff;
    --rre-surface-2: #eef3ef;
    --rre-grid: #d5ded8;
    --rre-ink: #1b2922;
    --rre-ink-2: #53635a;
    --rre-ink-3: #85938b;
    --rre-accent: #0d882c;
    --rre-accent-ink: #ffffff;
    --rre-accent-soft: #dcefe1;
    --rre-pending: #c2620a;
    --rre-pending-soft: #fcebd9;
    --rre-reject: #b3261e;
    --rre-reject-soft: #f8dedb;
    --rre-muted-soft: #e7eae8;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(12, 30, 20, 0.28);
    display: none;
}
.rre-overlay.active { display: block; }

@media (prefers-color-scheme: dark) {
    .rre-overlay {
        --rre-surface: #151d19; --rre-surface-2: #1c2621; --rre-grid: #2b3831;
        --rre-ink: #e2ebe5; --rre-ink-2: #a7b5ad; --rre-ink-3: #75847c;
        --rre-accent: #3fbf66; --rre-accent-ink: #0b130e; --rre-accent-soft: #173a24;
        --rre-pending: #f0a258; --rre-pending-soft: #3a2713;
        --rre-reject: #f08a82; --rre-reject-soft: #3b1c1a; --rre-muted-soft: #222b26;
        background: rgba(0, 0, 0, 0.45);
    }
}

.rre-window {
    position: absolute;
    left: 50%;
    top: 4vh;
    transform: translateX(-50%);
    width: min(1180px, calc(100vw - 32px));
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    background: var(--rre-surface);
    color: var(--rre-ink);
    border: 1px solid var(--rre-grid);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(12, 30, 20, 0.22), 0 2px 6px rgba(12, 30, 20, 0.12);
    font-size: 14px;
}
.rre-window.dragging { user-select: none; }

.rre-head {
    background: var(--rre-accent);
    color: var(--rre-accent-ink);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    cursor: move;
    touch-action: none;
}
.rre-head strong { font-weight: 600; }
.rre-head .rre-emp { opacity: 0.9; margin-left: 10px; font-weight: 400; }
.rre-close {
    background: transparent; border: 0; color: var(--rre-accent-ink);
    font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px;
}

.rre-controls {
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    align-items: flex-start;
    border-bottom: 1px solid var(--rre-grid);
}
.rre-field { display: grid; gap: 6px; align-content: start; }
.rre-field > label, .rre-field > .rre-lbl { font-size: 12px; color: var(--rre-ink-2); font-weight: 500; }
/* Period and ending-month selectors size to their content */
.rre-field select, .rre-field input[type="month"] {
    font: inherit; color: var(--rre-ink); background: var(--rre-surface);
    border: 1px solid var(--rre-grid); border-radius: 6px; padding: 5px 8px;
    width: auto; justify-self: start;
}
.rre-seg { display: inline-flex; border: 1px solid var(--rre-grid); border-radius: 6px; overflow: hidden; }
.rre-seg button {
    font: inherit; font-size: 13px; white-space: nowrap; background: var(--rre-surface); color: var(--rre-ink-2);
    border: 0; border-right: 1px solid var(--rre-grid); padding: 5px 10px; cursor: pointer;
}
.rre-seg button:last-child { border-right: 0; }
.rre-seg button[aria-pressed="true"] { background: var(--rre-accent-soft); color: var(--rre-ink); font-weight: 600; }
.rre-chk { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--rre-ink-2); cursor: pointer; }
.rre-range { width: 100%; font-size: 13px; color: var(--rre-ink-2); }
.rre-range code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; color: var(--rre-ink); }

.rre-tabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--rre-grid); background: var(--rre-surface-2); overflow-x: auto; }
.rre-tab {
    font: inherit; font-size: 13px; border: 1px solid transparent; border-bottom: 0; background: transparent;
    color: var(--rre-ink-2); padding: 7px 14px 6px; border-radius: 6px 6px 0 0; cursor: pointer; margin-bottom: -1px; white-space: nowrap;
}
.rre-tab[aria-selected="true"] {
    background: var(--rre-surface); border-color: var(--rre-grid); color: var(--rre-ink); font-weight: 600;
    box-shadow: inset 0 2px 0 var(--rre-accent);
}
/* 按月統計 (Monthly summary) toggle, at the right end of the tab strip */
.rre-month-toggle {
    margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 6px;
    font-size: 12.5px; color: var(--rre-ink-2); cursor: pointer; padding: 0 4px; white-space: nowrap;
}
.rre-month-toggle input { margin: 0; accent-color: var(--rre-accent); }
.rre-tab .rre-n { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--rre-ink-3); margin-left: 6px; }

.rre-tally { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--rre-grid); }
.rre-chip { display: grid; gap: 1px; padding: 5px 10px; border-radius: 6px; background: var(--rre-muted-soft); min-width: 104px; }
.rre-chip span { font-size: 11px; color: var(--rre-ink-2); }
.rre-chip b { font-family: ui-monospace, Menlo, monospace; font-weight: 500; font-size: 14px; font-variant-numeric: tabular-nums; }
.rre-chip.ok { background: var(--rre-accent-soft); }
.rre-chip.pend { background: var(--rre-pending-soft); }
.rre-chip.pend b { color: var(--rre-pending); }
.rre-chip.rej { background: var(--rre-reject-soft); }
.rre-chip.hr { background: #ddebf7; }
@media (prefers-color-scheme: dark) { .rre-chip.hr { background: #172c3d; } }

.rre-head, .rre-controls, .rre-tabs, .rre-tally, .rre-foot { flex: none; }  /* only the sheet shrinks and scrolls */
.rre-sheet { overflow: auto; flex: 1 1 auto; min-height: 160px; }
.rre-sheet table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 13px; }
.rre-sheet th, .rre-sheet td { border: 1px solid var(--rre-grid); padding: 5px 9px; vertical-align: top; text-align: left; }
.rre-sheet thead th {
    position: sticky; top: 0; z-index: 1; background: var(--rre-surface-2); color: var(--rre-ink-2);
    font-weight: 600; font-size: 12px;
}
.rre-sheet td.t { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rre-sheet td.h { font-family: ui-monospace, Menlo, monospace; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rre-sheet td.desc { max-width: 280px; white-space: normal; overflow-wrap: anywhere; color: var(--rre-ink-2); }
.rre-sheet td.rid { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--rre-ink-3); white-space: nowrap; }
.rre-sheet td.rev { white-space: nowrap; font-size: 12.5px; }
.rre-sheet tr.pend td.h { color: var(--rre-pending); font-weight: 600; }
.rre-sheet tr.dead td { color: var(--rre-ink-3); }
.rre-sheet tr.dead td.h { text-decoration: line-through; }
/* accepted request whose day an attendance report (員工月報表／出勤報表) prevails: listed, not counted */
.rre-sheet td.h.sup { color: var(--rre-ink-3); font-style: italic; font-weight: 400; }
.rre-sheet tfoot td { background: var(--rre-surface-2); font-weight: 600; }
/* Month header rows: group the ledger by month, pinned under the column header */
.rre-sheet thead th { z-index: 2; }
.rre-sheet tr.rre-month td {
    position: sticky; top: var(--rre-head-h, 30px); z-index: 1;
    background: var(--rre-surface-2); color: var(--rre-ink); font-weight: 600; font-size: 12.5px;
    padding: 4px 9px; border-left: 0; border-right: 0;
}
/* 按月統計 off (default): a month change is a thicker line, no extra row */
/* 1.5px so it beats the 1px grid in border-collapse (equal widths go to the row
   above): crisp 1px on standard screens, 1.5px on high-DPI — darker either way. */
.rre-sheet tr.rre-month-start td { border-top: 1.5px solid var(--rre-ink-3); }
/* keep the label in view when the wide table scrolls sideways */
.rre-sheet tr.rre-month td > span { position: sticky; left: 9px; }
@media (hover: hover) {
    .rre-sheet tbody tr:not(.rre-month):hover td { background: var(--rre-accent-soft); }
}
/* Leave subtotals: left-aligned text throughout */
.rre-sheet table.rre-sub td, .rre-sheet table.rre-sub th { text-align: left; }
.rre-sheet table.rre-sub td.lab { font-weight: 600; border: 0; padding-top: 16px; }
.rre-sheet table.rre-sub td.pend { color: var(--rre-pending); font-weight: 600; }
.rre-pill { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 999px; white-space: nowrap; font-weight: 500; }
/* Status pills: colour matches the state's icon (🟠 filed, 🟡 under review, ✅ accepted, ⛔ rejected, 🟣 canceled) */
.rre-pill.hr { background: #ddebf7; color: #1f5a8a; }
.rre-pill.filed { background: #fce3cf; color: #b4530a; }
.rre-pill.review { background: #fff1c2; color: #8a6100; }
.rre-pill.ok { background: #dcefe1; color: #1b5e2e; }
.rre-pill.rej { background: #f8dedb; color: #b3261e; }
.rre-pill.can { background: #ece3f5; color: #6b4e8c; }
@media (prefers-color-scheme: dark) {
    .rre-pill.hr { background: #172c3d; color: #8cc2ec; }
    .rre-pill.filed { background: #3d2513; color: #f3a86a; }
    .rre-pill.review { background: #3a3012; color: #e8c65a; }
    .rre-pill.ok { background: #173a24; color: #7fd89a; }
    .rre-pill.rej { background: #3b1c1a; color: #f08a82; }
    .rre-pill.can { background: #2e2439; color: #c3a6e6; }
}
.rre-empty { padding: 36px 16px; text-align: center; color: var(--rre-ink-3); }
/* Reviewer decision icons sit a little smaller than the names */
.rre-mark { font-size: 0.85em; }

.rre-foot {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end;
    padding: 10px 16px; border-top: 1px solid var(--rre-grid); background: var(--rre-surface-2);
}
.rre-foot .rre-note { margin-right: auto; font-size: 12px; color: var(--rre-ink-3); }
.rre-btn {
    font: inherit; font-size: 13px; border-radius: 6px; padding: 6px 14px; cursor: pointer;
    border: 1px solid var(--rre-grid); background: var(--rre-surface); color: var(--rre-ink);
}
.rre-btn.primary { background: var(--rre-accent); border-color: var(--rre-accent); color: var(--rre-accent-ink); font-weight: 600; }
.rre-btn:disabled { opacity: 0.55; cursor: default; }
.rre-overlay button:focus-visible, .rre-overlay select:focus-visible, .rre-overlay input:focus-visible {
    outline: 2px solid #1a73e8; outline-offset: 1px;
}

/* Collapsed-filters summary line: shown on phones only (mobile_nav.css) */
.rre-summary { display: none; }

/* Phone layout (≤ 768 px) lives in mobile_nav.css with the app's other mobile rules. */
