/* ===== rows.life Design System ===== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@300;400;500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    /* Colors */
    --crimson: #C41E3A;
    --crimson-muted: rgba(196, 30, 58, 0.25);
    --bg-page: #FAFAF7;
    --bg-dark: #0F0F0F;
    --bg-surface: #1A1A1A;
    --border: #E0E0E0;
    --green: #22C55E;
    --blue: #3B82F6;
    --purple: #8B5CF6;

    --text-primary: #0F0F0F;
    --text-secondary: #666666;
    --text-muted: #999999;
    --text-light: #FAFAF7;

    /* Fonts */
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', monospace;

    /* Sheet */
    --row-height: 36px;
    --day-even-bg: #FFFFFF;
    --day-odd-bg: #F5F5F2;
    --day-odd-border: #E8E8E4;
    --stats-bg: #F7F7F4;
}

/* ===== Reset & Base ===== */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: var(--font-ui);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

h1, h2, h3, h4 {
    outline: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    border: none;
    outline: none;
    background: transparent;
}

/* ===== App Shell (authenticated) ===== */

.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 72px;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    flex-shrink: 0;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: var(--crimson);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.sidebar-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}

.sidebar-icon:hover {
    color: var(--text-light);
    background: var(--bg-surface);
}

.sidebar-icon.active {
    color: var(--text-light);
    background: var(--bg-surface);
}

.sidebar-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.app-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* ===== Landing Page ===== */

.landing {
    min-height: 100vh;
    background: var(--bg-page);
}

.landing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 56px;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-mark {
    width: 32px;
    height: 32px;
    background: var(--crimson);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.logo-mark svg {
    width: 16px;
    height: 16px;
}

.logo-letter {
    font-family: var(--font-display);
    font-weight: 600;
    color: white;
    line-height: 1;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -1px;
    color: var(--text-primary);
}

.landing-nav {
    display: flex;
    align-items: center;
    gap: 32px;
}

.landing-nav a {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.15s;
}

.landing-nav a:hover {
    color: var(--text-primary);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-dark);
    color: var(--text-light);
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    transition: opacity 0.15s;
}

.btn-primary:hover,
.landing-nav a.btn-primary:hover {
    opacity: 0.9;
    color: var(--text-light);
}

.btn-crimson {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--crimson);
    color: var(--text-light);
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    transition: opacity 0.15s;
}

.btn-crimson:hover {
    opacity: 0.9;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: border-color 0.15s;
}

.btn-outline:hover {
    border-color: var(--text-muted);
}

.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 80px 120px;
    gap: 32px;
}

.hero-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--crimson);
    text-transform: uppercase;
}

.hero-title {
    font-family: var(--font-display);
    font-size: 64px;
    font-weight: 500;
    letter-spacing: -2px;
    text-align: center;
    color: var(--text-primary);
    max-width: 900px;
    line-height: 1.1;
}

.hero-sub {
    font-size: 16px;
    line-height: 1.6;
    text-align: center;
    color: var(--text-secondary);
    max-width: 600px;
}

.hero-ctas {
    display: flex;
    gap: 16px;
    align-items: center;
}

.screenshot-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 80px 80px;
}

.screenshot-hero {
    max-width: 720px;
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 24px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.screenshot-hero:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.screenshot-placeholder {
    width: 100%;
    max-width: 1100px;
    height: 500px;
    background: #F0F0ED;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
}

.screenshot-placeholder span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.landing-divider {
    height: 1px;
    background: var(--border);
}

.section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--crimson);
    text-transform: uppercase;
}

/* How It Works */

.how-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 80px 56px;
    gap: 48px;
}

.section-title {
    font-family: var(--font-display);
    font-size: 48px;
    font-weight: 500;
    letter-spacing: -2px;
    color: var(--text-primary);
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    width: 100%;
}

.step-card {
    padding: 32px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.step-num {
    font-family: var(--font-display);
    font-size: 48px;
    font-weight: 300;
    color: var(--crimson-muted);
}

.step-title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 500;
    letter-spacing: -1px;
    color: var(--text-primary);
}

.step-desc {
    font-size: 13px;
    line-height: 1.6;
    flex: 1;
}

.step-thumb {
    width: 100%;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.step-thumb:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.step-thumb-placeholder {
    width: 100%;
    height: 100px;
    background: #F0F0ED;
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    cursor: pointer;
    padding: 40px;
}

.lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: white;
    cursor: pointer;
    line-height: 1;
}

