/* The phone timesheet app. One column, thumb-sized targets (48px and up), nothing that needs a hover. Light and dark follow the phone. */
:root {
    --navy: #16305c;
    --blue: #1b6ec2;
    --bg: #f3f5f8;
    --card: #ffffff;
    --text: #17202e;
    --muted: #5d6878;
    --line: #dfe4ea;
    --field: #ffffff;
    --weekend: #f8f9fb;
    --ok: #1c7c3c;
    --ok-bg: #dff3e3;
    --wait: #8a5a00;
    --wait-bg: #fdeccb;
    --bad: #b3261e;
    --bad-bg: #fbe1df;
    --info-bg: #e2edfb;
    --today: #1b6ec2;
    --shadow: 0 1px 2px rgba(16, 24, 40, .08);
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --navy: #101c33;
        --blue: #5aa2ee;
        --bg: #0d1117;
        --card: #171d27;
        --text: #e7ebf1;
        --muted: #9aa5b4;
        --line: #2a3340;
        --field: #0f141c;
        --weekend: #131922;
        --ok: #6fd08a;
        --ok-bg: #173323;
        --wait: #f0c26a;
        --wait-bg: #3a2c10;
        --bad: #ff9a92;
        --bad-bg: #3d1a18;
        --info-bg: #15263f;
        --today: #5aa2ee;
        --shadow: none;
    }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0 auto;
    max-width: 560px;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
    -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.muted { color: var(--muted); font-size: .875rem; }

/* --- top bar */
.top {
    position: sticky; top: 0; z-index: 5;
    display: flex; align-items: center; justify-content: space-between;
    background: var(--navy); color: #fff;
    padding: calc(8px + env(safe-area-inset-top)) 8px 8px 16px;
}
.top h1 { margin: 0; font-size: 1.125rem; font-weight: 600; letter-spacing: .01em; }

.iconbtn {
    width: 48px; height: 48px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: 0; border-radius: 50%; color: inherit;
}
.iconbtn:active { background: rgba(127, 127, 127, .22); }
.iconbtn:disabled { opacity: .3; }
.iconbtn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.top .iconbtn svg { fill: currentColor; stroke: none; }
.iconbtn.small { width: 36px; height: 36px; }
.iconbtn.small svg { width: 18px; height: 18px; }

/* --- week */
.weeknav, .daynav { display: flex; align-items: center; padding: 6px 4px 0; }
.weeklabel {
    flex: 1; min-height: 48px; background: none; border: 0; border-radius: 12px;
    font-weight: 600; font-size: 1rem; text-align: center;
}
.weeklabel small { display: block; font-weight: 400; color: var(--blue); font-size: .8125rem; }
.weeklabel:active { background: rgba(127, 127, 127, .15); }

