:root {
    color-scheme: light;
    --color-bg: #f4f6f8;
    --color-surface: #ffffff;
    --color-surface-muted: #f7fafc;
    --color-surface-soft: #edf2f7;
    --color-border: #e2e8f0;
    --color-text: #1a202c;
    --color-muted: #718096;
    --color-primary: #2f855a;
    --color-primary-hover: #276749;
    --color-danger: #c53030;
    --color-danger-hover: #9b2c2c;
    --color-accent: #2b6cb0;
    --color-link: #2b6cb0;
    --color-link-hover: #2c5282;
    --color-on-accent: #ffffff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --radius: 8px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --color-own-entry-bg: #ccffd5;
    --color-non-billable-bg: #e2e8f0;
    --color-report-task-bg: #f8fafc;
    --color-report-nonbillable-bg: #fff9db;
    --color-client-header-bg: #f8f9fb;
    --color-timer-bg: #ebf8ff;
    --color-timer-border: #bee3f8;
    --color-week-weekend: #eef1f8;
    --color-week-hover: #f7fafc;
    --color-week-weekend-hover: #e4e9f4;
    --color-week-selected: #bee3f8;
    --color-week-selected-strong: #90cdf4;
    --color-zero: #cbd5e0;
    --color-zero-on-selected: #4a5568;
    --color-progress-track: #e2e8f0;
    --color-alert-error-bg: #fed7d7;
    --color-alert-error-text: #9b2c2c;
    --color-alert-success-bg: #c6f6d5;
    --color-alert-success-text: #22543d;
    --color-alert-warning-bg: #fefcbf;
    --color-alert-warning-text: #744210;
    --color-entry-nested-bg: #fafbfc;
    --color-entry-locked-bg: #fafafa;
    --color-entry-other-bg: #f4f6f8;
    --color-user-chip-bg: #e8eef5;
    --color-user-chip-text: #2c5282;
    --color-sidebar-heading-bg: #4a5568;
    --color-login-grad-start: #edf2f7;
    --color-login-grad-end: #e6fffa;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --color-bg: #0f1419;
    --color-surface: #1a2332;
    --color-surface-muted: #141c27;
    --color-surface-soft: #243044;
    --color-border: #2d3a4d;
    --color-text: #e2e8f0;
    --color-muted: #94a3b8;
    --color-primary: #48bb78;
    --color-primary-hover: #68d391;
    --color-danger: #fc8181;
    --color-danger-hover: #feb2b2;
    --color-accent: #63b3ed;
    --color-link: #63b3ed;
    --color-link-hover: #90cdf4;
    --color-on-accent: #0f1419;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    --color-own-entry-bg: #1a3d2e;
    --color-non-billable-bg: #2d3748;
    --color-report-task-bg: #141c27;
    --color-report-nonbillable-bg: #3d3419;
    --color-client-header-bg: #f8f9fb;
    --color-timer-bg: #1a2f42;
    --color-timer-border: #2b4c66;
    --color-week-weekend: #1e293b;
    --color-week-hover: #243044;
    --color-week-weekend-hover: #2a3648;
    --color-week-selected: #1e3a5f;
    --color-week-selected-strong: #234e75;
    --color-zero: #4a5568;
    --color-zero-on-selected: #a0aec0;
    --color-progress-track: #2d3a4d;
    --color-alert-error-bg: #3b1f1f;
    --color-alert-error-text: #feb2b2;
    --color-alert-success-bg: #1c3a2a;
    --color-alert-success-text: #9ae6b4;
    --color-alert-warning-bg: #3d3419;
    --color-alert-warning-text: #f6e05e;
    --color-entry-nested-bg: #141c27;
    --color-entry-locked-bg: #141c27;
    --color-entry-other-bg: #151b24;
    --color-user-chip-bg: #1e3a5f;
    --color-user-chip-text: #90cdf4;
    --color-sidebar-heading-bg: #334155;
    --color-login-grad-start: #0f1419;
    --color-login-grad-end: #1a2f2a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

a {
    color: var(--color-link);
    text-decoration: underline;
}

a:hover {
    color: var(--color-link-hover);
}

a.btn,
a.btn-icon,
a.week-day,
a.report-tabs .tab,
a.nav-link.active,
.sidebar-list a {
    text-decoration: none;
}

.topbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow);
}