/* Privacy Section */

.privacy-section {
    display: flex;
    align-items: center;
    padding: 80px 56px;
    gap: 64px;
    background: #F4F4F0;
}

.privacy-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.privacy-title {
    font-family: var(--font-display);
    font-size: 40px;
    font-weight: 500;
    letter-spacing: -2px;
    color: var(--text-primary);
}

.privacy-desc {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.privacy-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.privacy-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.privacy-item svg {
    width: 20px;
    height: 20px;
    color: var(--crimson);
    flex-shrink: 0;
}

.privacy-item span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Features Section */

.features-section {
    padding: 80px 56px;
    display: flex;
    flex-direction: column;
    gap: 48px;
}

.features-title {
    font-family: var(--font-display);
    font-size: 48px;
    font-weight: 500;
    letter-spacing: -2px;
    color: var(--text-primary);
    max-width: 700px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
}

.feature-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feature-item svg {
    width: 24px;
    height: 24px;
    color: var(--crimson);
}

.feature-item h4 {
    font-size: 14px;
    font-weight: 600;
}

.feature-item p {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Final CTA */

.final-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 120px 80px 60px;
    gap: 32px;
    background: var(--bg-dark);
}

.final-cta-title {
    font-family: var(--font-display);
    font-size: 48px;
    font-weight: 500;
    letter-spacing: -2px;
    color: var(--text-light);
    text-align: center;
    max-width: 700px;
}

.final-cta-sub {
    font-size: 16px;
    color: var(--text-muted);
    text-align: center;
}

/* Footer */

.landing-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 56px;
    background: var(--bg-dark);
    border-top: 1px solid #444;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-logo {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 500;
    color: #999;
}

.footer-copyright {
    font-size: 12px;
    color: #666;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.footer-right a {
    font-size: 12px;
    color: #888;
    transition: color 0.15s;
}

.footer-right a:hover {
    color: #ccc;
}

/* ===== Landing Page — Mobile ===== */

@media (max-width: 768px) {
    /* Header: hamburger-free — stack nav below logo */
    .landing-header {
        padding: 12px 20px;
        flex-wrap: wrap;
        gap: 12px;
    }

    .landing-nav {
        gap: 16px;
        width: 100%;
        justify-content: flex-end;
    }

    .landing-nav a {
        font-size: 12px;
    }

    /* Hero: smaller text, less padding */
    .hero {
        padding: 48px 20px;
        gap: 24px;
    }

    .hero-title {
        font-size: 36px;
        letter-spacing: -1px;
    }

    .hero-sub {
        font-size: 14px;
    }

    .hero-ctas {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    .hero-ctas .btn-crimson,
    .hero-ctas .btn-outline {
        width: 100%;
        justify-content: center;
    }

    /* Screenshot */
    .screenshot-section {
        padding: 0 20px 48px;
    }

    /* How It Works: single column */
    .how-section {
        padding: 48px 20px;
        gap: 32px;
    }

    .section-title {
        font-size: 30px;
        letter-spacing: -1px;
        text-align: center;
    }

    .steps-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .step-card {
        padding: 24px;
    }

    .step-num {
        font-size: 36px;
    }

    .step-title {
        font-size: 24px;
    }

    /* Privacy: stack vertically */
    .privacy-section {
        flex-direction: column;
        padding: 48px 20px;
        gap: 32px;
    }

    .privacy-title {
        font-size: 30px;
        letter-spacing: -1px;
    }

    /* Features: single column */
    .features-section {
        padding: 48px 20px;
        gap: 32px;
    }

    .features-title {
        font-size: 30px;
        letter-spacing: -1px;
    }

    .feature-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    /* Final CTA */
    .final-cta {
        padding: 64px 20px 48px;
        gap: 24px;
    }

    .final-cta-title {
        font-size: 30px;
        letter-spacing: -1px;
    }

    .final-cta-sub {
        font-size: 14px;
    }

    /* Footer */
    .landing-footer {
        flex-direction: column;
        gap: 12px;
        padding: 20px;
        text-align: center;
    }

    /* Lightbox */
    .lightbox {
        padding: 16px;
    }

    .lightbox-close {
        top: 10px;
        right: 16px;
        font-size: 32px;
    }
}

/* ===== Sheet View ===== */

.sheet-container {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.sheet-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 16px;
    overflow: hidden;
}

.sheet-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sheet-topbar-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sheet-view-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--crimson);
    text-transform: uppercase;
}

