/* ── Fonts ─────────────────────────────────────────────────────────────────── */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900; /* variable font — one file, all weights */
    font-display: swap; /* show fallback immediately, swap when loaded */
    src: url('/fonts/inter-var.woff2') format('woff2');
}

/* ── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Accessible keyboard focus ring — shows only for keyboard nav, not mouse. */
:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
    border-radius: 4px;
}

.form-control:focus-visible {
    outline: none;
}
/* inputs use their own focus ring */

:root {
    --blue-dark: #1F4E79;
    --blue-mid: #2E75B6;
    --blue-light: #D6E4F0;
    --blue-pale: #EBF5FB;
    --accent: #E8543A;
    --green: #27875c;
    --green-bg: #e8f7f0;
    --red: #c0392b;
    --red-bg: #fdf0ee;
    --text: #1a1a2e;
    --text-muted: #5a6275;
    --border: #d0dae8;
    --bg: #f4f7fb;
    --white: #ffffff; /* literal white — text on coloured surfaces */
    --warning: #E0902A; /* amber — "attention" (under target / non-billable) */
    --radius: 8px;
    --shadow: 0 2px 8px rgba(31,78,121,.10);
    --shadow-lg: 0 8px 28px rgba(31,78,121,.18); /* dropdowns / overlays */
    --neutral-fill: #a5b0c0; /* calm bar fill for non-highlighted data */
    /* Type scale (values match the current dominant sizes) */
    --fs-xs: 0.72rem; /* eyebrow/caps labels, badges */
    --fs-sm: 0.8rem; /* hints, captions, meta */
    --fs-md: 0.875rem; /* secondary body, table cells */
    --fs-base: 0.95rem; /* inputs, primary body */
    --fs-lg: 1.05rem; /* card titles */
    --fs-xl: 1.35rem; /* page / login heading */
    /* Spacing scale (4/8/12/16/20/24px) */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.25rem;
    --sp-6: 1.5rem;
    /* Semantic tokens (so light/dark can differ) */
    --surface: #ffffff; /* cards, inputs, dropdowns, chips */
    --heading: var(--blue-dark); /* heading / label text */
    --nav-bg: var(--blue-dark); /* top nav background */
    --focus: var(--blue-mid); /* keyboard focus ring */
}

    /* ── Dark theme ──────────────────────────────────────────────────────────── */
    :root[data-theme="dark"] {
        color-scheme: dark; /* native controls (date picker) render dark */
        --blue-dark: #14263a;
        --blue-mid: #4a90d9;
        --blue-light: #2f4459;
        --blue-pale: #21313f;
        --green: #4caf7d;
        --green-bg: #143527;
        --red: #e57368;
        --red-bg: #3a1f1c;
        --text: #e6ebf2;
        --text-muted: #9fb0c3;
        --border: #33475a;
        --bg: #0f1620;
        --warning: #e0a54a;
        --shadow: 0 2px 10px rgba(0,0,0,.45);
        --shadow-lg: 0 10px 30px rgba(0,0,0,.55);
        --neutral-fill: #46586c;
        --surface: #1b2733;
        --heading: #9cc4ee;
        --nav-bg: #14263a;
        --focus: #6ea8e0;
    }

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Inter benefits from slightly tighter tracking on larger/heading text. */
.card-title, .login-card h1, .nav-brand, .log-day-title, .today-total-value {
    letter-spacing: -0.01em;
}

/* ── Login page ────────────────────────────────────────────────────────────── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.login-card {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow), 0 8px 24px rgba(31,78,121,.08);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: var(--blue-dark);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}

.logo-p {
    font-size: 2rem;
    font-weight: 700;
    color: var(--blue-dark);
    line-height: 1;
}

    .logo-p.small {
        font-size: 1.1rem;
    }

.login-card h1 {
    font-size: var(--fs-xl);
    font-weight: 700;
    color: var(--heading);
    margin-bottom: .4rem;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: .9rem;
    margin-bottom: 1.75rem;
}

.btn-login {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-size: 1rem;
    padding: .75rem 1.25rem;
    margin-bottom: 1rem;
}

.login-note {
    font-size: .8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ── Nav ───────────────────────────────────────────────────────────────────── */