.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.main-nav a {
    text-decoration: none;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 0.3rem 0.65rem;
}

.nav-link {
    font-weight: 500;
}

.nav-link:hover {
    color: var(--color-link-hover);
}

.nav-link.active {
    background: var(--color-accent);
    color: var(--color-on-accent);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    text-decoration: none;
}

.nav-link.active:hover {
    background: var(--color-link-hover);
    color: var(--color-on-accent);
}

.main-nav a.nav-link.nav-timer-running {
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    color: #fff;
    animation: nav-timer-pulse 1.6s ease-in-out infinite;
}

.main-nav a.nav-link.nav-timer-running:hover {
    color: #fff;
}

@keyframes nav-timer-pulse {
    0%, 100% {
        background-color: #2b6cb0;
    }
    50% {
        background-color: #63b3ed;
    }
}

.nav-link.nav-link-admin {
    background: var(--color-alert-error-bg);
    color: var(--color-alert-error-text);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
}

.nav-link.nav-link-admin:hover {
    background: var(--color-alert-error-bg);
    color: var(--color-danger-hover);
    filter: brightness(1.05);
}

.nav-link.nav-link-admin.active {
    background: var(--color-danger);
    color: #fff;
}

.nav-link.nav-link-admin.active:hover {
    background: var(--color-danger-hover);
    color: #fff;
}

.nav-link.subtle {
    font-size: 0.9rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.help-open-btn {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font: inherit;
    color: var(--color-link);
}

.help-open-btn:hover {
    color: var(--color-link-hover);
}

.locale-switch a {
    font-size: 0.85rem;
    font-weight: 600;
}

.locale-switch a.active {
    color: var(--color-link-hover);
    text-decoration: none;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
}

.user-name:not(.user-name-admin) {
    background: var(--color-surface-soft);
    color: var(--color-text);
}

.user-name-admin {
    background: var(--color-danger);
    color: #fff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.alert-error {
    background: var(--color-alert-error-bg);
    color: var(--color-alert-error-text);
}

.alert-success {
    background: var(--color-alert-success-bg);
    color: var(--color-alert-success-text);
}

.alert-warning {
    background: var(--color-alert-warning-bg);
    color: var(--color-alert-warning-text);
}

.user-name-impersonating {
    outline: 2px solid #d69e2e;
    outline-offset: 1px;
}

.nav-return-admin {
    font-weight: 600;
    color: var(--color-danger);
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-login-grad-start), var(--color-login-grad-end));
}

.login-card {
    background: var(--color-surface);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 400px;
}

.form-stack label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-stack input,
.form-stack select,
.form-stack textarea {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font: inherit;
    background: var(--color-surface);
    color: var(--color-text);
}

.form-stack input:disabled,
.form-stack textarea:disabled,
.form-stack input:read-only {
    background: var(--color-surface-muted);
    color: var(--color-muted);
    cursor: not-allowed;
}

.form-stack select option:disabled {
    color: var(--color-muted);
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400 !important;
}

.checkbox-label input {
    width: auto;
    margin: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    background: var(--color-surface-muted);
    text-decoration: none;
}

.btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-on-accent);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    color: var(--color-on-accent);
}

.sidebar-add-item .sidebar-add-btn:hover {
    color: var(--color-on-accent);
}

.btn-blue {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-on-accent);
}

.btn-blue:hover {
    background: var(--color-link-hover);
    border-color: var(--color-link-hover);
    color: var(--color-on-accent);
}

.btn-secondary {
    background: var(--color-surface-soft);
}

.btn-danger {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: #fff;
}

