/* ── Design tokens ─────────────────────────────────────── */
:root {
    color-scheme: light;
    --bg: #f4f0eb;
    --surface: rgba(255, 255, 255, 0.72);
    --surface-strong: #fffcf7;
    --surface-hover: rgba(255, 255, 255, 0.88);
    --text: #1a1714;
    --text-secondary: #64594d;
    --muted: #8a7e72;
    --line: rgba(23, 20, 17, 0.08);
    --line-strong: rgba(23, 20, 17, 0.14);
    --accent: #0f7b57;
    --accent-hover: #0a6346;
    --accent-soft: rgba(15, 123, 87, 0.10);
    --accent-glow: rgba(15, 123, 87, 0.06);
    --danger: #c0392b;
    --danger-soft: rgba(192, 57, 43, 0.08);
    --warning: #e67e22;
    --success: #27ae60;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
    --radius-sm: 12px;
    --radius: 16px;
    --radius-lg: 24px;
    --radius-xl: 28px;
    --radius-full: 999px;
    --blur: blur(20px);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
}

/* ── Reset & base ──────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 0% 0%, rgba(15, 123, 87, 0.07), transparent 50%),
        radial-gradient(ellipse at 100% 100%, rgba(230, 126, 34, 0.04), transparent 50%),
        var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, textarea, select {
    font: inherit;
}

/* ── Form controls ─────────────────────────────────────── */
input, textarea, select {
    width: 100%;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.65);
    padding: 0.75rem 1rem;
    box-sizing: border-box;
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    backdrop-filter: var(--blur);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background: rgba(255, 255, 255, 0.85);
}

input::placeholder, textarea::placeholder {
    color: var(--muted);
}

textarea {
    min-height: 6rem;
    resize: vertical;
}

.valid.modified:not([type=checkbox]) {
    border-color: rgba(39, 174, 96, 0.5);
}

.invalid {
    border-color: rgba(192, 57, 43, 0.5);
    box-shadow: 0 0 0 3px var(--danger-soft);
}

.validation-message, .form-error {
    color: var(--danger);
    font-size: 0.88rem;
    margin-top: 0.35rem;
}

/* ── App shell ─────────────────────────────────────────── */
#app {
    min-height: 100vh;
}

.app-shell {
    padding: 1.25rem 1.25rem 6rem;
    max-width: 1440px;
    margin: 0 auto;
}

/* ── Header ────────────────────────────────────────────── */
.app-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}

.app-header h1,
.page-header h2,
.summary-panel h3,
.login-panel h2,
.record-item h3 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.25;
}

.app-header h1 {
    max-width: 34rem;
    font-size: clamp(1.35rem, 2vw, 1.85rem);
    color: var(--text);
}

.app-header .eyebrow {
    margin-bottom: 0.25rem;
}

/* ── Eyebrow label ─────────────────────────────────────── */
.eyebrow {
    margin: 0 0 0.45rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: "IBM Plex Mono", monospace;
}

/* ── Action rows ───────────────────────────────────────── */
.header-actions,
.record-actions,
.section-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.record-actions {
    margin-top: 1rem;
}

/* ── Buttons ───────────────────────────────────────────── */
.ghost-button, .primary-button {
    border: 0;
    border-radius: var(--radius-full);
    padding: 0.65rem 1.15rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.ghost-button {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1.5px solid var(--line-strong);
    backdrop-filter: var(--blur);
}

.ghost-button:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.primary-button {
    background: var(--accent);
    color: white;
    box-shadow: var(--shadow-sm);
}

.primary-button:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.primary-button:active {
    transform: translateY(0);
}

.primary-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.danger-button {
    border: 0;
    border-radius: var(--radius-full);
    padding: 0.65rem 1.15rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition);
    background: transparent;
    color: var(--danger);
    border: 1.5px solid var(--danger-soft);
}

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

/* ── Sync badge ────────────────────────────────────────── */
.sync-badge, .pending-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: var(--radius-full);
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 500;
    border: 1.5px solid var(--line);
    background: var(--surface);
    backdrop-filter: var(--blur);
}