.sheet-month-title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 500;
    letter-spacing: -1px;
}

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

.sheet-filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.sheet-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: var(--text-muted);
    transition: color 0.15s, background 0.15s;
}

.sheet-icon-btn:hover {
    color: var(--text-primary);
    background: rgba(0,0,0,0.05);
}

.sheet-calendar-wrapper {
    position: relative;
    display: inline-flex;
}

.sheet-calendar-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.sheet-filter-btn:hover {
    border-color: var(--text-muted);
}

/* Table */

.sheet-table-wrapper {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 280px);
    border-bottom: none;
}

.sheet-bottom-line {
    height: 2px;
    background: var(--crimson);
    flex-shrink: 0;
}

.sheet-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.sheet-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-page);
    padding: 8px 4px;
    font-family: var(--font-ui);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-align: left;
    color: var(--text-primary);
    box-shadow: inset 0 -2px 0 var(--text-primary);
}

.sheet-table th.col-date { width: 88px; }
.sheet-table th.col-start { width: 40px; }
.sheet-table th.col-end { width: 40px; }
.sheet-table th.col-time { width: 36px; }
.sheet-table th.col-type { width: 80px; }
.sheet-table th.col-subtype { width: 85px; }
.sheet-table th.col-notes { /* fills remaining space */ }
.sheet-table th.col-hours { width: 40px; }

.sheet-row {
    height: var(--row-height);
    border-bottom: 1px solid var(--border);
    position: relative;
}

.sheet-row.day-odd {
    background: var(--day-odd-bg);
    border-bottom-color: var(--day-odd-border);
}

.sheet-row td,
.new-entry-row td {
    padding: 0 3px;
    vertical-align: middle;
    height: var(--row-height);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sheet-row .cell-date {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.sheet-row .cell-date.first-of-day {
    font-weight: 700;
    color: var(--text-primary);
}

.sheet-row .cell-time {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-primary);
}

.sheet-row .cell-type {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.sheet-row .cell-subtype {
    font-size: 14px;
    color: var(--text-primary);
}

.sheet-row .cell-notes {
    font-size: 14px;
    color: var(--text-primary);
}

.sheet-row .cell-duration,
.new-entry-row .cell-duration {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
}

.sheet-row .cell-hours,
.new-entry-row .cell-hours {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    color: var(--text-primary);
}

.sheet-row .date-input {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    width: 100%;
}

.sheet-row .first-of-day .date-input {
    font-weight: 700;
    color: var(--text-primary);
}

/* Editable cells */
.sheet-row input,
.sheet-row select {
    width: 100%;
    height: 100%;
    padding: 0;
    background: transparent;
}

.sheet-row input:focus,
.new-entry-row input:focus {
    background: rgba(196, 30, 58, 0.05);
}

.sheet-row input.cell-selected {
    outline: 2px solid var(--crimson);
    outline-offset: 0px;
    background: rgba(196, 30, 58, 0.04);
    cursor: default;
    caret-color: transparent;
}

.sheet-row input:focus:not(.cell-selected) {
    outline: 1px solid var(--crimson-muted);
    outline-offset: -1px;
    background: rgba(196, 30, 58, 0.08);
}

.sheet-row .time-input {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-primary);
}

.sheet-row .notes-input {
    font-family: 'Corbel', var(--font-ui);
    font-size: 15px;
    color: var(--text-primary);
}

/* Insert row button */
.insert-row-hover-area {
    position: absolute;
    left: -20px;
    top: -10px;
    width: 40px;
    height: 20px;
    z-index: 5;
    pointer-events: auto;
}

.insert-row-btn {
    position: absolute;
    left: -2px;
    top: 2px;
    width: 16px;
    height: 16px;
    background: var(--green);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 5;
    cursor: pointer;
    pointer-events: auto;
}

.sheet-row:hover + .insert-row-zone .insert-row-btn,
.insert-row-hover-area:hover .insert-row-btn {
    opacity: 1;
}

/* ===== Day Stats Sidebar ===== */

.day-stats {
    width: 260px;
    background: var(--stats-bg);
    border-left: 1px solid var(--border);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    flex-shrink: 0;
}

.stats-header-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--crimson);
    text-transform: uppercase;
}