.nav {
    background: var(--nav-bg);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: none;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.nav-inner {
    margin: 0 auto;
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .5rem;
}

    .nav-brand .logo-p {
        width: 30px;
        height: 30px;
        background: var(--white);
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: .95rem;
    }

.nav-right {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.theme-toggle {
    border: 1px solid rgba(255,255,255,.25);
    background: rgba(255,255,255,.1);
    color: var(--white);
    border-radius: 999px;
    width: auto;
    height: 26px;
    font-size: .95rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    gap: .3rem;
    padding: 0 .55rem;
    order: 1;
}



    .theme-toggle:hover {
        background: rgba(255,255,255,.22);
    }


.nav-user {
    order: 2;
    font-size: .85rem;
    color: rgba(255,255,255,.92);
}



/* Header */





.theme-toggle-label {
    font-size: .68rem;
    font-weight: 600;
}

.btn-nav-logout {
    order: 3;
    color: rgba(255,255,255,.9);
    border: 1px solid rgba(255,255,255,.55);
    background: transparent;
    border-radius: 5px;
    padding: .25rem .65rem;
    font-size: .7rem;
}

/* ── Main layout ───────────────────────────────────────────────────────────── */
.main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ── Card ──────────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--sp-6);
}

.card-title {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--heading);
    margin: 0;
}

.card-subtitle {
    font-size: var(--fs-sm);
    font-weight: 400;
    color: var(--text-muted);
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

    .card-header-row .card-title {
        margin-bottom: 0;
    }

/* ── Banners ───────────────────────────────────────────────────────────────── */
.banner {
    border-radius: var(--radius);
    padding: .75rem 1rem;
    font-size: .9rem;
    font-weight: 500;
}

.banner-success {
    background: var(--green-bg);
    color: var(--green);
}

.banner-error {
    background: var(--red-bg);
    color: var(--red);
}

#status-banner {
    margin-bottom: 0;
}

/* ── Form elements ─────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: var(--sp-4);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: .4rem;
}

.label-optional {
    font-weight: 400;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: .55rem .75rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: .95rem;
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s;
    outline: none;
}

    .form-control:focus {
        border-color: var(--blue-mid);
        box-shadow: 0 0 0 3px rgba(46,117,182,.15);
    }

/* ── Combobox (type-ahead task picker) ───────────────────────────────────── */
.combo {
    position: relative;
}

.combo-clear {
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 .25rem;
}

    .combo-clear:hover {
        color: var(--red);
    }

.form-control.has-selection {
    border-color: var(--green);
    background: var(--green-bg);
}

/* ── Timer ───────────────────────────────────────────────────────────────── */
.timer-bar {
    margin-bottom: var(--sp-4);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
    padding: var(--sp-2) var(--sp-3);
}

    .timer-bar.is-running {
        border-style: solid;
        border-color: var(--green);
        background: var(--green-bg);
    }

.timer-idle {
    display: flex;
    align-items: center;
    gap: .7rem;
    flex-wrap: wrap;
}

.timer-hint {
    font-size: var(--fs-sm);
    color: var(--text-muted);
}

.btn-timer {
    background: var(--green);
    color: var(--white);
    border-color: var(--green);
}

    .btn-timer:hover:not(:disabled) {
        filter: brightness(.94);
    }

.btn-stop {
    background: var(--red);
    color: var(--white);
    border-color: var(--red);
}

    .btn-timer:hover:not(:disabled) {
        filter: brightness(.94);
    }

.timer-run {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
}

.timer-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--green);
    flex: 0 0 auto;
    animation: timer-pulse 1.4s ease-in-out infinite;
}

.timer-task {
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--heading);
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timer-elapsed {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--heading);
    margin-left: auto;
}

.timer-bar.timer-overrun .timer-dot,
.timer-bar.timer-overrun .timer-elapsed {
    color: var(--warning);
    background: var(--warning);
}

.timer-bar.timer-overrun .timer-elapsed {
    background: none;
}

@keyframes timer-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: .4;
        transform: scale(.85);
    }
}

/* Editing-an-entry indicator */
.edit-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    flex-wrap: wrap;
    background: var(--blue-pale);
    border: 1px solid var(--blue-light);
    border-left: 3px solid var(--blue-mid);
    border-radius: var(--radius);
    padding: var(--sp-2) var(--sp-3);
    margin-bottom: var(--sp-4);
    font-size: var(--fs-sm);
    color: var(--heading);
}

