:root {
    color-scheme: light;
    --bg: #f2f7f0;
    --panel: #ffffff;
    --line: #dfe8d8;
    --text: #2b332b;
    --muted: #78846f;
    --accent: #4caf7d;
    --accent-dark: rgb(41, 87, 47);
    --accent-soft: #e7f3e2;
    --danger: #dc2626;
    --sidebar: #f8fbf5;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Nunito', Arial, Helvetica, sans-serif;
}

.brand,
h1,
h2,
h3,
.view-title,
.entry-duration,
.timer-display {
    font-family: 'Baloo 2', 'Nunito', Arial, Helvetica, sans-serif;
}

button,
input,
select {
    font: inherit;
}

.hidden {
    display: none !important;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.app-shell.logged-out {
    grid-template-columns: 1fr;
}

.landing-footer {
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 14px;
    padding: 24px 28px 40px;
}

.landing-footer .landing-shell {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
}

.sidebar {
    background: var(--sidebar);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: 100vh;
    overflow-y: auto;
    padding: 22px 18px;
    position: sticky;
    top: 0;
}

.brand {
    align-items: center;
    display: flex;
    gap: 12px;
    font-size: 24px;
}

.brand-mark {
    border-radius: 8px;
    display: block;
    height: 38px;
    width: 38px;
}

.sidebar-toggle {
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
    display: none;
    flex-direction: column;
    gap: 4px;
    margin-left: auto;
    padding: 8px;
}

.sidebar-toggle span {
    background: var(--text);
    border-radius: 2px;
    display: block;
    height: 2px;
    width: 18px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.nav {
    display: grid;
    gap: 8px;
}

.nav-item,
.ghost-button {
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    padding: 13px 14px;
    text-align: left;
}

.nav-item.active,
.nav-item:hover,
.ghost-button:hover {
    background: var(--accent-soft);
}

.suggest-feature-button {
    margin-top: auto;
}

.workspace {
    min-width: 0;
    padding: 28px;
}

.topbar,
.section-heading {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.eyebrow {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0;
    margin: 0 0 6px;
    text-transform: uppercase;
}

.view-title,
.auth-copy h1 {
    margin: 0;
}

.topbar-actions {
    align-items: center;
    display: flex;
    gap: 12px;
}

.lang-switch {
    background: var(--bg);
    border-radius: 6px;
    display: flex;
    padding: 4px;
}

.lang-option {
    background: transparent;
    border: 0;
    border-radius: 5px;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 10px;
}

.lang-option.active {
    background: #fff;
    color: var(--accent-dark);
}

.user-pill {
    background: #f4a259;
    border: 0;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    min-width: 42px;
    padding: 12px;
    text-align: center;
}

.user-pill:hover {
    filter: brightness(0.95);
}

.user-pill.has-avatar {
    background-position: center;
    background-size: cover;
    height: 42px;
    padding: 0;
    width: 42px;
}

.auth-panel {
    align-items: stretch;
    display: grid;
    gap: 28px;
    grid-template-columns: minmax(220px, 1fr) 380px;
    margin-top: 60px;
}

.auth-copy {
    align-self: center;
}

.auth-copy h1 {
    font-size: 42px;
    max-width: 560px;
}

.auth-form,
.timer-bar,
.project-form,
.chart-panel,
.totals-panel,
.weekday-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(43, 51, 43, 0.07);
}

.auth-form {
    display: grid;
    gap: 16px;
    padding: 22px;
}

.auth-tabs {
    background: var(--bg);
    border-radius: 6px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 4px;
}

.auth-tab {
    background: transparent;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    padding: 10px;
}

.auth-tab.active {
    background: #fff;
    color: var(--accent-dark);
    font-weight: 700;
}

label {
    color: var(--muted);
    display: grid;
    gap: 7px;
    font-size: 14px;
}

input,
select,
textarea {
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    min-height: 42px;
    padding: 0 12px;
    width: 100%;
}

input[type="datetime-local"] {
    width: 106%;
    padding: 0 6px;
}

textarea {
    font: inherit;
    padding: 10px 12px;
    resize: vertical;
}

.form-copy {
    color: var(--muted);
    margin: 0;
}

.primary-button,
.small-button {
    background: var(--accent);
    border: 0;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    min-height: 42px;
    padding: 0 18px;
}

.primary-button:hover,
.small-button:hover {
    background: var(--accent-dark);
}

.danger-button {
    background: transparent;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: var(--danger);
    cursor: pointer;
    min-height: 36px;
    padding: 0 12px;
}

.form-message {
    color: var(--danger);
    min-height: 20px;
    margin: 0;
}

.form-message.success {
    color: #16a34a;
}

.app-content {
    margin-top: 26px;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.timer-bar {
    align-items: center;
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr 230px 140px 120px;
    padding: 14px;
}

.timer-display {
    font-size: 24px;
    text-align: center;
}

.timer-button.stop {
    background: #ef4444;
}

.section-heading {
    margin: 28px 0 12px;
}

.section-heading h2 {
    margin: 0;
}

.entries-list,
.project-list {
    display: grid;
    gap: 10px;
}

.pagination-bar {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
}

.pagination-controls {
    align-items: center;
    display: flex;
    gap: 10px;
}

.pagination-controls .icon-button {
    height: 32px;
    width: 32px;
}

.pagination-controls .icon-button:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

#entriesPerPage {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    height: 32px;
    padding: 0 8px;
}

.entry-row,
.project-row {
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 14px;
    padding: 14px 16px;
}

.entry-row {
    grid-template-columns: minmax(180px, 1.4fr) minmax(170px, 0.7fr) minmax(360px, 1fr) 100px 190px;
}

.project-row {
    grid-template-columns: 24px 1fr 58px 100px 100px;
}

.entry-actions .small-button,
.entry-actions .danger-button,
.project-row .small-button,
.project-row .danger-button {
    padding: 0 10px;
    white-space: nowrap;
}

.project-dot {
    border-radius: 50%;
    height: 11px;
    width: 11px;
}

.entry-time-edit,
.entry-actions {
    display: grid;
    gap: 8px;
}

.entry-time-edit {
    grid-template-columns: repeat(2, minmax(170px, 1fr));
    min-width: 0;
}

.entry-actions {
    grid-template-columns: 1fr 1fr;
}

.entry-row input,
.entry-row select {
    min-width: 0;
}

.entry-duration {
    font-size: 20px;
    font-weight: 700;
    text-align: right;
}

.project-form {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 58px 150px;
    margin-bottom: 18px;
    padding: 14px;
}

.report-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) 320px;
}