.btn-danger:hover {
    background: var(--color-danger-hover);
    color: #fff;
}

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.85rem;
}

.btn-icon-only {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem;
    min-width: 2rem;
    line-height: 1;
    color: var(--color-muted);
    border-color: var(--color-border);
    background: var(--color-surface);
}

.btn-icon-only:hover {
    color: var(--color-text);
    border-color: var(--color-text);
    background: var(--color-surface);
}

.edit-entry-btn:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: var(--color-timer-bg);
}

.delete-entry-btn:hover {
    color: var(--color-danger);
    border-color: var(--color-danger);
    background: var(--color-alert-error-bg);
}

.btn-icon-only svg {
    display: block;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 1.25rem;
    text-decoration: none;
}

.day-header {
    margin-bottom: 1.5rem;
}

.day-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.day-header-aside {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.day-month-total {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
}

.day-month-total-label {
    font-size: 0.8rem;
    font-weight: 500;
}

.day-month-total-amount {
    font-size: 1.1rem;
    font-variant-numeric: tabular-nums;
    color: var(--color-primary);
}

.day-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.day-nav-title {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 22rem;
    flex-shrink: 0;
    gap: 0.35rem;
}

.day-nav h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    width: 100%;
    text-align: center;
    white-space: nowrap;
}

.day-month-progress {
    width: 100%;
    height: 0.4rem;
    border-radius: 999px;
    background: var(--color-progress-track);
    overflow: hidden;
}

.day-month-progress-bar {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--color-accent);
    transition: width 0.2s ease;
}

.day-header .view-tabs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.day-date-picker {
    position: relative;
    flex-shrink: 0;
    cursor: pointer;
}

.day-date-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: none;
    opacity: 0;
    cursor: pointer;
}

.day-date-picker svg {
    display: block;
    pointer-events: none;
}

.link-muted {
    font-size: 0.9rem;
}

.view-tabs {
    margin-top: 0.75rem;
}

.view-tabs .tab {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-bottom: 2px solid var(--color-primary);
    font-weight: 600;
    color: var(--color-text);
}

.timer-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--color-timer-bg);
    border: 1px solid var(--color-timer-border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.timer-display {
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.week-bar {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.5rem;
}

.week-day {
    text-align: center;
    padding: 0.5rem;
    border-radius: 6px;
    color: inherit;
}

.week-day.weekend {
    background: var(--color-week-weekend);
}

.week-day:hover {
    background: var(--color-week-hover);
}

.week-day.weekend:hover {
    background: var(--color-week-weekend-hover);
}

.week-day.selected {
    background: var(--color-week-selected);
    font-weight: 700;
}

.week-day.weekend.selected {
    background: var(--color-week-selected-strong);
}

.week-day.today .week-label,
.week-day.today .week-date {
    color: var(--color-primary);
}

.week-label {
    display: inline;
    font-size: 0.75rem;
    color: var(--color-muted);
    text-transform: uppercase;
}

.week-date {
    display: inline;
    margin-left: 0.25rem;
    font-size: 0.75rem;
    color: var(--color-muted);
    font-variant-numeric: tabular-nums;
}

.week-hours {
    display: block;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.week-hours.is-zero {
    display: block;
    color: var(--color-zero);
    font-weight: 500;
}

.week-day.selected .week-hours.is-zero {
    color: var(--color-zero-on-selected);
}

.week-total {
    text-align: center;
    padding: 0.5rem;
    border-left: 1px solid var(--color-border);
}

.week-amount {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--color-primary);
}

.week-day .week-amount {
    font-size: 0.75rem;
}

.is-zero {
    display: none;
}

.day-layout {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.track-time-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    border: none;
    background: var(--color-primary);
    color: #fff;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.track-time-btn svg {
    display: block;
}

.track-time-btn:hover {
    background: var(--color-primary-hover);
}

.entries-list {
    flex: 1;
}

.entries-tree {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tree-node {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: var(--shadow);
}

.tree-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    cursor: pointer;
    list-style: none;
}

.tree-summary::-webkit-details-marker {
    display: none;
}

.tree-summary::before {
    content: '▸';
    flex-shrink: 0;
    margin-right: 0.35rem;
    color: var(--color-muted);
    transition: transform 0.15s ease;
}

.tree-node[open] > .tree-summary::before {
    transform: rotate(90deg);
}

.tree-task-single > .tree-summary::before {
    opacity: 0.35;
}

.tree-client > .tree-summary {
    background: var(--color-client-header-bg);
}

.tree-client.has-client-color > .tree-summary {
    background: var(--client-color);
}

.tree-client-summary .tree-client-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
}

.tree-client-icon {
    display: inline-flex;
    flex-shrink: 0;
    color: var(--color-muted);
    margin-top: 4px;
}

.tree-client-icon svg {
    display: block;
}

.tree-client-summary .tree-client-name {
    flex: 1 1 auto;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text);
    padding-right: 0;
}

