/* ===================================
   DAY — A contemplative time tracker
   Aesthetic: Murakami-inspired minimalism
   Quiet elegance, paper textures, ink
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,400&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,400&display=swap');

/* ===== CSS Variables ===== */
:root {
    /* Paper & Ink palette */
    --bg-primary: #FAF8F5;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F5F2EE;
    --bg-hover: #EDE9E3;
    --bg-accent: #F0EDE8;
    
    /* Ink gradations */
    --border-color: #E8E4DD;
    --border-subtle: #F0EDE8;
    --text-primary: #1A1A1A;
    --text-secondary: #6B6560;
    --text-muted: #9A948C;
    --text-faint: #C4BEB5;
    
    /* Accent colors - muted, sophisticated */
    --accent-primary: #5C7C6B;      /* Sage green */
    --accent-success: #6B8E6B;      /* Muted forest */
    --accent-warning: #C9A55C;      /* Warm gold */
    --accent-danger: #B85C5C;       /* Dusty rose-red */
    --accent-purple: #7B6B8E;       /* Muted lavender */
    --accent-pink: #A67B8E;         /* Dusty mauve */
    --accent-blue: #5C6B7C;         /* Slate blue */
    
    /* Shadows - soft and diffused */
    --shadow-sm: 0 1px 2px rgba(26, 26, 26, 0.04);
    --shadow: 0 4px 16px rgba(26, 26, 26, 0.06);
    --shadow-lg: 0 8px 32px rgba(26, 26, 26, 0.08);
    
    /* Spacing rhythm */
    --radius: 4px;
    --radius-sm: 2px;
    --radius-lg: 8px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Category Colors - vibrant, clear */
    --cat-deep-work: #2D9A5D;
    --cat-shallow-work: #5BC47F;
    --cat-learning: #86EFAC;
    --cat-exercise: #EF4444;
    --cat-commute: #F59E0B;
    --cat-chores: #FFFAA0;
    --cat-rest: #F472B6;
    --cat-social: #7DD3FC;
    --cat-entertainment: #3B82F6;
    --cat-sleep: #F9A8D4;
    --cat-other: #6B7280;
    --cat-gap: rgba(239, 68, 68, 0.12);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle paper texture */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.015;
    pointer-events: none;
    z-index: -1;
}

/* ===== Typography ===== */
h1, h2, h3, h4 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 500;
    letter-spacing: -0.02em;
}

/* ===== App Container ===== */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    overflow-x: hidden;
}

/* Prevent horizontal scroll on mobile */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* ===== Header ===== */
.app-header {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.5rem 0;
    margin-bottom: 0.5rem;
    position: relative;
}

.app-title {
    display: none;
}

.current-date {
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    order: 3;
    margin-left: auto;
}

.current-time {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
    order: 2;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* ===== Timer Bar ===== */
.timer-bar {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.75rem 1.25rem;
    background: rgba(92, 124, 107, 0.08);
    border: 1px solid rgba(92, 124, 107, 0.2);
    border-radius: var(--radius);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 100%;
    margin-top: 0.5rem;
    z-index: 10;
}

.timer-bar.hidden {
    display: none;
}

/* Header has timer running state */
.app-header.timer-active {
    margin-bottom: 3.5rem;
}

.timer-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.timer-category {
    font-size: 0.8rem;
    color: var(--accent-primary);
    font-weight: 500;
    text-transform: lowercase;
    letter-spacing: 0.05em;
}

.timer-elapsed {
    font-size: 1.1rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.timer-stop-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--accent-danger);
    border-radius: var(--radius);
    color: var(--accent-danger);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.03em;
}

.timer-stop-btn:hover {
    background: var(--accent-danger);
    color: white;
}

.btn-timer {
    background: transparent;
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    font-weight: 500;
}

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

.btn-timer.hidden {
    display: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    order: 1;
}

/* Play button (Start Timer) subtle icon style */
.btn-play {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-faint);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

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

