/* Time Off Tracker (Story 2209) -- phone-first, single-pane dashboard. */

:root {
    --to-ink:    #1d1b2e;
    --to-muted:  #6b6880;
    --to-line:   #e7e4f0;
    --to-accent: #5b4ddb;
    --to-accent2:#8a6df0;
    --to-good:   #1f9d6b;   /* under / banking */
    --to-warn:   #d98a14;   /* close to pace   */
    --to-over:   #d6455d;   /* over pace        */
    --to-card:   #ffffff;
    --to-shadow: 0 6px 22px rgba(43, 36, 92, 0.10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
    color: var(--to-ink);
    background:
        radial-gradient(1200px 420px at 50% -120px, #efeafc 0%, rgba(239,234,252,0) 70%),
        linear-gradient(180deg, #f6f4fb 0%, #eef0f7 100%);
    min-height: 100vh;
}

/* Full-width flex column so the injected icon band spans edge to edge and
   stays pinned (its sticky containing block is this tall shell), matching
   every other page. Content lives in a centered inner column. */
/* Story 2293: pin the Leonardo menu band; only .to-content scrolls. */
.to-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}
.to-content {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 0 14px 120px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}
/* Hold the content invisible until the first render picks the saved view, so
   the page never flashes the Dashboard before landing on the remembered tab
   (e.g. Ledger). The icon band lives outside .to-content, so it stays visible. */
.to-shell:not(.to-ready) .to-content { visibility: hidden; }

/* ---- header / year bar ---- */
.lw-nav { min-height: 1px; flex: 0 0 auto; }
.lw-nav > #btnPrint { position: absolute; left: -9999px; }   /* hidden until the band relocates + iconizes it */

.to-yearbar {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 10px 0 6px;
}
.to-step {
    width: 40px; height: 40px; border-radius: 50%;
    border: 1px solid var(--to-line); background: var(--to-card);
    font-size: 22px; line-height: 1; color: var(--to-accent);
    cursor: pointer; box-shadow: var(--to-shadow); flex: none;
}
.to-step:active { transform: scale(0.94); }
.to-yearpick { text-align: center; min-width: 150px; }
.to-yearlabel { font-size: 13px; color: var(--to-muted); font-weight: 600; letter-spacing: .02em; }
.to-yearpick .picker-wrap { margin-top: 2px; }
.to-yearpick .picker-input {
    text-align: center; font-size: 26px; font-weight: 800; color: var(--to-ink);
    border: none; background: transparent; width: 130px; padding: 0;
}
.to-yearpick .picker-input:focus { outline: none; }

/* ---- hero ---- */
.to-hero {
    background: linear-gradient(135deg, var(--to-accent) 0%, var(--to-accent2) 100%);
    color: #fff; border-radius: 22px; padding: 20px 20px 16px; margin: 6px 0 14px;
    box-shadow: 0 12px 30px rgba(91, 77, 219, 0.30); position: relative; overflow: hidden;
}
.to-hero::after {
    content: ""; position: absolute; right: -50px; top: -50px;
    width: 180px; height: 180px; border-radius: 50%;
    background: rgba(255,255,255,0.08);
}
.to-hero-main { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.to-hero-num { font-size: 52px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.to-hero-unit { font-size: 18px; font-weight: 600; opacity: .85; margin-left: 6px; }
.to-hero-sub { font-size: 14px; opacity: .9; margin-top: 4px; }

.to-pacepill {
    display: inline-block; margin-top: 12px; padding: 5px 14px; border-radius: 999px;
    font-size: 13.5px; font-weight: 700; background: rgba(255,255,255,0.22);
    backdrop-filter: blur(2px);
}
.to-pacepill.good { background: rgba(255,255,255,0.95); color: var(--to-good); }
.to-pacepill.over { background: rgba(255,255,255,0.95); color: var(--to-over); }
.to-pacepill.warn { background: rgba(255,255,255,0.95); color: var(--to-warn); }

.to-bar {
    position: relative; height: 14px; border-radius: 999px; margin-top: 16px;
    background: rgba(255,255,255,0.28); overflow: hidden;
}
.to-bar-fill {
    position: absolute; left: 0; top: 0; bottom: 0; width: 0;
    background: #fff; border-radius: 999px; transition: width .5s ease;
}
.to-bar-pace {
    position: absolute; top: -3px; bottom: -3px; width: 3px; left: 0;
    background: var(--to-ink); border-radius: 2px; opacity: .55; transition: left .5s ease;
}
.to-bar-legend {
    display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12.5px; opacity: .95;
}
.to-bar-legend b { font-weight: 800; }
.to-bar-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.sw.taken { background: #fff; }
.sw.pace  { background: var(--to-ink); opacity: .55; }
.sw.allow { background: rgba(255,255,255,0.4); }

/* ---- stat tiles ---- */
.to-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.to-tile {
    background: var(--to-card); border-radius: 16px; padding: 14px 8px; text-align: center;
    box-shadow: var(--to-shadow); border: 1px solid rgba(231,228,240,0.7);
}
.to-tile .n { display: block; font-size: 22px; font-weight: 800; line-height: 1.1; }
.to-tile .l { display: block; font-size: 11px; color: var(--to-muted); margin-top: 4px; line-height: 1.2; }
@media (max-width: 520px) {
    .to-tiles { grid-template-columns: repeat(2, 1fr); }
}

/* ---- controls ---- */
.to-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.to-seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; background: var(--to-card); border-radius: 12px; padding: 3px; box-shadow: var(--to-shadow); border: 1px solid rgba(231,228,240,0.7); }
.to-seg button {
    border: none; background: transparent; padding: 7px 13px; border-radius: 9px;
    font-size: 13px; font-weight: 600; color: var(--to-muted); cursor: pointer; white-space: nowrap;
}
.to-seg button.on { background: var(--to-accent); color: #fff; }
.to-seg.vert { flex-direction: column; align-items: stretch; padding: 4px; gap: 3px; }
.to-seg.vert button { text-align: left; }
/* full-width segment (Plan grant style): each button shares the row so long
   modal content can't push it off the edge. */
.to-seg.fill { display: flex; width: 100%; }
.to-seg.fill button { flex: 1 1 0; text-align: center; }

.to-btn {
    border: 1px solid var(--to-line); background: var(--to-card); color: var(--to-ink);
    padding: 8px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 600;
    cursor: pointer; box-shadow: var(--to-shadow); display: inline-flex; align-items: center; gap: 6px;
}
.to-btn .ic { font-size: 14px; }
.to-btn.primary { background: var(--to-accent); color: #fff; border-color: var(--to-accent); }
.to-btn.danger { color: var(--to-over); border-color: rgba(214,69,93,0.4); }
.to-btn:active { transform: translateY(1px); }

/* ---- cards ---- */
.to-card {
    background: var(--to-card); border-radius: 18px; padding: 16px; margin-bottom: 14px;
    box-shadow: var(--to-shadow); border: 1px solid rgba(231,228,240,0.7);
}
.to-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.to-card-head h2 { font-size: 15px; margin: 0; font-weight: 700; }
.to-card-note { font-size: 12px; color: var(--to-muted); }

/* ---- chart ---- */
.to-chart { width: 100%; }
.to-chart svg { width: 100%; height: auto; display: block; }

/* ---- by type ---- */
.to-bytype { display: flex; flex-direction: column; gap: 10px; }
.to-bt-row { display: grid; grid-template-columns: 1fr; gap: 4px; }
.to-bt-top { display: flex; justify-content: space-between; font-size: 13px; }
.to-bt-name { font-weight: 600; }
.to-bt-val { color: var(--to-muted); }
.to-bt-track { height: 8px; border-radius: 999px; background: var(--to-line); overflow: hidden; }
.to-bt-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--to-accent), var(--to-accent2)); }

/* ---- entries ---- */
.to-entries { display: flex; flex-direction: column; }
.to-month { font-size: 12px; font-weight: 700; color: var(--to-muted); text-transform: uppercase; letter-spacing: .04em; margin: 12px 0 6px; }
.to-month:first-child { margin-top: 0; }
.to-entry {
    display: flex; align-items: center; gap: 12px; padding: 11px 6px;
    border-bottom: 1px solid var(--to-line); cursor: pointer;
}
.to-entry:active { background: #faf9ff; }
.to-entry .date { width: 92px; flex: none; }
.to-entry .date .d { font-weight: 700; font-size: 14px; }
.to-entry .date .wd { font-size: 11px; color: var(--to-muted); }
.to-entry .mid { flex: 1; min-width: 0; }
.to-entry .type { font-size: 13.5px; font-weight: 600; }
.to-entry .cmt { font-size: 12px; color: var(--to-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.to-entry .hrs { font-weight: 800; font-size: 15px; flex: none; }
.to-entry .hrs.neg { color: var(--to-over); }
.to-badge { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; flex: none; }
.to-badge.Approved { background: #e4f5ee; color: var(--to-good); }
.to-badge.Denied   { background: #fdeaed; color: var(--to-over); }
.to-badge.Canceled { background: #eee; color: #888; }
.to-badge.Pending  { background: #fef3df; color: var(--to-warn); }

.to-empty { text-align: center; color: var(--to-muted); padding: 24px 0; font-size: 14px; }

/* ---- status bar ---- */
.to-statusbar { text-align: center; font-size: 11.5px; color: var(--to-muted); padding: 8px 0 0; }

/* ---- FAB ---- */
.to-fab {
    position: fixed; right: 18px; bottom: 22px; width: 58px; height: 58px; border-radius: 50%;
    border: none; background: var(--to-accent); color: #fff; font-size: 30px; line-height: 1;
    box-shadow: 0 8px 22px rgba(91,77,219,0.45); cursor: pointer; z-index: 40;
}
.to-fab:active { transform: scale(0.93); }

/* ---- modals ---- */
.to-overlay {
    display: none; position: fixed; inset: 0; z-index: 60;
    background: rgba(29,27,46,0.5); backdrop-filter: blur(2px);
    align-items: center; justify-content: center; overflow-y: auto; padding: 16px 12px;
}
.to-overlay.open { display: flex; }
.to-modal {
    background: var(--to-card); border-radius: 20px; padding: 20px; width: 100%; max-width: 480px;
    box-shadow: 0 18px 50px rgba(29,27,46,0.35);
    /* center in the viewport, but if a modal is taller than the screen let it
       scroll inside itself so the top is never cut off */
    max-height: calc(100dvh - 32px); overflow-y: auto; margin: auto;
}
.to-modal h2 { margin: 0 0 4px; font-size: 19px; }
.to-modal-hint { font-size: 13px; color: var(--to-muted); margin: 0 0 14px; line-height: 1.5; }

.to-field { margin-bottom: 14px; }
.to-field:last-of-type { margin-bottom: 0; }
.to-field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--to-muted); margin-bottom: 5px; }
/* A required field left empty on Save (2026-11-17). */
.to-field .to-missing, .to-field input.to-missing { border-color: #d6455d !important; box-shadow: 0 0 0 2px rgba(214,69,93,0.18); }
.to-field .hint { font-size: 11.5px; color: var(--to-muted); margin-top: 4px; }
.to-field input[type="text"],
.to-field input[type="date"],
.to-field input[type="number"],
.to-field textarea,
.to-field .picker-input {
    display: block; width: 100%; box-sizing: border-box;
    border: 1px solid var(--to-line); border-radius: 11px; padding: 11px 12px;
    font-size: 15px; font-family: inherit; color: var(--to-ink); background: #fcfbff;
}
.to-field input:focus, .to-field textarea:focus, .to-field .picker-input:focus {
    outline: none; border-color: var(--to-accent); background: #fff;
}
.to-field textarea { min-height: 120px; resize: vertical; }
.to-field-row { display: flex; gap: 12px; }
.to-field-row > .to-field { flex: 1; }
.to-field-row > .to-field.narrow { flex: 0 0 130px; }
@media (max-width: 460px) {
    .to-field-row { flex-direction: column; gap: 0; }
    .to-field-row > .to-field.narrow { flex: 1; }
}
/* picasso-voice wraps text inputs in an inline-block span that collapses
   width:100%; force block inside our fields so they span the row. */
.to-field .voice-mic-wrap { display: block; }

.to-modal-btns { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }
.to-modal-btns .to-btn { flex: 1 1 auto; justify-content: center; }
.to-spacer { flex: 1 1 100%; }

/* import preview */
.to-imp-list { margin-top: 14px; max-height: 320px; overflow-y: auto; }
.to-imp-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--to-line); font-size: 13px; }
.to-imp-row.dup { opacity: .6; }
.to-imp-row input { flex: none; width: 18px; height: 18px; }
.to-imp-row .ir-date { width: 90px; flex: none; font-weight: 600; }
.to-imp-row .ir-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.to-imp-row .ir-hrs { font-weight: 700; }
.to-imp-row .ir-dup { font-size: 10.5px; color: var(--to-warn); font-weight: 700; }
.to-imp-summary { font-size: 13px; color: var(--to-muted); margin: 10px 0 4px; }

/* reconcile report */
.to-rec-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--to-accent); margin: 14px 0 4px; }
.to-rec-clean { font-size: 13.5px; color: var(--to-good); font-weight: 600; padding: 10px 0; }
.to-rec-change { flex: 1; min-width: 0; font-size: 12px; color: var(--to-over); text-align: right; }
.to-rec-status { font-size: 11px; color: var(--to-muted); flex: none; }

/* ===================== view switcher (Story 2215) ===================== */
.to-viewseg { display: flex; width: 100%; margin: 4px 0 14px; }
.to-viewseg button { flex: 1 1 0; text-align: center; padding: 9px 8px; font-size: 13.5px; }

/* small button (card-head actions) */
.to-btn.small { padding: 5px 10px; font-size: 12.5px; box-shadow: none; }
.to-card-head .to-btn.small { margin-left: auto; }

/* ===================== calendar view ===================== */
.to-callegend {
    display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
    font-size: 12px; color: var(--to-muted); margin-bottom: 6px;
}
.to-callegend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-key { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--to-line); }
.cal-key.fto-full  { background: var(--to-accent); border-color: var(--to-accent); }
.cal-key.fto-half  { background: #c9c2f4; border-color: #c9c2f4; }
.cal-key.fto-other { background: #fff; border: 1px dashed var(--to-accent2); }
.cal-key.holiday   { background: #fde0e4; border-color: var(--to-over); }
.cal-key.today     { background: #fff; border: 2px solid var(--to-over); }

.to-calhint { text-align: center; font-size: 12px; color: var(--to-muted); margin-bottom: 12px; }

.to-calendar {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
@media (max-width: 720px) { .to-calendar { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 540px) { .to-calendar { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 360px) { .to-calendar { grid-template-columns: 1fr; } }

.cal-month {
    background: var(--to-card); border-radius: 14px; padding: 8px;
    box-shadow: var(--to-shadow); border: 1px solid rgba(231,228,240,0.7);
}
.cal-mname { text-align: center; font-size: 12.5px; font-weight: 800; color: var(--to-accent); margin-bottom: 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; font-size: 9px; font-weight: 700; color: var(--to-muted); padding-bottom: 2px; }
.cal-cell {
    position: relative; aspect-ratio: 1 / 1; border: 1px solid var(--to-line);
    border-radius: 5px; background: #fff; font-size: 10.5px; color: var(--to-ink);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    padding: 0; line-height: 1; font-family: inherit;
}
.cal-cell.empty { border: none; background: transparent; cursor: default; }
.cal-cell.we { background: #f7f6fc; }
.cal-cell:active { transform: scale(0.92); }
.cal-cell.has-fto-full  { background: var(--to-accent); color: #fff; font-weight: 700; border-color: var(--to-accent); }
.cal-cell.has-fto-half  { background: #c9c2f4; color: var(--to-ink); font-weight: 700; border-color: #b3a9ef; }
.cal-cell.has-fto-other { border: 1px dashed var(--to-accent2); color: var(--to-accent); font-weight: 700; }
.cal-cell.has-holiday   { background: #fde0e4; color: var(--to-over); font-weight: 700; border-color: #f6c2ca; }
/* a day that is both an FTO day and a holiday: FTO fill wins, holiday flagged with a corner dot */
.cal-cell.has-holiday::after {
    content: ""; position: absolute; top: 2px; right: 2px;
    width: 5px; height: 5px; border-radius: 50%; background: var(--to-over);
}
.cal-cell.has-fto-full.has-holiday  { background: var(--to-accent); color: #fff; border-color: var(--to-accent); }
.cal-cell.has-fto-half.has-holiday  { background: #c9c2f4; color: var(--to-ink); }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--to-over); }

/* ===================== year view (whole year, one screen) ===================== */
.to-yeartitle { text-align: center; font-size: 15px; font-weight: 800; color: var(--to-accent); margin: 2px 0 10px; }
.to-callegend.tiny { font-size: 10.5px; gap: 10px; margin: 10px 0 0; }

/* compact variant of the reusable annual calendar: denser so all twelve
   months sit on one screen. Keeps more columns at narrow widths than the
   tappable Calendar view so the block stays short vertically. */
.to-calendar.compact { grid-template-columns: repeat(4, 1fr); gap: 6px; }
@media (max-width: 640px) { .to-calendar.compact { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 380px) { .to-calendar.compact { grid-template-columns: repeat(2, 1fr); } }
.to-calendar.compact .cal-month { padding: 4px; border-radius: 9px; }
.to-calendar.compact .cal-mname { font-size: 10px; margin-bottom: 2px; }
.to-calendar.compact .cal-grid { gap: 1px; }
.to-calendar.compact .cal-dow { font-size: 7px; padding-bottom: 1px; }
.to-calendar.compact .cal-cell { font-size: 7.5px; border-radius: 3px; }
.to-calendar.compact .cal-cell.has-holiday::after { top: 1px; right: 1px; width: 3px; height: 3px; }

/* ===================== ledger view ===================== */
.to-summcard .to-card-head h2 { font-size: 16px; }
.to-summtable { width: 100%; border-collapse: collapse; font-size: 15px; }
.to-summtable th, .to-summtable td { padding: 9px 6px; text-align: left; }
.to-summtable thead th { font-size: 12px; color: var(--to-muted); font-weight: 700; border-bottom: 1px solid var(--to-line); }
.to-summtable tbody th { font-weight: 600; color: var(--to-muted); }
.to-summtable tbody td { font-weight: 800; }
.to-summtable .r { text-align: right; }
.to-summtable tr.rem td { color: var(--to-accent); font-size: 18px; }
.to-summtable tr.rem th { color: var(--to-ink); }

.to-ledgertable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.to-ledgertable thead th { font-size: 11.5px; color: var(--to-muted); font-weight: 700; text-align: left; padding: 6px; border-bottom: 1px solid var(--to-line); }
.to-ledgertable td { padding: 9px 6px; border-bottom: 1px solid var(--to-line); }
.to-ledgertable .r { text-align: right; }
.to-ledgertable tbody tr { cursor: pointer; }
.to-ledgertable tbody tr:active { background: #faf9ff; }
.to-holhint { font-size: 12px; color: var(--to-muted); margin: -4px 0 8px; }

/* ===================== day chooser ===================== */
.to-modal.narrow { max-width: 360px; }
.to-daylist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.to-dayitem {
    display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
    border: 1px solid var(--to-line); background: #fcfbff; border-radius: 11px;
    padding: 11px 12px; font-size: 13.5px; font-family: inherit; color: var(--to-ink); cursor: pointer;
}
.to-dayitem:active { background: #f2effc; }
.di-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.di-dot.fto { background: var(--to-accent); }
.di-dot.hol { background: var(--to-over); }

/* ---- folds and roll-up (Story 5757) ---- */
.to-viewrow { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; }
.to-viewrow .to-viewseg { margin: 0; flex: 1 1 auto; width: auto; }
.to-foldall {
    flex: 0 0 auto; width: 42px; height: 40px; border-radius: 12px; border: 1px solid var(--to-line);
    background: var(--to-card); color: var(--to-accent); font-size: 13px; cursor: pointer; box-shadow: var(--to-shadow);
}
.to-foldall[hidden] { display: none; }
.to-foldhead { cursor: pointer; user-select: none; }
.to-chev { display: inline-block; width: 16px; color: var(--to-muted); font-size: 12px; transition: transform .15s; }
.to-card:not(.folded) > .to-foldhead .to-chev, .to-mband:not(.folded) > .to-month .to-chev { transform: rotate(90deg); }
.to-card.folded > :not(.to-card-head) { display: none; }
.to-card.folded > .to-card-head { margin-bottom: 0; }
.to-hero { cursor: pointer; }
.to-hero-chev { position: absolute; right: 16px; top: 14px; font-size: 14px; opacity: .85; z-index: 1; }
.to-hero.folded .to-hero-chev { transform: rotate(-90deg); }
.to-sum-folded .to-hero .to-pacepill, .to-sum-folded .to-hero .to-bar,
.to-sum-folded .to-hero .to-bar-legend, .to-sum-folded .to-tiles { display: none; }
.to-month { cursor: pointer; user-select: none; }
.to-mband.folded > .to-mbody { display: none; }
.to-toolpane { margin-bottom: 14px; }
.to-toolpane .to-controls { margin-bottom: 0; margin-top: 8px; }
.to-toolpane.ef-tools-collapsed .ef-tools { display: none; }
.to-rollbar { display: flex; align-items: center; gap: 6px; border: none; background: none; padding: 2px 0;
    font: 600 12.5px "Segoe UI", system-ui, sans-serif; color: var(--to-muted); cursor: pointer; text-align: left; }
.to-rollbar .ef-caret { color: var(--to-accent); }
.to-mband .to-month { margin-top: 12px; }
.to-mband:first-child .to-month { margin-top: 0; }