.stats-date {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -1px;
}

.stats-total-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
}

.stats-total-value {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 500;
    letter-spacing: -2px;
}

.stats-divider {
    height: 1px;
    background: var(--border);
}

.stats-section-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-primary);
    text-transform: uppercase;
}

.stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-row-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stats-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.stats-dot.sm {
    width: 6px;
    height: 6px;
    border-radius: 3px;
}

.stats-row-name {
    font-size: 11px;
    font-weight: 500;
}

.stats-row-value {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
}

/* Week stats */
.week-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.week-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.week-nav button {
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.week-nav button:hover {
    color: var(--text-primary);
}

.week-range {
    font-size: 10px;
    color: var(--text-secondary);
}

.week-total-value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 500;
    letter-spacing: -1px;
}

/* ===== Edit Entry Dialog ===== */

.edit-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.edit-dialog-time {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--crimson);
}

.edit-dialog-duration {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 12px;
}

.edit-dialog-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
}

.edit-dialog-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
}

.edit-dialog-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 4px;
}

.edit-dialog-date {
    font-size: 11px;
    color: var(--text-muted);
}

.edit-dialog-body {
    padding: 20px 24px;
    flex: 1;
    overflow-y: auto;
}

.edit-dialog-body textarea {
    width: 100%;
    min-height: 200px;
    font-size: 14px;
    line-height: 1.7;
    resize: vertical;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-ui);
}

.edit-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 12px 24px;
    border-top: 1px solid var(--border);
}

.btn-cancel {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.btn-cancel:hover {
    border-color: var(--text-muted);
}

.btn-save {
    padding: 8px 16px;
    background: var(--crimson);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.btn-save:hover {
    opacity: 0.9;
}

/* ===== Category Picker ===== */

.category-picker-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.category-picker-input {
    width: 100%;
    height: 100%;
    font-family: 'Corbel', var(--font-ui);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    background: transparent;
    border: none;
    outline: none;
    padding: 0;
}

.category-picker-input:focus {
    background: rgba(196, 30, 58, 0.05);
}

.category-suggestions {
    position: absolute;
    top: 100%;
    left: -4px;
    min-width: 160px;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 50;
    padding: 4px 0;
}

.category-suggestion {
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-primary);
}

.category-suggestion:hover,
.category-suggestion.highlighted {
    background: var(--bg-page);
    color: var(--crimson);
}

/* ===== Statistics View ===== */

.stats-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 24px;
    gap: 24px;
    overflow-y: auto;
}

.stats-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-topbar-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stats-view-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--crimson);
    text-transform: uppercase;
}

.stats-title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 500;
    letter-spacing: -1px;
}

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

.stats-range-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-range-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: var(--text-muted);
    transition: color 0.15s;
}

.stats-range-nav:hover {
    color: var(--text-primary);
}

.stats-range-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 120px;
    text-align: center;
}

.stats-metrics-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stats-metric-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stats-metric-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stats-metric-value {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 500;
    letter-spacing: -2px;
    color: var(--text-primary);
}

.stats-charts-row {
    display: flex;
    gap: 24px;
    flex: 1;
    min-height: 0;
}

.stats-chart-panel {
    flex: 2;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stats-chart-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stats-section-title-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stats-chart-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 500;
    letter-spacing: -0.5px;
}

.stats-chart-legend {
    display: flex;
    gap: 16px;
    margin-top: 4px;
}

.stats-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
}

.stats-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    flex: 1;
    min-height: 200px;
}

.stats-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.stats-bar-stack {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: 200px;
    justify-content: flex-end;
}

.stats-bar {
    min-height: 0;
    border-radius: 2px 2px 0 0;
    transition: height 0.3s ease;
}

.stats-bar-label {
    font-family: var(--font-mono);
    font-size: 8px;
    color: var(--text-muted);
    white-space: nowrap;
}

.stats-breakdown-panel {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stats-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stats-breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-breakdown-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-breakdown-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

.stats-breakdown-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-breakdown-hours {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.stats-breakdown-pct {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.stats-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--text-muted);
    font-size: 14px;
}

/* ===== Diary View ===== */

.diary-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: #EDE8DF;
    overflow: hidden;
}