.btn-play.hidden {
    display: none;
}

/* Snapshot download icon button */
.btn-snapshot-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-faint);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-snapshot-icon:hover {
    color: var(--accent-primary);
    background: var(--bg-hover);
}

/* ===== Navigation ===== */
.nav-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    overflow-y: hidden;
}

.nav-tab {
    padding: 1rem 1.75rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 400;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
    letter-spacing: 0.03em;
    margin-bottom: -1px;
}

.nav-tab:hover {
    color: var(--text-secondary);
}

.nav-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

/* ===== Views ===== */
.view {
    display: none;
    animation: fadeIn 0.4s ease;
}

.view.active {
    display: block;
}

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

/* ===== Cards ===== */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    letter-spacing: 0.01em;
}

/* ===== Dashboard Grid ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .timeline-card {
        grid-column: span 2;
    }
}

/* ===== Timeline ===== */
.timeline-container {
    overflow-x: auto;
    overflow-y: visible;
    padding: 0.5rem 0 1rem;
}

.timeline {
    height: 48px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    overflow: visible;
    min-width: 600px;
    position: relative;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.timeline-segment {
    position: absolute;
    top: 0;
    height: 100%;
    transition: var(--transition);
    cursor: pointer;
    border-right: 1px solid var(--bg-primary);
    border-radius: var(--radius-sm);
}

.timeline-segment:hover {
    filter: brightness(1.08);
    z-index: 10;
}

.timeline-segment.gap {
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 4px,
        var(--cat-gap) 4px,
        var(--cat-gap) 8px
    );
    border: none;
}

.timeline-now-marker {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: var(--text-primary);
    z-index: 20;
    opacity: 0.7;
}

.timeline-now-marker::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -3px;
    width: 8px;
    height: 8px;
    background: var(--text-primary);
    border-radius: 50%;
}

.timeline-hours {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0 0.25rem;
    font-size: 0.7rem;
    color: var(--text-faint);
    min-width: 600px;
    letter-spacing: 0.02em;
}

.timeline-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 0;
    font-size: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-sm);
}

.gap-alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: rgba(184, 92, 92, 0.06);
    border: 1px solid rgba(184, 92, 92, 0.2);
    border-radius: var(--radius);
    margin-top: 1.25rem;
    color: var(--accent-danger);
    font-size: 0.9rem;
}

.gap-alert.hidden {
    display: none;
}

.gap-icon {
    font-size: 1rem;
    opacity: 0.8;
}

/* ===== Time Breakdown ===== */
.time-breakdown-grid {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 600px) {
    .time-breakdown-grid {
        grid-template-columns: 1fr;
    }
}

.pie-chart-container {
    display: flex;
    justify-content: center;
}

.category-table {
    font-size: 0.9rem;
}

.category-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.category-row:last-child {
    border-bottom: none;
}

.category-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.category-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.category-value {
    font-weight: 500;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ===== Daily Totals ===== */
.totals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
}

.total-item {
    text-align: center;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    transition: var(--transition);
}

.total-item:hover {
    background: var(--bg-hover);
}