.tree-client-children {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem 0.75rem;
    border-top: 1px solid var(--color-border);
}

.tree-client-children > .tree-node {
    box-shadow: none;
}

.tree-client-children > details:has(.tree-entries .entry-card:not(.entry-other-user)) {
    background: var(--color-own-entry-bg);
    border-radius: var(--radius);
}

.tree-client-children > details.tree-task-non-billable {
    background: var(--color-non-billable-bg) !important;
    border-radius: var(--radius);
}

.tree-client-name {
    flex: 0 0 7rem;
    padding-right: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-muted);
    line-height: 1.3;
}

.tree-summary-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.tree-summary-main .project-title-row {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.tree-project-icon {
    display: inline-flex;
    flex-shrink: 0;
    color: var(--color-muted);
}

.tree-project-icon svg {
    display: block;
}

.tree-summary-main .project-title {
    color: var(--color-muted);
    font-size: 0.85rem;
}

.tree-summary-main .task-title-row {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.tree-task-icon {
    display: inline-flex;
    flex-shrink: 0;
    color: var(--color-muted);
}

.tree-task-icon svg {
    display: block;
}

.tree-summary-main .task-title {
    font-weight: 700;
    color: var(--color-text);
}

.tree-meta {
    color: var(--color-muted);
    font-size: 0.85rem;
}

.tree-task-note {
    color: var(--color-muted);
    font-size: 0.85rem;
    font-style: italic;
}

.tree-summary-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}

.tree-totals {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-variant-numeric: tabular-nums;
}

.tree-hours {
    font-weight: 600;
    font-size: 0.9rem;
}

.tree-amount {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-primary);
}

.tree-entries {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 0.75rem 0.75rem 1.5rem;
    border-top: 1px solid var(--color-border);
}

.tree-entries .entry-card {
    margin-bottom: 0;
    padding: 0.75rem 1rem;
    box-shadow: none;
    background: var(--color-entry-nested-bg);
}

.entry-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow);
}

.entry-card.running {
    border-left: 4px solid var(--color-primary);
}

.entry-card.locked {
    opacity: 0.85;
    background: var(--color-entry-locked-bg);
}

.entry-card.entry-other-user {
    background: var(--color-entry-other-bg);
    border-color: var(--color-border);
    color: var(--color-muted);
    opacity: 0.72;
}

.entry-card.entry-other-user.running {
    border-left-color: var(--color-muted);
}

body:not(.role-admin) .tree-task-other-user > .tree-summary {
    opacity: 0.30;
}

.tree-entry-user {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--color-user-chip-bg);
    color: var(--color-user-chip-text);
    white-space: nowrap;
}

.task-title-row .tree-entry-user {
    align-self: center;
}

.entry-note {
    margin: 0.35rem 0 0;
    color: var(--color-muted);
    font-size: 0.9rem;
}

.entry-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.entry-metrics {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
    min-width: 5.5rem;
}