.sync-badge::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sync-badge.online {
    color: var(--success);
    border-color: rgba(39, 174, 96, 0.2);
}

.sync-badge.online::before {
    background: var(--success);
    box-shadow: 0 0 6px rgba(39, 174, 96, 0.4);
}

.sync-badge.offline {
    color: var(--danger);
    border-color: rgba(192, 57, 43, 0.2);
}

.sync-badge.offline::before {
    background: var(--danger);
    box-shadow: 0 0 6px rgba(192, 57, 43, 0.4);
}

.pending-tag {
    color: var(--warning);
    border-color: rgba(230, 126, 34, 0.25);
    background: rgba(230, 126, 34, 0.06);
    font-size: 0.75rem;
}

/* ── Layout: sidebar + workspace ───────────────────────── */
.app-frame {
    display: grid;
    grid-template-columns: 14.5rem minmax(0, 1fr);
    gap: 1.5rem;
}

.side-nav {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: 0.75rem;
    box-shadow: var(--shadow);
    backdrop-filter: var(--blur);
    height: fit-content;
    position: sticky;
    top: 1.25rem;
}

.nav-group {
    display: grid;
    gap: 0.2rem;
}

.nav-group + .nav-group {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--line);
}

.nav-group-title {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.35rem 0.75rem;
}

.side-nav a, .bottom-nav a {
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.92rem;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.side-nav a:hover {
    background: var(--accent-glow);
    color: var(--text);
}

.side-nav a.active, .bottom-nav a.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.workspace {
    min-width: 0;
}

/* ── Bottom nav (mobile) ───────────────────────────────── */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 0.5rem;
    overflow-x: auto;
    white-space: nowrap;
    gap: 0.25rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.bottom-nav::-webkit-scrollbar {
    display: none;
}

.bottom-nav a {
    display: inline-flex;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary, #888);
    text-decoration: none;
    background: transparent;
    border: 1px solid var(--line);
    transition: all var(--transition);
    flex-shrink: 0;
}

.bottom-nav a:hover,
.bottom-nav a.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ── Page & panels ─────────────────────────────────────── */
.page, .login-page {
    display: grid;
    gap: 1.25rem;
    animation: pageIn 0.3s ease-out;
}

@keyframes pageIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header, .summary-panel, .login-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    backdrop-filter: var(--blur);
    transition: box-shadow var(--transition);
}

.summary-panel:hover {
    box-shadow: var(--shadow-lg);
}

.summary-panel.full-width {
    grid-column: 1 / -1;
}

.section-copy {
    margin: 0.4rem 0 0;
    color: var(--text-secondary);
    max-width: 48rem;
    line-height: 1.55;
}

/* ── Summary grid ──────────────────────────────────────── */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 1rem;
}

.summary-grid .summary-panel {
    position: relative;
    overflow: hidden;
}

.summary-grid .summary-panel::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.summary-grid .summary-panel:hover::after {
    opacity: 1;
}

.summary-grid .summary-panel h3 {
    font-size: 1.35rem;
    margin-bottom: 0.15rem;
}

.summary-grid .summary-panel p {
    margin: 0.2rem 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ── Charts ────────────────────────────────────────────── */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.chart, .chart-empty {
    min-height: 14rem;
}

.chart-empty {
    display: grid;
    place-items: center;
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    color: var(--muted);
    font-size: 0.9rem;
    padding: 1rem;
}

.chart-bars {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(3rem, 1fr));
    gap: 0.8rem;
    align-items: end;
}

.chart-bar {
    min-height: 14rem;
    display: grid;
    grid-template-rows: 1fr auto auto;
    gap: 0.4rem;
    align-items: end;
}

.chart-bar-fill {
    background: linear-gradient(180deg, rgba(15, 123, 87, 0.35) 0%, var(--accent) 100%);
    border-radius: var(--radius) var(--radius) 6px 6px;
    transition: height var(--transition-slow);
}