.report-toolbar {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 18px;
}

.icon-button {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
    height: 40px;
    width: 40px;
}

.icon-button:hover {
    background: var(--accent-soft);
}

#reportWeekLabel {
    min-width: 210px;
    text-align: center;
}

.chart-panel,
.totals-panel,
.weekday-panel {
    padding: 18px;
}

.weekday-panel {
    margin-top: 18px;
}

.weekday-panel h2 {
    font-size: 20px;
    margin: 0 0 14px;
}

.chart-panel canvas,
.weekday-panel canvas {
    display: block;
    max-width: 100%;
    width: 100%;
}

.total-row {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 8px;
    grid-template-columns: 14px 1fr auto;
    padding: 12px 0;
}

.monthly-report-sheet {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(43, 51, 43, 0.07);
    margin: 0 auto;
    max-width: 210mm;
    padding: 24px 32px;
    font-size: 12px;
}

.monthly-report-header h2 {
    margin: 0 0 4px;
    text-align: center;
    text-transform: capitalize;
}

.monthly-report-viz-sheet {
    margin-bottom: 18px;
}

.monthly-report-subtitle {
    color: var(--muted);
    margin: 0 0 20px;
    text-align: center;
}

.monthly-report-viz-stats {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 24px;
}

.monthly-report-stat {
    background: var(--sidebar);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    text-align: center;
}

.monthly-report-stat strong {
    display: block;
    font-size: 16px;
}

.monthly-report-stat span {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
}

.monthly-report-viz-main {
    align-items: center;
    display: grid;
    gap: 24px;
    grid-template-columns: 360px 1fr;
    margin-bottom: 24px;
}

.monthly-report-viz-chart {
    text-align: center;
}

.monthly-report-viz-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.monthly-report-legend-row {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: 10px 1fr auto auto;
}

.monthly-report-legend-swatch {
    border-radius: 50%;
    height: 10px;
    width: 10px;
}

.monthly-report-legend-percent {
    color: var(--muted);
    font-size: 12px;
    width: 44px;
}