.total-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.total-value {
    display: block;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ===== Recent Entries ===== */
.recent-entries {
    max-height: 300px;
    overflow-y: auto;
}

.entry-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.entry-item:hover {
    background: var(--bg-hover);
}

.entry-info {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.entry-type-badge {
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: lowercase;
    letter-spacing: 0.05em;
}

.entry-type-badge.activity { background: var(--cat-deep-work); color: white; }
.entry-type-badge.food { background: var(--accent-success); color: white; }
.entry-type-badge.drink { background: var(--accent-blue); color: white; }
.entry-type-badge.supplement { background: var(--accent-purple); color: white; }
.entry-type-badge.exercise { background: var(--accent-danger); color: white; }
.entry-type-badge.sleep { background: var(--accent-pink); color: white; }

.entry-description {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.entry-time {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.entry-actions {
    display: flex;
    gap: 0.35rem;
    opacity: 0;
    transition: var(--transition);
}

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

.entry-actions button {
    padding: 0.35rem 0.6rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition);
}

.entry-actions button:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.entry-actions button.delete:hover {
    border-color: var(--accent-danger);
    color: var(--accent-danger);
}

/* ===== Log Entry View ===== */
.log-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.log-tab {
    padding: 0.6rem 1.25rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
    letter-spacing: 0.02em;
}

.log-tab:hover {
    border-color: var(--text-muted);
    color: var(--text-secondary);
}

.log-tab.active {
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: white;
}

/* ===== Forms ===== */
.log-form {
    display: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 560px;
    box-shadow: var(--shadow-sm);
}

.log-form.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.form-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 1.75rem;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--text-muted);
    background: var(--bg-secondary);
}

input::placeholder {
    color: var(--text-faint);
}

select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.item-select-container {
    display: flex;
    gap: 0.75rem;
}

.item-select-container select {
    flex: 1;
}

/* ===== Buttons ===== */
.btn {
    padding: 0.85rem 1.75rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    letter-spacing: 0.02em;
}

.btn-primary {
    background: var(--text-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--text-secondary);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-muted);
}

.btn-danger {
    background: var(--accent-danger);
    color: white;
}

.btn-danger:hover {
    background: #a04f4f;
}

.btn-small {
    padding: 0.5rem 0.9rem;
    font-size: 0.8rem;
}

.btn-large {
    padding: 1rem 2.5rem;
    font-size: 0.95rem;
}

/* ===== Macro Preview ===== */
.macro-preview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
}

.macro-preview.hidden {
    display: none;
}

.macro-item {
    text-align: center;
    font-size: 0.85rem;
}

.macro-item span:first-child {
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    text-transform: lowercase;
}

.macro-item span:last-child {
    color: var(--text-primary);
    font-weight: 500;
}