.chart-bar-value, .chart-bar-label, .trend-chart-labels {
    font-size: 0.78rem;
    color: var(--muted);
    text-align: center;
}

.chart-bar-value {
    font-weight: 600;
    color: var(--text-secondary);
}

.trend-chart {
    display: grid;
    gap: 0.75rem;
}

.trend-chart svg {
    width: 100%;
    height: 13rem;
    background: rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
}

.trend-chart polyline {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.trend-chart-labels {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
}

/* ── Forms ─────────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.form-grid.three-up {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid label, .inline-field {
    display: grid;
    gap: 0.35rem;
}

.form-grid label > span, .inline-field > span {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.wide-field {
    grid-column: 1 / -1;
}

.exercise-editor {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}

.catalog-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.8rem;
    align-items: end;
}

.exercise-row {
    display: grid;
    grid-template-columns: 2fr repeat(3, minmax(0, 1fr)) auto;
    gap: 0.6rem;
    margin-top: 0.7rem;
    padding: 0.75rem;
    background: var(--accent-glow);
    border-radius: var(--radius-sm);
}

/* ── Pills ─────────────────────────────────────────────── */
.pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-full);
    border: 1.5px solid var(--line);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--transition);
}

.pill:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Record list ───────────────────────────────────────── */
.record-list {
    display: grid;
    gap: 0.5rem;
}

.record-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--radius);
    transition: background var(--transition);
    border: 1px solid transparent;
}

.record-item:hover {
    background: var(--accent-glow);
    border-color: var(--line);
}

.record-item + .record-item {
    border-top: 1px solid var(--line);
}

.record-item:hover + .record-item {
    border-top-color: transparent;
}

.record-item h3 {
    font-size: 1rem;
}

.record-item p {
    margin: 0.2rem 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.record-item .record-actions {
    margin-top: 0;
    flex-shrink: 0;
    align-self: center;
    opacity: 0.5;
    transition: opacity var(--transition);
}

.record-item:hover .record-actions {
    opacity: 1;
}

/* ── Pagination ────────────────────────────────────────── */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: center;
    align-items: center;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.pagination button {
    min-width: 2.2rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
}

/* ── Text link ─────────────────────────────────────────── */
.text-link {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.5rem;
    transition: gap var(--transition);
}

.text-link:hover {
    gap: 0.5rem;
}

.text-link::after {
    content: "\2192";
    font-size: 1rem;
}

/* ── Login ─────────────────────────────────────────────── */
.login-page {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    background: var(--bg);
    padding: 1.5rem;
    overflow-y: auto;
}

.login-panel {
    width: min(100%, 28rem);
    box-shadow: var(--shadow-lg);
}

.login-panel h2 {
    font-size: 1.5rem;
}

.login-panel .form-grid {
    grid-template-columns: 1fr;
    margin: 1rem 0;
}

.login-panel .primary-button {
    width: 100%;
    justify-content: center;
    padding: 0.85rem;
    font-size: 1rem;
}

.seeded-accounts {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.85rem;
}

.seeded-accounts h3 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.seeded-accounts p {
    margin: 0.25rem 0;
}

.seeded-accounts code {
    background: var(--accent-glow);
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    font-size: 0.82rem;
}

/* ── Empty states ──────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.4;
}

/* ── Blazor infrastructure ─────────────────────────────── */
#blazor-error-ui {
    background: #fff7d2;
    border-top: 1px solid rgba(23, 20, 17, 0.1);
    bottom: 0;
    display: none;
    left: 0;
    padding: 0.8rem 1rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-size: 0.9rem;
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: rgba(23, 20, 17, 0.08);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--accent);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    color: var(--muted);
    inset: calc(20vh + 3.25rem) 0 auto 0;
    font-family: "Space Grotesk", sans-serif;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* ── Sparkline ─────────────────────────────────────────── */
.sparkline {
    width: 100%;
    height: 2.5rem;
    margin-top: 0.5rem;
}

.sparkline polyline {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    opacity: 0.6;
}