.monthly-report-viz-heatmap h3 {
    font-size: 13px;
    margin: 0 0 10px;
    text-align: center;
    text-transform: uppercase;
    color: var(--muted);
}

.monthly-report-viz-chart canvas,
.monthly-report-viz-heatmap canvas {
    display: block;
    max-width: 100%;
    width: 100%;
}

.monthly-report-viz-chart canvas {
    max-width: 260px;
    margin: 0 auto;
}

.monthly-report-scroll {
    overflow-x: auto;
}

.monthly-report-table {
    border-collapse: collapse;
    width: 100%;
}

.monthly-report-table th,
.monthly-report-table td {
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
    text-align: left;
    white-space: nowrap;
}

.monthly-report-table th:nth-child(n+3),
.monthly-report-table td:nth-child(n+3) {
    text-align: right;
}

.monthly-report-table tfoot td {
    border-bottom: 0;
    border-top: 2px solid var(--text);
    font-weight: 700;
    padding-top: 12px;
}

@media print {
    body * {
        visibility: hidden;
    }

    .monthly-report-sheet,
    .monthly-report-sheet * {
        visibility: visible;
    }

    #monthlyReportView {
        left: 0;
        position: absolute;
        top: 0;
        width: 100%;
    }

    .monthly-report-sheet {
        border: 0;
        box-shadow: none;
        margin: 0;
        max-width: none;
        width: 100%;
    }

    .monthly-report-viz-sheet {
        break-after: page;
    }

    @page {
        margin: 12mm;
        size: A4;
    }
}

.profile-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: 260px 1fr;
}

.profile-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(43, 51, 43, 0.07);
    padding: 22px;
}

.profile-form {
    display: grid;
    gap: 16px;
    grid-column: 2;
}

.avatar-panel {
    align-items: center;
    display: grid;
    gap: 14px;
    grid-row: span 2;
    justify-items: center;
    text-align: center;
}

.avatar-preview {
    border: 1px solid var(--line);
    border-radius: 50%;
    height: 120px;
    object-fit: cover;
    width: 120px;
}

.avatar-upload-label {
    background: var(--accent);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    display: inline-block;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 16px;
}

.avatar-upload-label:hover {
    background: var(--accent-dark);
}

.profile-form h2 {
    margin: 0;
}

.danger-zone {
    border-color: #fecaca;
    grid-column: 1 / -1;
}

.danger-zone-copy {
    color: var(--muted);
    margin: 0;
}

.danger-zone .danger-button {
    justify-self: start;
    min-width: 160px;
}

.empty-state {
    background: rgba(255, 255, 255, 0.7);
    border: 1px dashed #bdd0b4;
    border-radius: 8px;
    color: var(--muted);
    padding: 28px;
    text-align: center;
}

.sponsored-by {
    font-size: 0.75rem;
}

small {
    font-size: 0.75rem;
}

@media (max-width: 1280px) {
    .entry-row {
        grid-template-columns: minmax(180px, 1fr) minmax(170px, 0.7fr) minmax(360px, 1fr);
    }

    .entry-duration {
        text-align: left;
    }

    .entry-actions {
        grid-column: span 3;
        grid-template-columns: 130px 130px;
    }
}

@media (max-width: 900px) {
    .app-shell,
    .auth-panel,
    .report-grid,
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .monthly-report-viz-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .monthly-report-viz-main {
        grid-template-columns: 1fr;
    }

    .auth-copy h1 {
        font-size: 36px;
        line-height: 1.1;
    }

    .profile-form {
        grid-column: auto;
    }

    .avatar-panel {
        grid-row: auto;
    }

    .sidebar {
        border-bottom: 1px solid var(--line);
        border-right: 0;
        height: auto;
        position: static;
    }

    .sidebar-toggle {
        display: flex;
    }

    .sidebar-nav {
        display: none;
    }

    .sidebar.nav-open .sidebar-nav {
        display: flex;
    }

    .timer-bar,
    .entry-row,
    .project-row,
    .project-form {
        grid-template-columns: 1fr;
    }

    .entry-duration {
        text-align: left;
    }

    .entry-time-edit,
    .entry-actions {
        grid-template-columns: 1fr;
    }

    .entry-actions {
        grid-column: auto;
    }
    input[type="datetime-local"] {
        width: 100%;
    }
    .pagination-bar {
        font-size: .75rem;
    }
}