/* ===== Duration Preview ===== */
.duration-preview {
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

#sleep-duration-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* ===== Exercise Fields ===== */
.exercise-fields {
    margin-bottom: 1.25rem;
}

.exercise-fields.hidden {
    display: none;
}

/* Exercise List Styles */
.exercises-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.exercises-header h4 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.exercises-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.exercise-entry {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    position: relative;
}

.exercise-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.exercise-entry-header select {
    flex: 1;
    margin-right: 0.5rem;
}

.exercise-entry-remove {
    background: var(--accent-danger);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all var(--transition);
    flex-shrink: 0;
}

.exercise-entry-remove:hover {
    background: #dc2626;
    transform: scale(1.05);
}

.exercise-custom-name {
    width: 100%;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.exercise-custom-name.hidden {
    display: none;
}

.exercise-entry-fields {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.exercise-entry-fields .form-group {
    margin-bottom: 0;
}

.exercise-entry-fields label {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.exercise-entry-fields input {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
}

.exercise-volume {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    justify-content: flex-end;
    gap: 0.25rem;
}

.exercise-volume strong {
    color: var(--accent-primary);
}

.session-volume {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}

.session-volume.hidden {
    display: none;
}

.session-volume strong {
    color: var(--accent-primary);
    font-size: 1.1rem;
}

.exercise-empty-state {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius);
}

/* ===== Unit Label ===== */
.unit-label {
    display: flex;
    align-items: center;
    padding: 0 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Item Database View ===== */
.items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.items-header h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 500;
}

.items-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.items-tab {
    padding: 0.6rem 1.25rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.items-tab:hover {
    border-color: var(--text-muted);
    color: var(--text-secondary);
}

.items-tab.active {
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: white;
}

.items-list {
    display: grid;
    gap: 0.75rem;
}

.item-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: var(--transition);
}

.item-card:hover {
    border-color: var(--text-muted);
    box-shadow: var(--shadow-sm);
}

.item-info h3 {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.item-details {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.item-actions {
    display: flex;
    gap: 0.5rem;
}

/* ===== Analytics View ===== */
.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.analytics-header h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.analytics-period {
    display: flex;
    gap: 0.5rem;
}

.period-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
}

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

.period-btn.active {
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: white;
}

.analytics-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
}

.metric-card:hover {
    box-shadow: var(--shadow);
}

.metric-value {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2.25rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

@media (max-width: 900px) {
    .analytics-grid {
        grid-template-columns: 1fr;
    }
}

.analytics-card {
    min-height: 280px;
}

.analytics-card.wide {
    grid-column: span 2;
}

@media (max-width: 900px) {
    .analytics-card.wide {
        grid-column: span 1;
    }
}

.chart-container {
    width: 100%;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.chart-container canvas {
    max-width: 100%;
    max-height: 100%;
}

/* Chart Tooltip */
.chart-tooltip {
    position: absolute;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.6rem 0.8rem;
    font-size: 0.75rem;
    box-shadow: var(--shadow);
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.15s ease;
    white-space: nowrap;
}

.chart-tooltip.visible {
    opacity: 1;
}

.chart-tooltip-date {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
}

.chart-tooltip-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.15rem 0;
}

.chart-tooltip-color {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.chart-tooltip-label {
    color: var(--text-muted);
}

.chart-tooltip-value {
    color: var(--text-primary);
    font-weight: 500;
    margin-left: auto;
}

.category-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.breakdown-bar-container {
    flex: 1;
    height: 20px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.breakdown-bar {
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.breakdown-label {
    min-width: 90px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.breakdown-value {
    min-width: 50px;
    text-align: right;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.insights-list {
    display: grid;
    gap: 0.75rem;
}

.insight-item {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1rem 1.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    border-left: 3px solid var(--accent-primary);
}

.insight-item.positive {
    border-left-color: var(--accent-success);
}

.insight-item.negative {
    border-left-color: var(--accent-danger);
}

.insight-item.neutral {
    border-left-color: var(--accent-warning);
}

.insight-icon {
    font-size: 1.1rem;
    opacity: 0.8;
}

.insight-text {
    flex: 1;
}

.insight-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    font-size: 0.9rem;
}

.insight-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== Export View ===== */
.export-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
}

.export-description {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.export-stats {
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.export-stats div {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
}

.backup-status {
    display: flex;
    justify-content: space-between;
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

#last-backup-time {
    color: var(--text-primary);
    font-weight: 500;
}

/* ===== Modal ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 26, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    animation: modalFadeIn 0.25s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(-16px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-small {
    max-width: 380px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.2rem;
    font-weight: 500;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-content form {
    padding: 1.75rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-subtle);
}

.item-fields.hidden {
    display: none;
}

/* ===== Hourly Reminder Modal ===== */
.modal-reminder {
    max-width: 380px;
    text-align: center;
}

.reminder-header {
    padding: 2.5rem 1.75rem 1.25rem;
}

.reminder-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: inline-block;
}

.reminder-header h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0;
    font-weight: 500;
}

.reminder-message {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0.5rem 0;
    padding: 0 1.75rem;
}

.reminder-prompt {
    color: var(--text-secondary);
    margin: 0.5rem 0 1.75rem;
    padding: 0 1.75rem;
    font-size: 0.95rem;
}

.reminder-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0 1.75rem 1.25rem;
}

.reminder-snooze {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.25rem 1.75rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.reminder-snooze input {
    width: auto;
    cursor: pointer;
}

.reminder-snooze:hover {
    color: var(--text-secondary);
}

/* ===== Lockdown Screen ===== */
.lockdown-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lockdown-screen.hidden {
    display: none;
}

.lockdown-content {
    text-align: center;
    padding: 3rem;
    max-width: 440px;
}

.lockdown-warnings {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.warning-icon {
    font-size: 2rem;
    opacity: 0.9;
}

.lockdown-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--accent-danger);
    text-transform: lowercase;
    letter-spacing: 0.2em;
    margin-bottom: 2rem;
}

.lockdown-message {
    background: rgba(184, 92, 92, 0.06);
    border: 1px solid rgba(184, 92, 92, 0.2);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2.5rem;
}

.lockdown-gap-time {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2.5rem;
    font-weight: 500;
    color: var(--accent-danger);
    margin-bottom: 1rem;
}

.lockdown-message p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0.5rem 0;
    line-height: 1.6;
}

.lockdown-pulse {
    display: none;
}

.lockdown-btn {
    font-size: 0.95rem;
    padding: 1rem 2.5rem;
    text-transform: lowercase;
    letter-spacing: 0.1em;
    font-weight: 500;
}

.lockdown-warning-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 1.75rem;
    font-style: italic;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    animation: toastIn 0.3s ease;
    font-size: 0.9rem;
}

.toast.hidden {
    display: none;
}

.toast.success {
    border-left: 3px solid var(--accent-success);
}

.toast.error {
    border-left: 3px solid var(--accent-danger);
}

.toast.warning {
    border-left: 3px solid var(--accent-warning);
}

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

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

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

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

/* ===== Empty States ===== */
.empty-state {
    text-align: center;
    padding: 4rem 1.5rem;
    color: var(--text-muted);
}

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

.empty-state p {
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ===== Category Colors ===== */
.cat-deep_work { background: var(--cat-deep-work); }
.cat-shallow_work { background: var(--cat-shallow-work); }
.cat-learning { background: var(--cat-learning); }
.cat-exercise { background: var(--cat-exercise); }
.cat-commute { background: var(--cat-commute); }
.cat-chores { background: var(--cat-chores); }
.cat-social { background: var(--cat-social); }
.cat-entertainment { background: var(--cat-entertainment); }
.cat-rest { background: var(--cat-rest); }
.cat-sleep { background: var(--cat-sleep); }
.cat-other { background: var(--cat-other); }

/* ===== Timeline Snapshots ===== */
.snapshots-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.snapshots-header .card-title {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.snapshots-description {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.snapshots-list {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    max-height: 400px;
    overflow-y: auto;
}

.snapshot-item {
    position: relative;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 1rem;
    transition: var(--transition);
}

.snapshot-item:hover {
    background: var(--bg-hover);
}

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

.snapshot-date {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.snapshot-total {
    font-size: 0.85rem;
    color: var(--accent-primary);
    font-weight: 500;
}

.mini-timeline {
    display: flex;
    height: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.mini-segment {
    height: 100%;
    transition: var(--transition);
}

.mini-segment:hover {
    filter: brightness(1.1);
}

.mini-segment.empty {
    background: var(--bg-secondary);
    width: 100%;
}

/* Actual pattern timeline (positioned segments) */
.mini-timeline-actual {
    position: relative;
    height: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.mini-segment-abs {
    position: absolute;
    top: 0;
    height: 100%;
    border-right: 1px solid var(--bg-primary);
    cursor: pointer;
    transition: var(--transition);
}

.mini-segment-abs:hover {
    filter: brightness(1.1);
    z-index: 10;
}

.mini-segment-empty {
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
}

.mini-timeline-hours {
    position: relative;
    display: flex;
    justify-content: space-between;
    height: 14px;
    margin-bottom: 0.5rem;
}

.mini-hour-marker {
    position: absolute;
    transform: translateX(-50%);
    font-size: 0.6rem;
    color: var(--text-faint);
}

.snapshot-summary {
    display: flex;
    gap: 1.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.snapshot-delete {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.25rem 0.5rem !important;
    font-size: 0.9rem;
    opacity: 0;
    transition: var(--transition);
}

.snapshot-item:hover .snapshot-delete {
    opacity: 1;
}

/* ===== Entry Actions Inline ===== */
.entry-actions-inline {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    color: var(--text-faint);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.btn-icon.delete:hover {
    color: var(--accent-danger);
}

.btn-icon svg {
    display: block;
}

/* ===== Edit Entry Form ===== */
.edit-entry-form {
    padding: 1.75rem;
}

.edit-entry-form .form-group {
    margin-bottom: 1.25rem;
}

.edit-entry-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 400;
}

.edit-entry-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

/* ===== Exercise Analysis ===== */
.exercise-analysis {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.exercise-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
}

.exercise-stat-card {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.exercise-stat-icon {
    font-size: 1.75rem;
    opacity: 0.8;
}

.exercise-stat-content {
    flex: 1;
}

.exercise-stat-content h4 {
    margin: 0 0 0.9rem 0;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
}

.exercise-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    font-size: 0.85rem;
}

.exercise-stat-row span {
    color: var(--text-muted);
}

.exercise-stat-row strong {
    color: var(--text-primary);
    font-weight: 500;
}

.exercise-recent h4 {
    margin: 0 0 0.9rem 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.exercise-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.exercise-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 0.9rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.exercise-type-badge {
    font-size: 0.7rem;
    white-space: nowrap;
    text-transform: lowercase;
}

.exercise-details {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.exercise-date {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Volume Chart Section */
.volume-chart-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.volume-chart-section:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.volume-chart-section h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    letter-spacing: 0.08em;
}

.volume-chart-container {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 1rem;
    overflow-x: auto;
}

.volume-chart-container canvas {
    display: block;
    width: 100%;
    max-width: 600px;
    height: auto;
}

/* Exercise Progress Section */
.exercise-progress-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.exercise-progress-section h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    letter-spacing: 0.08em;
}

.exercise-progress-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.exercise-progress-item {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.exercise-progress-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.exercise-progress-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.progress-stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.progress-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.progress-value {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent-primary);
}

/* ===== Selection & Focus States ===== */
::selection {
    background: rgba(92, 124, 107, 0.2);
}

:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .app-container {
        padding: 0 0.75rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .card {
        max-width: 100%;
        overflow: hidden;
    }
    
    .main-content {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .app-header {
        flex-wrap: nowrap;
        justify-content: space-between;
        padding: 1rem 0;
        gap: 0.5rem;
    }
    
    .header-actions {
        order: 1;
    }
    
    .current-time {
        order: 2;
        font-size: 0.9rem;
        position: static;
        transform: none;
        flex: 1;
        text-align: center;
    }
    
    .current-date {
        order: 3;
        font-size: 0.75rem;
    }
    
    .timer-bar {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.6rem 1rem;
        position: relative;
        left: auto;
        transform: none;
        top: auto;
        margin-top: 0;
        width: 100%;
        order: 4;
    }
    
    .timer-info {
        flex: 1;
        min-width: 120px;
    }
    
    .app-header.timer-active {
        margin-bottom: 0;
        flex-wrap: wrap;
    }
    
    .nav-tabs {
        margin-bottom: 1.5rem;
        gap: 0;
    }
    
    .nav-tab {
        padding: 0.65rem 1rem;
        font-size: 0.8rem;
    }
    
    .log-tabs {
        gap: 0.35rem;
    }
    
    .log-tab {
        padding: 0.5rem 0.9rem;
        font-size: 0.8rem;
    }
    
    .card {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .card-title {
        font-size: 1.05rem;
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
    }
    
    .totals-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .total-item {
        padding: 0.75rem;
    }
    
    .total-label {
        font-size: 0.65rem;
    }
    
    .total-value {
        font-size: 1.2rem;
    }
    
    .entry-item {
        padding: 0.65rem 0.75rem;
        gap: 0.5rem;
    }
    
    .entry-info {
        gap: 0.5rem;
    }
    
    .entry-type-badge {
        padding: 0.2rem 0.4rem;
        font-size: 0.6rem;
    }
    
    .entry-description {
        font-size: 0.8rem;
    }
    
    .entry-actions-inline {
        gap: 0.15rem;
    }
    
    .entry-actions-inline .entry-time {
        font-size: 0.65rem;
        margin-right: 0.15rem;
    }
    
    .entry-actions-inline .btn-icon {
        padding: 0.25rem;
    }
    
    .entry-actions-inline .btn-icon svg {
        width: 11px;
        height: 11px;
    }
    
    /* Analytics mobile */
    .analytics-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }
    
    .analytics-period {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .period-btn {
        flex: 1;
        min-width: auto;
        padding: 0.45rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .analytics-metrics {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .metric-card {
        padding: 1rem;
    }
    
    .metric-value {
        font-size: 1.5rem;
    }
    
    .metric-label {
        font-size: 0.65rem;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .analytics-card.wide {
        grid-column: span 1;
    }
    
    .analytics-card {
        min-height: auto;
    }
    
    .chart-container {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
    }
    
    .chart-container canvas {
        max-width: 100%;
    }
    
    /* Snapshots mobile */
    .snapshots-header {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }
    
    .snapshots-header .card-title {
        font-size: 1rem;
    }
    
    /* Timeline mobile */
    .timeline {
        height: 40px;
        min-width: 500px;
    }
    
    .timeline-hours {
        min-width: 500px;
        font-size: 0.6rem;
    }
    
    .timeline-legend {
        gap: 0.75rem;
        font-size: 0.7rem;
    }
    
    /* Forms mobile */
    .log-form {
        padding: 1.25rem;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .form-title {
        font-size: 1.15rem;
        margin-bottom: 1.25rem;
    }
    
    input, select, textarea {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .item-select-container {
        flex-direction: column;
    }
    
    .item-select-container button {
        width: 100%;
    }
    
    /* Macros mobile */
    .macro-preview {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        padding: 1rem;
    }
    
    /* Exercise fields mobile */
    .exercise-entry-fields {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .exercises-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    /* Export mobile */
    .export-container {
        grid-template-columns: 1fr;
    }
    
    /* Breakdown mobile */
    .breakdown-label {
        min-width: 70px;
        font-size: 0.75rem;
    }
    
    .breakdown-value {
        min-width: 40px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    .app-container {
        padding: 0 0.75rem;
    }
    
    .app-header {
        padding: 0.75rem 0;
    }
    
    .current-time {
        font-size: 0.85rem;
    }
    
    .current-date {
        font-size: 0.7rem;
    }
    
    .nav-tab {
        padding: 0.6rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .totals-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .total-value {
        font-size: 1rem;
    }
    
    .analytics-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .metric-card {
        padding: 0.75rem;
    }
    
    .metric-value {
        font-size: 1.25rem;
    }
    
    .exercise-entry-fields {
        grid-template-columns: 1fr 1fr 1fr;
    }
    
    .exercise-entry-fields label {
        font-size: 0.7rem;
    }
    
    .exercise-entry-fields input {
        font-size: 0.8rem;
        padding: 0.4rem 0.5rem;
    }
    
    /* Modal mobile */
    .modal {
        padding: 0.5rem;
    }
    
    .modal-content {
        max-height: 95vh;
        max-width: calc(100vw - 1rem);
    }
    
    .modal-header {
        padding: 1rem 1.25rem;
    }
    
    .modal-content form {
        padding: 1.25rem;
    }
    
    /* Prevent overflow on small screens */
    .card {
        padding: 1rem;
    }
    
    .breakdown-item {
        flex-wrap: wrap;
    }
    
    .breakdown-label {
        min-width: 60px;
        font-size: 0.7rem;
    }
    
    .breakdown-value {
        min-width: 35px;
        font-size: 0.7rem;
    }
    
    .volume-chart-container {
        padding: 0.5rem;
    }
    
    .exercise-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Print Styles ===== */
@media print {
    body {
        background: white;
    }
    
    .nav-tabs,
    .header-actions,
    .btn,
    .entry-actions,
    .modal {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }
}