.summary {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin: 6px 12px 10px; padding: 14px 16px;
    background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
}
.total { font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.total .of { font-size: 1rem; font-weight: 400; color: var(--muted); margin-left: 6px; }

.pill {
    flex: none; padding: 5px 12px; border-radius: 999px; font-size: .8125rem; font-weight: 600;
    background: var(--line); color: var(--text); white-space: nowrap;
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.wait { background: var(--wait-bg); color: var(--wait); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.tiny { padding: 2px 8px; font-size: .75rem; }

.banner {
    display: flex; align-items: center; gap: 8px;
    margin: 0 12px 10px; padding: 10px 12px; border-radius: 12px;
    background: var(--info-bg); font-size: .9375rem;
}
.banner > span:first-child { flex: 1; }
.banner.warn { background: var(--wait-bg); color: var(--wait); margin-top: 10px; }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.locked { background: var(--line); }
.linkbtn { background: none; border: 0; padding: 8px; font-weight: 600; color: inherit; text-decoration: underline; }

.days { list-style: none; margin: 0 12px; padding: 0; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.days li + li { border-top: 1px solid var(--line); }
.day {
    width: 100%; min-height: 60px; display: flex; align-items: center; gap: 12px;
    padding: 8px 10px 8px 14px; background: none; border: 0; text-align: left;
}
.day:active { background: rgba(127, 127, 127, .12); }
.day.weekend { background: var(--weekend); }
.day .date { width: 46px; flex: none; text-align: center; line-height: 1.15; }
.day .date b { display: block; font-size: 1.25rem; }
.day .date span { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.day.today .date b { color: #fff; background: var(--today); border-radius: 50%; width: 34px; height: 34px; line-height: 34px; margin: 0 auto 1px; font-size: 1.0625rem; }
.day .what { flex: 1; min-width: 0; font-size: .875rem; color: var(--muted); }
.day .what div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day .what .names { color: var(--text); font-size: .9375rem; }
.day .hours { font-size: 1.125rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.day .hours.none { color: var(--muted); font-weight: 400; }
.day .chev { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: var(--muted); }
.dot.ok { background: var(--ok); }
.dot.wait { background: var(--wait); }
.dot.bad { background: var(--bad); }

/* --- the buttons at the bottom of the screen */
.actions {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 4;
    display: flex; gap: 10px; max-width: 560px; margin: 0 auto;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: var(--bg); border-top: 1px solid var(--line);
}
.btn {
    flex: 1; min-height: 52px; display: inline-flex; align-items: center; justify-content: center;
    padding: 0 16px; border-radius: 14px; border: 1px solid transparent;
    font-size: 1rem; font-weight: 600; text-decoration: none; text-align: center;
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.secondary { background: var(--card); color: var(--text); border-color: var(--line); }
.btn:active { filter: brightness(.92); }
.btn:disabled { opacity: .45; }
.btn.wide { display: flex; width: calc(100% - 24px); margin: 0 12px 10px; flex: none; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0b1220; } }

/* --- one day */
.daytitle { flex: 1; padding-left: 4px; }
.daytitle #dayName { font-weight: 600; font-size: 1.0625rem; }

.group { margin: 0 12px 10px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.group > summary, .grouphead {
    min-height: 48px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 14px; font-weight: 600; font-size: .9375rem; color: var(--muted); list-style: none;
}
.group > summary::-webkit-details-marker { display: none; }
.group > summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin-right: 4px; }
.group[open] > summary::after { transform: rotate(-135deg); }
.group .row { border-top: 1px solid var(--line); }
.group.first .row:first-child { border-top: 0; }

.row { padding: 10px 12px 10px 14px; }
.row .line { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.row .name { flex: 1; min-width: 0; background: none; border: 0; padding: 4px 0; text-align: left; font-size: 1rem; overflow-wrap: anywhere; }
.row .name small { display: block; margin-top: 2px; }
.row input.hrs {
    width: 92px; height: 48px; flex: none; text-align: center;
    font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums;
    background: var(--field); border: 1.5px solid var(--line); border-radius: 12px;
}
.row input.hrs:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 25%, transparent); }
.row input.hrs:read-only { background: transparent; border-style: dashed; color: var(--muted); }
.row.saving input.hrs { border-color: var(--wait); }
.row.error input.hrs { border-color: var(--bad); background: var(--bad-bg); }
.row .tools { display: none; flex-wrap: wrap; gap: 8px; padding: 8px 0 4px; }
.row.open .tools { display: flex; }
.chip {
    min-height: 44px; padding: 0 14px; border-radius: 999px;
    background: var(--bg); border: 1px solid var(--line); font-size: .9375rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.chip:active { background: var(--line); }
.chip.step { width: 48px; padding: 0; font-size: 1.25rem; }
.row textarea {
    width: 100%; min-height: 64px; margin-top: 4px; padding: 10px 12px; resize: vertical;
    background: var(--field); border: 1.5px solid var(--line); border-radius: 12px;
}
.row textarea:focus { outline: none; border-color: var(--blue); }
.row .rowmsg { font-size: .875rem; color: var(--bad); padding-top: 4px; }
.empty { margin: 24px 16px; text-align: center; color: var(--muted); }

/* --- messages */
.toast {
    position: fixed; left: 12px; right: 12px; bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 9;
    max-width: 536px; margin: 0 auto; padding: 12px 16px; border-radius: 12px;
    background: #1f2937; color: #fff; font-size: .9375rem; box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
}
.toast.bad { background: #8c1d18; }

.loading { position: fixed; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--bg) 55%, transparent); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

.sheet {
    width: 100%; max-width: 560px; margin: auto auto 0; padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
    border: 0; border-radius: 18px 18px 0 0; background: var(--card); color: var(--text);
}
.sheet::backdrop { background: rgba(0, 0, 0, .45); }
.sheet h2 { margin: 0 0 8px; font-size: 1.125rem; }
.sheet p { margin: 0 0 16px; }
.sheetbuttons { display: flex; gap: 10px; }
.sheetbuttons.stack { flex-direction: column; }
.sheetbuttons.stack .btn { flex: none; }

/* the page shown after signing out */
.plain { padding: 48px 20px; text-align: center; }
.plain .btn { display: inline-flex; flex: none; min-width: 200px; margin-top: 16px; }