.start-stop-elapsed {
    font-size: 0.8rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--color-muted);
    white-space: nowrap;
}

.entry-duration {
    font-size: 1.1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.entry-amount {
    font-size: 0.9rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--color-primary);
}

.day-total {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 1rem 0;
    border-top: 2px solid var(--color-border);
    font-size: 1.1rem;
}

.day-total-values {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
}

.day-total-amount {
    font-size: 1rem;
    color: var(--color-primary);
}

.empty-state {
    color: var(--color-muted);
    padding: 2rem;
    text-align: center;
}

.modal[hidden] {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.modal-content {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.modal-content.help-modal-content {
    max-width: min(1280px, calc(100vw - 1rem));
    max-height: calc(100vh - 1rem);
    width: min(1280px, calc(100vw - 1rem));
    height: calc(100vh - 1rem);
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.help-modal-toolbar {
    display: flex;
    justify-content: flex-end;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.help-modal-body {
    overflow: auto;
    padding: 1.25rem 1.5rem 1.5rem;
    flex: 1 1 auto;
}

.help-html {
    margin-bottom: 1.5rem;
}

.help-html > :first-child {
    margin-top: 0;
}

.help-diagram {
    display: block;
    width: 100%;
    max-width: 1200px;
    height: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.track-task-choice {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface-muted);
    padding: 0.75rem;
}

.track-task-mode {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin: 0 0 0.75rem;
    padding: 0;
    border: none;
}

.track-task-mode[hidden] {
    display: none;
}

.track-task-mode-option {
    margin: 0;
    font-weight: 600;
}

.track-task-section label {
    margin: 0;
}

.track-task-section[hidden] {
    display: none;
}

.track-task-section.is-muted {
    opacity: 0.5;
}

.track-task-section.is-active .track-task-field-label {
    font-weight: 600;
}

.track-task-choice:has(#track-task-mode:not([hidden])) .track-task-field-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.split-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 1.5rem;
}

.sidebar-list ul {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
}

.sidebar-list li {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
    background-color: var(--color-surface);
}

.sidebar-list li + li {
    margin-top: 0.35rem;
}

.sidebar-list li.sidebar-client-group {
    border: none;
    border-radius: 0;
    overflow: visible;
    background: transparent;
}

.sidebar-list li.sidebar-client-group + li.sidebar-client-group {
    margin-top: 0.85rem;
}

.sidebar-client-group-heading {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.55rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: #fff;
    background: var(--color-sidebar-heading-bg);
    border-radius: 6px;
}

.sidebar-client-group-heading .tree-client-icon {
    color: #fff;
}

.sidebar-client-group-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-client-projects {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-list ul.sidebar-client-projects {
    margin: 0;
}

.sidebar-list li.sidebar-add-item {
    margin-top: 50px;
}

.sidebar-filter {
    margin: 0.75rem 0 1rem;
}

.sidebar-filter label {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
}

.sidebar-filter select {
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font: inherit;
}

.sidebar-list .sidebar-add-btn {
    width: 100%;
    justify-content: center;
}

.sidebar-list li a:not(.sidebar-add-btn) {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
}

.sidebar-client-label {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.5rem;
    min-width: 0;
}

.sidebar-client-color {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 2px;
    flex-shrink: 0;
    margin-top: 0.35rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.color-picker-fieldset {
    border: none;
    padding: 0;
    margin: 0 0 1rem;
}

.color-picker-fieldset legend {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.color-picker-option {
    position: relative;
    display: inline-flex;
    margin: 0;
    cursor: pointer;
}

.color-picker-option input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

.color-swatch {
    display: block;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 4px;
    border: 2px solid transparent;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.color-swatch-none {
    background:
        linear-gradient(to top right, transparent calc(50% - 1px), var(--color-muted) 50%, transparent calc(50% + 1px)),
        var(--color-surface);
    box-shadow: inset 0 0 0 1px var(--color-border);
}

.color-picker-option input:focus-visible + .color-swatch {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.color-picker-option input:checked + .color-swatch {
    border-color: var(--color-text);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.sidebar-client-project-count,
.sidebar-project-task-count {
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--color-muted);
}

.sidebar-list li a.sidebar-project-link {
    align-items: center;
}

.sidebar-project-link .tree-project-icon {
    flex-shrink: 0;
    color: var(--color-muted);
}

.sidebar-project-name {
    min-width: 0;
    flex: 1 1 auto;
}

.sidebar-list li a:not(.sidebar-add-btn).active .tree-project-icon {
    color: rgba(255, 255, 255, 0.9);
}

.sidebar-list li a:not(.sidebar-add-btn) .badge {
    margin-left: auto;
    flex-shrink: 0;
}

.sidebar-list li a:not(.sidebar-add-btn).active .tree-client-icon {
    color: rgba(255, 255, 255, 0.9);
}

.sidebar-list li a:not(.sidebar-add-btn).active .sidebar-client-project-count,
.sidebar-list li a:not(.sidebar-add-btn).active .sidebar-project-task-count {
    color: rgba(255, 255, 255, 0.85);
}

.sidebar-list li a:not(.sidebar-add-btn):hover {
    background: var(--color-surface-soft);
}

.sidebar-list li a:not(.sidebar-add-btn).active {
    background: var(--color-accent);
    color: var(--color-on-accent);
}

.sidebar-list li a:not(.sidebar-add-btn).active:hover {
    background: var(--color-link-hover);
    color: var(--color-on-accent);
}

.client-project-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.client-project-list li + li {
    border-top: 1px solid var(--color-border);
}

.client-project-list a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0;
    font-weight: 500;
}

.user-access-list a {
    justify-content: space-between;
}

.user-access-list .sidebar-client-label {
    min-width: 0;
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.entry-task-entries {
    margin-top: 1.5rem;
}

.entry-task-entries .data-table tr.is-current-entry td {
    background: var(--color-own-entry-bg);
    font-weight: 600;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.data-table th,
.data-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    vertical-align: top;
}

.data-table tfoot th {
    font-weight: 700;
    border-top: 2px solid var(--color-border);
    text-wrap: nowrap;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    background: var(--color-surface-soft);
    font-size: 0.75rem;
    color: var(--color-muted);
}

.badge-muted {
    background: var(--color-border);
}

.badge-admin {
    background: var(--color-alert-error-bg);
    color: var(--color-alert-error-text);
}

.inline-form {
    display: inline-block;
    margin-top: 1rem;
}

.inline-edit-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.data-table .task-month-hours,
.data-table .task-total-hours {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.data-table td input[type="text"],
.data-table td textarea {
    width: 100%;
    min-width: 0;
}

.task-title-cell {
    padding-bottom: 0.35rem;
    border-bottom: none;
}

.task-title-cell .task-title-input {
    display: block;
    width: 100%;
    font-size: 1.15rem;
    font-weight: 700;
    padding: 0.55rem 0.7rem;
}

.project-tasks-table .task-details-row td {
    border-top: none;
    padding-top: 0.35rem;
}

.project-tasks-table .task-details-row + .task-title-row td {
    border-top: 1px solid var(--color-border);
    padding-top: 0.85rem;
}

.task-row-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    flex-wrap: nowrap;
    border-bottom: none !important;
}

.danger-zone {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.duration-inputs {
    display: flex;
    gap: 1rem;
}

.duration-inputs label {
    flex: 1;
}

.report-header {
    margin-bottom: 1rem;
}

.report-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.report-nav h1 {
    margin: 0;
    font-size: 1.35rem;
}

.report-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.report-export {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
}

.report-export-format {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0;
    font-size: 0.9rem;
}

.report-export-format select {
    cursor: pointer;
}

.report-filters.form-stack {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    flex: 1 1 auto;
}

.report-filters.form-stack label {
    margin-bottom: 0;
}

.report-filters.form-stack select {
    cursor: pointer;
    background-color: var(--color-surface);
    min-width: 8rem;
}

.report-filter-month select {
    min-width: 11rem;
}

.report-filter-year select {
    min-width: 7rem;
}

.report-filter-user select {
    min-width: 14rem;
}

.report-filter-active {
    padding-bottom: 0.6rem;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
}

.summary-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.summary-label,
.summary-detail {
    display: block;
    color: var(--color-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.report-tabs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.report-tabs .tab {
    padding: 0.5rem 1rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.report-tabs .tab.active {
    color: var(--color-text);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}

.day-expand-all {
    margin-left: auto;
    margin-bottom: 0;
    padding: 0.35rem 0.25rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

.report-expand-all {
    margin-left: auto;
    margin-bottom: 0;
    padding: 0.35rem 0.25rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

.report-table {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.report-table tr.has-client-color > td {
    background-color: var(--client-color);
}

.report-pie-section {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.report-pie-title {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.report-pie-layout {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.75rem;
}

.report-pie {
    width: 14rem;
    height: 14rem;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow);
}

.report-pie-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 12rem;
    flex: 1 1 14rem;
}

.report-pie-legend li {
    display: grid;
    grid-template-columns: 0.85rem 1fr auto;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.92rem;
}

.report-pie-swatch {
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    flex-shrink: 0;
}

.report-pie-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-pie-percent {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--color-muted);
}

.report-project-name {
    font-weight: 600;
}

.report-expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    margin-right: 0.15rem;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--color-muted);
    cursor: pointer;
    vertical-align: middle;
}

.report-expand-btn:hover {
    background: var(--color-surface-soft);
    color: var(--color-text);
}

.report-expand-icon {
    display: block;
    font-size: 1.1rem;
    line-height: 1;
    transition: transform 0.15s ease;
}

.report-expand-btn.is-expanded .report-expand-icon {
    transform: rotate(90deg);
}

.report-task-row td {
    background: var(--color-report-task-bg);
    font-size: 0.92rem;
}

.report-task-row.report-task-row-non-billable td {
    background: var(--color-report-nonbillable-bg);
}

.report-log-row.report-task-row-non-billable:not(.has-client-color) td {
    background: var(--color-report-nonbillable-bg);
}

.report-log-table .report-log-task-cell {
    padding-left: 0.75rem !important;
    font-weight: 500;
}

.report-log-table .report-log-start {
    white-space: nowrap;
    text-wrap: nowrap;
}

.report-task-cell {
    padding-left: 2.25rem !important;
    font-weight: 500;
}

.report-task-note {
    margin-top: 0.25rem;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--color-muted);
    white-space: pre-wrap;
}

.meta {
    color: var(--color-muted);
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .week-bar {
        grid-template-columns: repeat(4, 1fr);
    }

    .week-total {
        grid-column: span 4;
        border-left: none;
        border-top: 1px solid var(--color-border);
    }

    .split-layout {
        grid-template-columns: 1fr;
    }

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

    .entry-card {
        flex-direction: column;
    }
}

section h2 {
    margin-top:0;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
}

.theme-toggle:hover {
    background: var(--color-surface-soft);
    color: var(--color-link-hover);
}

.theme-toggle svg {
    display: block;
    width: 1.1rem;
    height: 1.1rem;
}

html[data-theme="dark"] .theme-icon-moon,
html:not([data-theme="dark"]) .theme-icon-sun {
    display: none;
}

.login-theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
}

html[data-theme="dark"] .report-table tr.has-client-color > td,
html[data-theme="dark"] .tree-client.has-client-color > .tree-summary {
    color: #1a202c;
}

html[data-theme="dark"] .tree-client-name,
html[data-theme="dark"] .tree-client-summary .tree-client-name {
    color: #1a202c;
}

html[data-theme="dark"] .report-table tr.has-client-color > td a,
html[data-theme="dark"] .tree-client.has-client-color > .tree-summary a {
    color: #2c5282;
}