/* ── Browse-by-project ───────────────────────────────────────────────────── */
.task-scope {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    margin-top: .4rem;
}

.link-btn {
    border: none;
    background: transparent;
    color: var(--blue-mid);
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

    .link-btn:hover {
        color: var(--heading);
    }

.task-scope-label {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .78rem;
    color: var(--text-muted);
    background: var(--blue-pale);
    border: 1px solid var(--blue-light);
    border-radius: 999px;
    padding: .15rem .3rem .15rem .7rem;
}

    .task-scope-label strong {
        color: var(--heading);
        font-weight: 700;
    }

.scope-clear {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 .25rem;
}

    .scope-clear:hover {
        color: var(--red);
    }

.project-picker {
    margin-top: .5rem;
}

.combo-dropdown {
    position: absolute;
    z-index: 50;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 260px;
    overflow-y: auto;
    background: var(--surface);
    border: 1.5px solid var(--blue-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.combo-group {
    font-weight: 700;
    color: var(--heading);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .5rem .75rem .25rem;
    position: sticky;
    top: 0;
    background: var(--surface);
}

.combo-item {
    padding: .5rem .75rem;
    font-size: .9rem;
    cursor: pointer;
}

    .combo-item:hover,
    .combo-item.active {
        background: var(--blue-mid);
        color: var(--white);
    }

/* ── Chips (recent tasks + time presets) ─────────────────────────────────── */
.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.chip {
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 999px;
    padding: .3rem .7rem;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}

    .chip:hover {
        background: var(--blue-pale);
        border-color: var(--blue-light);
        color: var(--heading);
    }

.chip-task {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.time-presets {
    margin-top: .5rem;
}

.recent-tasks-wrap {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--border);
}

.recent-tasks-label {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}

/* Active chip (selected date quick-pick) */
.chip-active {
    background: var(--blue-mid);
    border-color: var(--blue-mid);
    color: var(--white);
}

    .chip-active:hover {
        background: var(--blue-dark);
        border-color: var(--blue-dark);
        color: var(--white);
    }

/* ── "Logged today" badge ────────────────────────────────────────────────── */
.today-total {
    display: inline-flex;
    align-items: baseline;
    gap: .4rem;
    background: var(--blue-pale);
    border: 1px solid var(--blue-light);
    border-radius: 999px;
    padding: .3rem .8rem;
}

.today-total-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}

.today-total-value {
    font-size: .95rem;
    font-weight: 700;
    color: var(--text-muted);
}

    .today-total-value.has-time {
        color: var(--heading);
    }

/* ── Daily progress bar ──────────────────────────────────────────────────── */
.day-progress {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.day-progress-track {
    flex: 1;
    height: 8px;
    background: var(--blue-light);
    border-radius: 999px;
    overflow: hidden;
}

.day-progress-fill {
    height: 100%;
    width: 0;
    background: var(--blue-mid);
    border-radius: 999px;
    transition: width .35s ease, background .25s ease;
}

    .day-progress-fill.is-full {
        background: var(--green);
    }

.day-progress-caption {
    flex: 0 0 auto;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

    .day-progress-caption.is-full {
        color: var(--green);
    }

/* ── Date controls (steppers + quick picks) ──────────────────────────────── */
.date-row {
    display: flex;
    align-items: stretch;
    gap: .4rem;
}

    .date-row .form-control {
        flex: 1;
    }

.date-step {
    flex: 0 0 auto;
    width: 2.4rem;
    border: 1.5px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}

    .date-step:hover {
        background: var(--blue-pale);
        border-color: var(--blue-light);
        color: var(--heading);
    }

.date-quick {
    margin-top: .5rem;
}

.field-hint {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: .3rem;
}

/* Time inputs */
.time-inputs {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.time-field {
    width: 5rem;
    text-align: center;
}

.time-sep {
    font-size: .9rem;
    color: var(--text-muted);
    font-weight: 600;
}

textarea.form-control {
    resize: vertical;
    min-height: 60px;
}

/* ── Segmented control (billing status) ──────────────────────────────────── */
.segmented {
    display: inline-flex;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}

.seg-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: .5rem 1rem;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
}

    .seg-btn + .seg-btn {
        border-left: 1.5px solid var(--border);
    }

    .seg-btn:hover {
        background: var(--blue-pale);
        color: var(--heading);
    }

    .seg-btn.is-active {
        background: var(--blue-mid);
        color: var(--white);
    }

        .seg-btn.is-active:hover {
            background: var(--blue-mid);
            color: var(--white);
        }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 1.2rem;
    border-radius: var(--radius);
    font-size: var(--fs-md);
    font-weight: 600;
    text-decoration: none;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s, transform .05s;
    white-space: nowrap;
}

    .btn:active:not(:disabled) {
        transform: translateY(1px);
    }
/* tactile press feedback */

.btn-primary {
    background: var(--blue-mid);
    color: var(--white);
    border-color: var(--blue-mid);
    box-shadow: 0 1px 2px rgba(31,78,121,.25); /* subtle affordance */
}

    .btn-primary:hover:not(:disabled) {
        background: var(--blue-dark);
        border-color: var(--blue-dark);
    }

    .btn-primary:disabled {
        opacity: .6;
        cursor: not-allowed;
        box-shadow: none;
    }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

    .btn-ghost:hover {
        background: var(--blue-pale);
        color: var(--heading);
        border-color: var(--blue-light);
    }

.btn-sm {
    padding: .35rem .75rem;
    font-size: .8rem;
}

.form-actions {
    display: flex;
    gap: .75rem;
    margin-top: 1.25rem;
}

/* ── Spinner ───────────────────────────────────────────────────────────────── */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Recent logs table ─────────────────────────────────────────────────────── */
.logs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
    table-layout: fixed; /* keep columns fixed so long notes never push the table wider */
}

    .logs-table th {
        text-align: left;
        padding: .5rem .75rem;
        background: var(--blue-pale);
        color: var(--heading);
        font-size: .78rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .04em;
        border-bottom: 2px solid var(--blue-light);
    }

    .logs-table td {
        padding: .6rem .75rem;
        border-bottom: 1px solid var(--border);
        color: var(--text);
        vertical-align: top;
        overflow-wrap: anywhere; /* wrap long words / URLs instead of overflowing */
    }

    .logs-table tr:last-child td {
        border-bottom: none;
    }

    .logs-table tr:hover td {
        background: var(--blue-pale);
    }

    /* Column widths (table-layout: fixed). Project = 1st cell, Task = 2nd (remainder). */
    .logs-table td:first-child {
        width: 26%;
    }

    .logs-table .col-time {
        width: 68px;
        font-weight: 600;
        color: var(--blue-mid);
        white-space: nowrap;
    }

    .logs-table .col-date {
        white-space: nowrap;
        color: var(--text-muted);
        font-size: .82rem;
    }

    .logs-table .col-notes {
        width: 26%;
        color: var(--text-muted);
        font-size: .82rem;
    }

.loading-text {
    color: var(--text-muted);
    font-size: .9rem;
}

.empty-message {
    color: var(--text-muted);
    font-size: .9rem;
    padding: .5rem 0;
}

/* Row actions (log again / edit / delete) — fixed width so buttons stay put */
.logs-table .col-actions {
    white-space: nowrap;
    text-align: right;
    width: 124px;
    padding-left: .25rem;
}

.row-btn {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    font-size: .9rem;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

    .row-btn:hover {
        background: var(--blue-pale);
        color: var(--heading);
        border-color: var(--blue-light);
    }

    .row-btn + .row-btn {
        margin-left: .35rem;
    }

.row-btn-danger:hover {
    background: var(--red-bg);
    color: var(--red);
    border-color: var(--red);
}

.row-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* ── Recent entries: per-day groups ──────────────────────────────────────── */
.log-day {
    margin-bottom: 1.25rem;
}

    .log-day:last-child {
        margin-bottom: 0;
    }

.log-day-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: .35rem .75rem;
    background: var(--blue-pale);
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 2px solid var(--blue-light);
}

.log-day-title {
    font-size: .82rem;
    font-weight: 700;
    color: var(--heading);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.log-day-date {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-muted);
    margin-left: .35rem;
}

.log-day-total {
    font-size: .85rem;
    font-weight: 700;
    color: var(--blue-mid);
}

/* ── Skeleton loading ────────────────────────────────────────────────────── */
.skeleton-wrap {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding: .5rem 0;
}

.skeleton-row {
    display: flex;
    gap: .75rem;
    align-items: center;
}

.skeleton {
    height: .9rem;
    border-radius: 4px;
    background: linear-gradient(90deg, #e9eef5 25%, #f4f7fb 50%, #e9eef5 75%);
    background-size: 200% 100%;
    animation: shimmer 1.3s ease-in-out infinite;
}

.skeleton-sm {
    width: 22%;
}

.skeleton-lg {
    flex: 1;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ── This-week summary ───────────────────────────────────────────────────── */
.wk-split {
    margin-bottom: 1.1rem;
}

.wk-split-bar {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--neutral-fill); /* non-billable remainder shows through */
    display: flex;
}

.wk-split-fill {
    height: 100%;
    background: var(--blue-mid);
    border-radius: 999px 0 0 999px;
}

.wk-split-legend {
    display: flex;
    gap: 1.1rem;
    flex-wrap: wrap;
    margin-top: .45rem;
    font-size: .78rem;
    color: var(--text-muted);
}

    .wk-split-legend .dot {
        display: inline-block;
        width: 9px;
        height: 9px;
        border-radius: 50%;
        margin-right: .3rem;
    }

.dot-bill {
    background: var(--blue-mid);
}

.dot-non {
    background: var(--neutral-fill);
}

.wk-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: .4rem;
    align-items: end;
    margin-bottom: .5rem;
}

.wk-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
}

.wk-day-track {
    width: 100%;
    height: 70px;
    display: flex;
    align-items: flex-end;
    background: var(--blue-pale);
    border-radius: 5px;
    overflow: hidden;
}

.wk-day-bar {
    width: 100%;
    background: var(--blue-mid);
    border-radius: 5px 5px 0 0;
    transition: height .3s ease;
}

.wk-day.is-met .wk-day-bar {
    background: var(--green);
}

.wk-day.is-under .wk-day-bar {
    background: var(--warning);
}

.wk-day.is-empty .wk-day-bar {
    background: transparent;
}

.wk-day-val {
    font-size: .68rem;
    font-weight: 600;
    color: var(--text-muted);
}

.wk-day-lbl {
    font-size: .7rem;
    color: var(--text-muted);
}

.wk-gap {
    font-size: .78rem;
    color: var(--warning);
    font-weight: 600;
    margin-bottom: 1rem;
}

.wk-gap-ok {
    color: var(--green);
}

.wk-sub {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    margin-bottom: .5rem;
}

.wk-proj {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .4rem;
}

.wk-proj-name {
    flex: 0 0 38%;
    font-size: .82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wk-proj-bar {
    flex: 1;
    height: 8px;
    background: var(--blue-pale);
    border-radius: 999px;
    overflow: hidden;
}

.wk-proj-fill {
    display: block;
    height: 100%;
    background: var(--blue-mid);
    border-radius: 999px;
}

.wk-proj-val {
    flex: 0 0 auto;
    font-size: .78rem;
    font-weight: 600;
    color: var(--heading);
    white-space: nowrap;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */

/* Never let anything force the page to scroll sideways.
   overflow-x: clip (not hidden) avoids turning body into a scroll container,
   so the sticky nav keeps working. */
html, body {
    max-width: 100%;
    overflow-x: clip;
}

img, table, pre {
    max-width: 100%;
}

@media (max-width: 640px) {
    /* Layout breathing room */
    .main {
        padding: 1rem .8rem 2.5rem;
        gap: 1rem;
    }

    .card {
        padding: 1.1rem 1rem;
    }

    .nav-inner {
        padding: .75rem .85rem;
    }

    .card-header-row {
        flex-wrap: wrap;
        gap: .5rem;
    }

    /* Form */
    .form-row {
        grid-template-columns: 1fr;
    }

    .time-inputs {
        flex-wrap: wrap;
    }

    .form-actions {
        flex-direction: column;
    }

        .form-actions .btn {
            justify-content: center;
        }

    .nav-user {
        display: none;
    }
    /* 16px inputs stop iOS Safari from auto-zooming when a field is focused */
    .form-control, .time-field {
        font-size: 16px;
    }

    /* Recent entries: hide notes, tighten, and let a wide row scroll in-card */
    .log-day {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .logs-table {
        font-size: .82rem;
    }

        .logs-table td {
            padding: .5rem .45rem;
        }

        .logs-table .col-notes {
            display: none;
        }

    .row-btn {
        width: 32px;
        height: 32px;
    }
    /* touch target */

    /* Weekly summary: compact the 7-day chart */
    .wk-days {
        gap: .25rem;
    }

    .wk-day-track {
        height: 54px;
    }

    .wk-day-val {
        font-size: .58rem;
    }

    .wk-day-lbl {
        font-size: .62rem;
    }

    .wk-split-legend {
        gap: .6rem;
        font-size: .72rem;
    }

    .wk-proj-name {
        flex-basis: 34%;
        font-size: .78rem;
    }

    .wk-proj-val {
        font-size: .74rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton {
        animation: none;
    }

    .day-progress-fill, .wk-day-bar {
        transition: none;
    }
}


/* ==========================================================================
   Dashboard redesign v2
   ========================================================================== */

:root {
    --blue-dark: #173f66;
    --blue-mid: #2563eb;
    --blue-light: #cbd9ea;
    --blue-pale: #edf5ff;
    --text: #10233b;
    --text-muted: #66758a;
    --border: #d5dde8;
    --bg: #f3f6fa;
    --surface: #ffffff;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 35, 59, .05), 0 5px 18px rgba(16, 35, 59, .05);
    --nav-bg: #173f66;
}

    :root[data-theme="dark"] {
        --blue-dark: #122b45;
        --blue-mid: #4d8df7;
        --blue-light: #334b64;
        --blue-pale: #1b3045;
        --text: #e5edf7;
        --text-muted: #9eafc2;
        --border: #33485e;
        --bg: #0e1722;
        --surface: #172434;
        --nav-bg: #112c47;
    }

html {
    font-size: 14px;
}

body {
    background: var(--bg);
    line-height: 1.35;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}



/* Main / cards */

.section-heading {
    min-width: 0;
}

.summary-pill {
    display: inline-flex;
    align-items: center;
    gap: .32rem;
    padding: .3rem .65rem;
    border-radius: 999px;
    background: var(--blue-pale);
    color: var(--blue-mid);
    font-size: .68rem;
    font-weight: 600;
}

    .summary-pill strong {
        font-size: .76rem;
        color: var(--heading);
    }

/* Logged progress */
.logged-progress {
    margin: 1rem 0 1.35rem;
}

.logged-progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: .45rem;
    font-size: .68rem;
    font-weight: 600;
    color: var(--text-muted);
}

.logged-progress-value {
    color: var(--heading);
    font-weight: 700;
}

.logged-progress-target {
    margin-left: .18rem;
    font-weight: 400;
}

.day-progress-track {
    height: 7px;
    background: #e8edf3;
}

:root[data-theme="dark"] .day-progress-track {
    background: #293c50;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}



.form-control {
    min-height: 32px;
    padding: .48rem .65rem;
    border-width: 1px;
    border-radius: 6px;
    font-size: .78rem;
}

    .form-control:focus {
        box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
    }

.search-combo .search-icon {
    position: absolute;
    left: .65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    z-index: 1;
}

.search-control {
    padding-left: 1.8rem;
}

.field-hint {
    margin-top: .38rem;
    font-size: .66rem;
}

.combo-dropdown {
    top: calc(100% + 3px);
    border-width: 1px;
    border-radius: 7px;
    box-shadow: 0 8px 25px rgba(16,35,59,.16);
}

.combo-group {
    font-size: .65rem;
}

.combo-item {
    padding: .48rem .65rem;
    font-size: .75rem;
}

/* Search / browse tabs */
.task-mode-tabs {
    display: flex;
    gap: .4rem;
    margin-top: .55rem;
}

.task-mode-btn {
    min-height: 27px;
    padding: .3rem .75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-muted);
    font: inherit;
    font-size: .68rem;
    font-weight: 700;
    cursor: pointer;
}

    .task-mode-btn:hover {
        background: var(--blue-pale);
        color: var(--heading);
    }

    .task-mode-btn.is-active {
        background: var(--blue-mid);
        border-color: var(--blue-mid);
        color: #fff;
    }

/* Project browser */
.project-browser {
    margin-top: .65rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    overflow: hidden;
    background: var(--surface);
}

.project-browser-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .6rem .75rem;
    background: var(--blue-pale);
    border-bottom: 1px solid var(--border);
    color: var(--heading);
    font-size: .72rem;
}

    .project-browser-head .link-btn {
        text-decoration: none;
        font-size: .66rem;
    }

.project-browser-body {
    padding: .65rem;
}

.project-list {
    position: static;
    display: block;
    margin-top: .45rem;
    max-height: 210px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: none;
}

    .project-list:empty {
        display: none;
    }

.project-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem .65rem;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    text-align: left;
    font: inherit;
    font-size: .72rem;
    cursor: pointer;
}

    .project-item:last-child {
        border-bottom: 0;
    }

    .project-item:hover,
    .project-item.active {
        background: var(--blue-pale);
        color: var(--heading);
    }

.project-item-count {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: .62rem;
}

.task-scope-label {
    margin-top: .55rem;
    border-radius: 999px;
    font-size: .65rem;
}

/* Recent chips */
.recent-tasks-wrap {
    margin: .55rem 0 0;
    padding: 0;
    border: 0;
}

.chip-row {
    gap: .35rem;
}

.chip {
    padding: .28rem .62rem;
    border-width: 1px;
    border-radius: 999px;
    font-size: .66rem;
}

.chip-task {
    max-width: 190px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Timer */
.timer-bar {
    margin: 1rem 0;
    padding: .7rem;
    border-width: 1px;
    border-style: solid;
    border-radius: 7px;
    background: color-mix(in srgb, var(--bg) 45%, var(--surface));
}

.timer-hint {
    font-size: .68rem;
}

/* Grouped date / time / billing panel */
.entry-control-panel {
    margin: .9rem 0 1rem;
    padding: .9rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: color-mix(in srgb, var(--bg) 38%, var(--surface));
}

.entry-top-row {
    grid-template-columns: 1.05fr 1fr;
    gap: 1.4rem;
}

    .entry-top-row .form-group {
        margin-bottom: 0;
    }

.entry-control-divider {
    height: 1px;
    margin: .9rem 0;
    background: var(--border);
}

.billing-group {
    margin-bottom: 0;
}

.date-row {
    gap: .35rem;
}

.date-step {
    width: 31px;
    border-width: 1px;
    border-radius: 6px;
    font-size: 1rem;
}

.date-quick,
.time-presets {
    margin-top: .45rem;
}

.time-field {
    width: 55px;
    min-width: 0;
}

.segmented {
    border-width: 1px;
    border-radius: 6px;
}



/* Notes / actions */
.notes-group {
    margin-top: .95rem;
}

textarea.form-control {
    min-height: 48px;
    resize: vertical;
}

.form-actions {
    margin-top: 1rem;
    gap: .55rem;
}



/* Weekly summary */

.wk-gap {
    padding: .45rem .6rem;
    border-radius: 5px;
    background: #fff4dc;
}

:root[data-theme="dark"] .wk-gap {
    background: #3a2d16;
}

.wk-gap::before {
    content: "△ ";
}

.wk-gap-ok {
    background: var(--green-bg);
    color: var(--green);
}


/* Recent entries */

.log-day-head {
    padding: .45rem .65rem;
    border-radius: 5px 5px 0 0;
    border-bottom-width: 1px;
}



    .logs-table td {
        padding: .58rem .65rem;
        border-bottom: 0;
    }

    .logs-table tr + tr td {
        border-top: 1px solid var(--border);
    }

    .logs-table tr:hover td {
        background: transparent;
    }

   

.row-btn {
    width: 25px;
    height: 25px;
    border-radius: 5px;
    font-size: .72rem;
}

.loading-text,
.empty-message {
    font-size: .72rem;
}

/* Mobile */
@media (max-width: 640px) {
    html {
        font-size: 14px;
    }

    .nav-inner {
        padding: .55rem .75rem;
    }

    .theme-toggle-label {
        display: none;
    }

    .nav-user {
        display: none;
    }

    .main {
        padding: 1rem .7rem 2.5rem;
    }

    .card {
        padding: 1.05rem;
    }

    .entry-top-row {
        grid-template-columns: 1fr;
        gap: .9rem;
    }

        .entry-top-row .form-group + .form-group {
            margin-top: .15rem;
        }

    .project-browser-head {
        align-items: flex-start;
        gap: .5rem;
    }

    .task-mode-tabs {
        flex-wrap: wrap;
    }

    .logs-table {
        min-width: 570px;
    }

    .log-day {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .logs-table .col-notes {
        display: table-cell;
    }

    .form-actions {
        flex-direction: row;
    }

        .form-actions .btn {
            justify-content: center;
        }
}