.diary-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 40px;
    flex-shrink: 0;
}

.diary-nav-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.diary-nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.diary-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(255,255,255,0.6);
    color: #5A5347;
    cursor: pointer;
}

.diary-nav-btn:hover {
    background: rgba(255,255,255,0.9);
}

.diary-today-btn {
    width: auto;
    padding: 0 12px;
    font-size: 10px;
    font-weight: 600;
}

.diary-calendar-wrapper {
    position: relative;
    display: inline-flex;
}

.diary-calendar-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.diary-page-indicator {
    font-size: 11px;
    font-weight: 500;
    color: #8C8478;
}

.diary-book-spread {
    flex: 1;
    width: 100%;
    overflow: hidden;
}

.diary-book-inner {
    position: relative;
    width: 100%;
    height: 100%;
    /* Two-tone background: left page lighter, right page slightly darker */
    background: linear-gradient(to right, #FDFBF6 calc(50% - 1px), #D0C9BD calc(50% - 1px), #D0C9BD calc(50% + 1px), #FBF9F4 calc(50% + 1px));
}

.diary-spine-overlay {
    position: absolute;
    top: 0;
    left: calc(50% - 1px);
    width: 2px;
    height: 100%;
    background: #D0C9BD;
    pointer-events: none;
    z-index: 1;
}

.diary-page-padding {
    padding: 36px 48px;
    padding-bottom: 50px;
    height: 100%;
    box-sizing: border-box;
}

.diary-page-viewport {
    overflow: hidden;
    width: 100%;
    height: 100%;
}

.diary-columns {
    column-count: 2;
    column-gap: 80px;
    column-fill: auto;
    height: 100%;
    transition: transform 0.35s ease;
}

.diary-no-break {
    break-inside: avoid;
}

.diary-page-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.diary-page-day-label {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #3D3830;
}

.diary-header-line {
    width: 32px;
    height: 1px;
    background: var(--crimson);
    margin-top: 8px;
}

.diary-spacer {
    height: 16px;
}

.diary-ai-summary {
    background: #F4F1EB;
    border-radius: 4px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.diary-ai-label {
    font-family: var(--font-ui);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--crimson);
}

.diary-ai-text {
    font-family: var(--font-display);
    font-size: 13px;
    font-style: italic;
    line-height: 1.6;
    color: #5A5347;
}

.diary-entry {
    /* Block layout — allows text to break across columns/pages */
}

.diary-entry-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.diary-entry-time {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    color: var(--crimson);
}

.diary-entry-cat {
    font-family: var(--font-ui);
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #A09888;
    text-transform: uppercase;
}

.diary-entry-text {
    font-family: var(--font-display);
    font-size: 13px;
    line-height: 1.65;
    color: #3D3830;
    margin: 0;
}

.diary-entry-sep {
    height: 12px;
}

/* Fixed footers */
.diary-page-num-left {
    position: absolute;
    bottom: 16px;
    left: 48px;
    font-family: var(--font-display);
    font-size: 12px;
    color: #A09888;
}

.diary-footer-right-abs {
    position: absolute;
    bottom: 16px;
    right: 48px;
    left: calc(50% + 40px);
    display: flex;
    flex-direction: column;
}

.diary-footer-line {
    height: 1px;
    background: #D0C9BD;
}

.diary-footer-content {
    display: flex;
    justify-content: space-between;
    padding-top: 8px;
}

.diary-footer-stats {
    font-family: var(--font-mono);
    font-size: 9px;
    color: #A09888;
}

.diary-page-num {
    font-family: var(--font-display);
    font-size: 12px;
    color: #A09888;
}

.diary-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

.diary-empty-text {
    font-family: var(--font-display);
    font-size: 14px;
    font-style: italic;
    color: #A09888;
}

/* ===== Placeholder Pages ===== */

.placeholder-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    gap: 16px;
    color: var(--text-muted);
}

.placeholder-page h2 {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 500;
    color: var(--text-primary);
}

.placeholder-page p {
    font-size: 14px;
}

/* ===== Utilities ===== */

.text-crimson { color: var(--crimson); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }

/* ===== MudBlazor Overrides ===== */

.mud-dialog .mud-dialog-content {
    padding: 0 !important;
}

.mud-dialog .mud-dialog-actions {
    display: none;
}