/* ── Dark theme ────────────────────────────────────────── */
[data-theme="dark"] {
    --bg: #141210;
    --surface: rgba(30, 28, 25, 0.85);
    --surface-strong: #1e1c19;
    --surface-hover: rgba(40, 38, 35, 0.9);
    --text: #e8e2d9;
    --text-secondary: #a89e92;
    --muted: #7a7068;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.14);
    --accent: #2dd4a0;
    --accent-hover: #22b888;
    --accent-soft: rgba(45, 212, 160, 0.12);
    --accent-glow: rgba(45, 212, 160, 0.06);
    --danger: #e74c3c;
    --danger-soft: rgba(231, 76, 60, 0.1);
    --warning: #f39c12;
    --success: #2ecc71;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] body {
    background:
        radial-gradient(ellipse at 0% 0%, rgba(45, 212, 160, 0.04), transparent 50%),
        radial-gradient(ellipse at 100% 100%, rgba(243, 156, 18, 0.03), transparent 50%),
        var(--bg);
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: rgba(30, 28, 25, 0.65);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    background: rgba(40, 38, 35, 0.85);
}

/* ── Search input ──────────────────────────────────────── */
.search-input {
    margin-bottom: 0.75rem;
}

/* ── Responsive: tablet ────────────────────────────────── */
@media (max-width: 1024px) {
    .app-frame {
        grid-template-columns: 1fr;
    }

    .side-nav {
        display: none;
    }

    .bottom-nav {
        display: flex;
    }

    .chart-grid,
    .form-grid.three-up,
    .catalog-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .exercise-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ── Responsive: mobile ────────────────────────────────── */
@media (max-width: 700px) {
    .app-shell {
        padding: 0.85rem 0.85rem 5.5rem;
    }

    .workspace {
        padding-bottom: 4rem;
    }

    .app-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .app-header h1 {
        font-size: 1.25rem;
    }

    .record-item {
        flex-direction: column;
        gap: 0.75rem;
    }

    .record-item .record-actions {
        opacity: 1;
    }

    .section-row {
        flex-direction: column;
        align-items: stretch;
    }

    .summary-grid,
    .chart-grid,
    .form-grid,
    .form-grid.three-up,
    .catalog-form,
    .exercise-row {
        grid-template-columns: 1fr;
    }

    .page-header, .summary-panel, .login-panel {
        border-radius: var(--radius-lg);
        padding: 1.1rem;
    }

    .exercise-row {
        padding: 0.5rem;
    }
}

/* ── Scrollbar styling ─────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

/* ── Selection ─────────────────────────────────────────── */
::selection {
    background: var(--accent-soft);
    color: var(--text);
}

/* ── Progress bar ──────────────────────────────────────── */
.progress-bar { height: 6px; border-radius: 3px; background: var(--line); margin-top: 0.5rem; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1); }
.progress-bar-fill.over-limit { background: var(--danger); }

/* ── Calendar ───────────────────────────────────────────── */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.5rem;
    color: var(--text-secondary, #888);
}

.calendar-day {
    aspect-ratio: 1;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    min-height: 60px;
}

.calendar-day:hover {
    box-shadow: var(--shadow);
    border-color: var(--accent);
}

.calendar-day.today {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.calendar-day.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}

.calendar-day.empty {
    background: transparent;
    border-color: transparent;
    cursor: default;
}

.calendar-day.empty:hover {
    box-shadow: none;
    border-color: transparent;
}

.calendar-dots {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    margin-top: auto;
}

.calendar-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.calendar-nav h3 {
    min-width: 200px;
    text-align: center;
    margin: 0;
}

.calendar-detail {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--line);
}

.calendar-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.calendar-detail-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.calendar-detail-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Weekly report delta indicators */
.week-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.week-label {
    font-weight: 600;
    font-size: 1rem;
}

.delta-positive { color: #00b894; font-weight: 600; }
.delta-negative { color: #ff6b6b; font-weight: 600; }
.delta-neutral { color: var(--text-secondary, #888); }
