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

:root {
    --bg-primary: #f9fafb;
    /* Off-white for fresh feel */
    --bg-secondary: #f3f4f6;
    --bg-card: #ffffff;
    /* Solid white */
    --bg-input: #f3f4f6;
    /* Softer gray for inputs */
    --bg-input: #f3f4f6;
    /* Softer gray for inputs */
    --accent: #d4f826;
    /* Vibrant Ramp-like Yellow-Green */
    --accent-light: #f5fceb;
    --accent-dark: #b8cc12;
    /* Darker variant for hover */
    --accent-amber: #fca5a5;
    /* Softer, friendly red-orange */
    --accent-rose: #f43f5e;
    --accent-blue: #3b82f6;
    --accent-teal: #14b8a6;
    --text-primary: #111827;
    /* Rich near-black for high contrast */
    --text-secondary: #4b5563;
    /* Medium gray */
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    /* Soft border */
    --radius: 20px;
    /* Slightly rounder, friendlier corners */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-card: #1f2937;
    --bg-input: #374151;
    --accent: #d4f826;
    --accent-light: #3f4a15;
    --accent-dark: #b8cc12;
    --accent-teal: #14b8a6;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border: #374151;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

body.vintage {
    --bg-primary: #f4f1ea;
    --bg-secondary: #e8e3d9;
    --bg-card: #faf9f6;
    --bg-input: #f0ede5;
    --accent: #7d6754;
    --accent-light: #efece5;
    --accent-dark: #5d4d3f;
    --accent-amber: #c5a880;
    --accent-rose: #b47d7d;
    --accent-blue: #7d96b4;
    --accent-teal: #7db4a2;
    --text-primary: #3a322b;
    --text-secondary: #6d635b;
    --text-muted: #a09890;
    --border: #dcd8cf;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
}

/* ─── Dark-mode component overrides ───────────────────────────── */
body.dark-mode .nav {
    background: rgba(17, 24, 39, 0.92);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

body.dark-mode .nav-item .icon-svg {
    stroke: #d1d5db;
    opacity: 0.7;
}

body.dark-mode .nav-item.active {
    background: var(--accent);
}

body.dark-mode .nav-item.active .icon-svg {
    stroke: #111827;
    opacity: 1;
}

body.dark-mode .prompt-card {
    background: var(--bg-card);
}

body.dark-mode .prompt-text {
    color: var(--text-primary);
}

body.dark-mode .card {
    background: var(--bg-card);
    border-color: var(--border);
}

body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--border);
}

body.dark-mode label {
    color: var(--text-secondary);
}

body.dark-mode .btn-primary {
    color: #111827;
}

body.dark-mode .pill {
    background: var(--bg-input);
    color: var(--text-secondary);
    border-color: var(--border);
}

body.dark-mode .pill.active {
    background: var(--accent);
    color: #111827;
    border-color: var(--accent);
}

body.dark-mode .history-item {
    border-bottom-color: var(--border);
}

body.dark-mode .cal-widget {
    color: var(--text-primary);
}

body.dark-mode .cal-header-cell {
    color: var(--text-secondary);
}

body.dark-mode .cal-day {
    color: var(--text-primary);
}

body.dark-mode .cal-day.today {
    background: var(--accent-light);
    color: var(--accent);
}

body.dark-mode .cal-day-detail {
    background: var(--bg-input);
    color: var(--text-primary);
}

body.dark-mode .loading-text {
    color: var(--text-secondary);
}

body.dark-mode .category-badge {
    background: var(--bg-input);
    color: var(--text-secondary);
}

body.dark-mode .prompt-source {
    color: var(--text-muted);
}

body.dark-mode .review-period-tabs .period-tab {
    background: var(--bg-input);
    color: var(--text-secondary);
    border-color: var(--border);
}

body.dark-mode .review-period-tabs .period-tab.active {
    background: var(--accent);
    color: #111827;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ─── Run Tab Right Column ───────────────────────────────────── */

.run-right-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-self: stretch;
}

.run-right-col>.card {
    margin-bottom: 0;
}

.run-right-col>.card:last-child {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.run-right-col>.card:last-child #checkin-history {
    flex: 1;
    overflow-y: auto;
}

/* Fix nested card-within-card overlap */
.run-right-col .card .card {
    box-shadow: none;
    border: 1px solid var(--border);
    margin: 0;
}

/* ─── Navigation ─────────────────────────────────────────────── */

.nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: space-around;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 6px 12px max(6px, env(safe-area-inset-bottom));
    z-index: 100;
}

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

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 8px;
    /* Slightly reduced padding to fit all items */
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    border-radius: 12px;
    min-width: 60px;
    /* Reduced to fit typical mobile width */
    flex: 1;
    /* Helps spread items evenly */
}

.icon-svg {
    width: 28px;
    height: 28px;
    transition: var(--transition);
    opacity: 0.6;
    stroke: var(--text-secondary);
}

/* Nav item active state */
.nav-item.active {
    background: var(--accent);
    /* Neon green highlight */
    color: #0f172a;
    border-radius: 12px;
}

.nav-item.active .icon-svg {
    stroke: #0f172a;
    /* Dark/black icon */
    opacity: 1;
    transform: scale(1.1);
}

.nav-item:hover:not(.active) {
    background: var(--bg-secondary);
}

.nav-item:hover .icon-svg {
    opacity: 1;
    transform: scale(1.1);
}

.header {
    padding: 20px 20px 8px;
    text-align: center;
    background: transparent;
    /* Remove solid white block */
    border-bottom: none;
}

.header h1,
.header .greeting {
    font-size: 38px;
    font-weight: 900;
    /* Extra bold */
    letter-spacing: -0.06em;
    /* Ramp/Eventbrite very tight tracking */
    line-height: 1.1;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #f43f5e 0%, #3b82f6 50%, #10b981 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.header .subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
    font-weight: 400;
}

/* ─── Main Content ───────────────────────────────────────────── */

.main {
    padding: 16px;
    padding-bottom: 100px;
    max-width: 560px;
    margin: 0 auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Cards ──────────────────────────────────────────────────── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 24px;
    /* More padding for a softer feel */
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.card-header .icon {
    font-size: 28px;
    /* Larger icons */
}

.card-header h3 {
    font-size: 22px;
    /* Graphic bolder headers */
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text-primary);
}

/* ─── Forms ──────────────────────────────────────────────────── */

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input:not([type="checkbox"]),
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    /* Chunky inputs */
    background: var(--bg-input);
    border: 2px solid transparent;
    /* No border until active */
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--text-primary);
    /* Bold border for focus */
    background: var(--bg-card);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

/* Toggle */
.toggle-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 24px;
    background: #ddd;
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    border: none;
    flex-shrink: 0;
}

.toggle:checked {
    background: var(--accent);
}

.toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle:checked::after {
    left: 22px;
}

/* Range slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    outline: none;
    border: none;
    padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* ─── Buttons ────────────────────────────────────────────────── */

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--accent);
    color: #0f172a;
    /* Black text on neon green */
    border: 1px solid rgba(0, 0, 0, 0.1);
    /* Subtle dark border */
    font-size: 16px;
    /* Larger */
}

.btn-primary:hover {
    background: var(--accent-dark);
    color: #0f172a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

/* Button variants for specific integrations */
.btn-strava {
    background: #fc4c02;
    color: white;
    box-shadow: 0 4px 14px rgba(252, 76, 2, 0.3);
}

.btn-strava:hover {
    background: #e34402;
    box-shadow: 0 6px 20px rgba(252, 76, 2, 0.4);
    transform: translateY(-1px);
}

.btn-group {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.btn-group .btn {
    flex: 1;
}

/* ─── Metrics Grid ───────────────────────────────────────────── */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.span-all {
    display: block;
    width: 100%;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.metric-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
    font-weight: 500;
}

/* ─── Prompt Card ────────────────────────────────────────────── */

.prompt-card {
    background: #f9fafb;
    /* Soft gray instead of accent-light */
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.prompt-text {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.prompt-quote {
    font-size: 13px;
    color: var(--text-secondary);
    border-left: 4px solid var(--accent);
    padding-left: 16px;
    margin-top: 16px;
    line-height: 1.6;
}

.prompt-source {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}

.prompt-context {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    font-style: italic;
}

.context-badge-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.context-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    border: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.context-badge.active {
    background: var(--accent-light);
    color: var(--accent-dark);
    border-color: var(--accent);
}

/* ─── Review Section ─────────────────────────────────────────── */

.review-narrative {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* ─── Journal Side-by-Side Layout ────────────────────────────── */

.journal-layout {
    display: flex;
    flex-direction: column;
    /* Mobile: stacked */
    gap: 0;
}

.journal-col-prompt,
.journal-col-entry {
    flex: 1;
    min-width: 0;
}

@media (min-width: 768px) {
    .journal-layout {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
        gap: 24px;
        align-items: start;
    }

    .journal-col-entry {
        /* Removed position:sticky which caused overlap with recent journals */
        align-self: start;
    }
}

/* ─── Review Section ─────────────────────────────────────────── */

.review-narrative {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.review-section {
    margin-bottom: 16px;
}

.review-section h4 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.review-list {
    list-style: none;
    padding: 0;
}

.review-list li {
    padding: 6px 0;
    font-size: 14px;
    color: var(--text-secondary);
    position: relative;
    padding-left: 20px;
    line-height: 1.5;
}

.review-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--text-primary);
    font-weight: 600;
}

/* ─── Non-Negotiables ────────────────────────────────────────── */

.non-negotiable {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-input);
    border-radius: 10px;
    margin-bottom: 8px;
}

.non-negotiable .nn-icon {
    font-size: 18px;
}

.non-negotiable .nn-label {
    flex: 1;
    font-size: 14px;
    color: var(--text-secondary);
}

.non-negotiable .nn-value {
    font-size: 14px;
    font-weight: 600;
}

.nn-value.good {
    color: var(--text-primary);
}

.nn-value.warn {
    color: var(--accent-amber);
}

.nn-value.bad {
    color: var(--accent-rose);
}

/* ─── Review Period Tabs ─────────────────────────────────────── */

.review-period-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    max-width: 100%;
    box-sizing: border-box;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

.review-period-tabs::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, Opera */
}

@media (min-width: 768px) {
    .review-period-tabs {
        overflow-x: visible;
    }
}

.period-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.period-tab.active {
    background: var(--text-primary);
    color: var(--bg-card);
    font-weight: 600;
}

.period-tab:hover:not(.active) {
    background: var(--bg-input);
    color: var(--text-primary);
}

/* ─── Category Stats ─────────────────────────────────────────── */

.category-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.stat-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.stat-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ─── Progress Bars ──────────────────────────────────────────── */

.progress-bar-wrap {
    height: 4px;
    background: #eee;
    border-radius: 2px;
    overflow: hidden;
    margin: 2px 0;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.6s ease;
    min-width: 0;
}

.progress-bar.accent-blue {
    background: #5b8def;
}

.progress-bar.accent-teal {
    background: #4ecdc4;
}

/* ─── Non-Negotiable Bars ────────────────────────────────────── */

.nn-bar-wrap {
    flex: 1;
    height: 3px;
    background: #eee;
    border-radius: 2px;
    overflow: hidden;
    max-width: 80px;
}

.nn-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* ─── Tradition Pills ────────────────────────────────────────── */

.tradition-pills {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.pill {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.pill.active {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent-dark);
}

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

/* ─── Toast ──────────────────────────────────────────────────── */

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-80px);
    background: var(--accent);
    color: #0f172a;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    z-index: 200;
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast-error {
    background: var(--accent-rose);
    color: white;
}

/* ─── Spinner ────────────────────────────────────────────────── */

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #e0e0e0;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    text-align: center;
    color: var(--text-secondary);
    padding: 24px;
    font-size: 14px;
}

/* ─── History List ───────────────────────────────────────────── */

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.history-item:last-child {
    border-bottom: none;
}

.history-date {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.history-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.history-list-container {
    max-height: 350px;
    overflow-y: auto;
    padding-right: 8px;
    /* Room for scrollbar */
    /* Neatly style the scrollbar for webkit browsers */
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.history-list-container::-webkit-scrollbar {
    width: 6px;
}

.history-list-container::-webkit-scrollbar-track {
    background: transparent;
}

.history-list-container::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 10px;
}

/* ─── Responsive ─────────────────────────────────────────────── */

@media (min-width: 768px) {
    .main {
        max-width: 1100px;
        /* Wider for 2 columns */
    }

    .page.active {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
        gap: 24px;
        align-items: start;
    }

    #page-running.page.active {
        align-items: stretch;
    }

    .span-all {
        grid-column: 1 / -1;
    }

    .card {
        margin-bottom: 0;
        height: auto;
        display: flex;
        flex-direction: column;
    }

    .nav {
        top: 20px;
        bottom: auto;
        border-top: none;
        border-bottom: none;
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 30px;
        justify-content: space-around;
        padding: 8px 16px;
        gap: 12px;
        box-shadow: var(--shadow-sm);
        background: var(--bg-card);
    }

    .nav .nav-item {
        flex-direction: row;
        gap: 8px;
        padding: 8px 16px;
        border-radius: 20px;
    }

    .nav-item:hover {
        background: rgba(0, 0, 0, 0.05);
    }

    .header {
        margin-top: 80px;
        border-bottom: none;
        padding-top: 20px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .header .greeting {
        font-size: 32px;
        font-weight: 800;
        letter-spacing: -0.03em;
    }

    .header .subtitle {
        font-size: 16px;
        margin-top: 4px;
    }

    .main {
        max-width: 1100px;
        padding-top: 10px;
        padding-bottom: 60px;
    }

    .metrics-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ─── Currency Converter ─────────────────────────────────────── */

.converter-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.converter-input {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.converter-input input,
.converter-input select {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    min-height: 48px;
    font-size: 15px;
}

.converter-arrow {
    font-size: 20px;
    color: var(--text-primary);
    font-weight: bold;
    padding-top: 10px;
}

/* ─── Expense / Social History Items ─────────────────────────── */

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.history-item:last-child {
    border-bottom: none;
}

.history-item-left {
    flex: 1;
}

.history-item-left strong {
    font-size: 14px;
    color: var(--text-primary);
}

.history-item-left .item-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.history-item-right {
    text-align: right;
    white-space: nowrap;
}

.history-item-right .amount {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.history-item-right .amount-usd {
    font-size: 11px;
    color: var(--text-muted);
}

.category-badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--accent-light);
    color: var(--accent-dark);
    font-weight: 500;
    text-transform: capitalize;
    margin-top: 3px;
}

/* ─── Summary total ──────────────────────────────────────────── */

.summary-total {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    padding: 10px 0 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}

.loading-text {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    padding: 16px 0;
}

/* ─── Nav 7-item fit ─────────────────────────────────────────── */

.nav .nav-item {
    font-size: 10px;
    padding: 6px 2px;
    min-width: 0;
}

@keyframes pulse-recording {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(244, 63, 94, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 63, 94, 0);
    }
}

/* ─── Calendar Widget ────────────────────────────────────────── */

.cal-widget {
    padding: 8px 0;
}

.cal-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.cal-nav button {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 12px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: background 0.2s;
}

.cal-nav button:hover {
    background: var(--bg-input);
}

.cal-nav .cal-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

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

.cal-header-cell {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 4px 0;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    position: relative;
    transition: background 0.15s;
    cursor: default;
}

.cal-day.today {
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-light);
}

.cal-day.has-data {
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}

.cal-day.has-data:hover {
    background: var(--bg-input);
}

.cal-day .cal-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 2px;
}

/* Calendar value badges */
.cal-val-bubble {
    font-size: 8px;
    font-weight: 700;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
    line-height: 1;
}

.cal-val-capsule {
    font-size: 8px;
    font-weight: 700;
    color: #fff;
    border-radius: 8px;
    padding: 1px 5px;
    margin-top: 1px;
    line-height: 1.2;
    white-space: nowrap;
}

.cal-day.empty {
    color: transparent;
}

.cal-day-detail {
    margin-top: 12px;
    padding: 10px;
    background: var(--bg-input);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.6;
}

.cal-day-detail strong {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ─── Voice Recording UI ─────────────────────────────────────── */

.voice-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(244, 63, 94, 0.08);
    border: 1px solid rgba(244, 63, 94, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    gap: 8px;
}

.voice-status-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.voice-pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-rose);
    animation: pulse-dot 1.2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

#voice-status-text {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
}

.voice-timer {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-rose);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}


/* Voice hint text under mic button */
.voice-hint {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 2px;


    /* =========================================
   TIIMO-STYLE ACTIVITY PLANNER
   ========================================= */

    .tiimo-task-item {
        display: flex;
        align-items: center;
        background: white;
        padding: 12px 16px;
        border-radius: 16px;
        margin-bottom: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
        position: relative;
        overflow: hidden;
        transition: transform 0.2s, box-shadow 0.2s;
    }

    .tiimo-task-item:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    }

    .tiimo-task-left-bar {
        position: absolute;
        left: 0;
        top: 12px;
        bottom: 12px;
        width: 4px;
        border-radius: 0 4px 4px 0;
        background-color: #8b5cf6;
        /* default */
    }

    .tiimo-task-content {
        flex: 1;
        padding-left: 8px;
        /* space from the left bar */
    }

    .tiimo-task-title {
        font-size: 15px;
        font-weight: 600;
        color: #1f2937;
        margin-bottom: 2px;
    }

    .tiimo-task-meta {
        font-size: 12px;
        color: #6b7280;
        display: flex;
        gap: 8px;
        align-items: center;
    }

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

    .tiimo-icon-circle {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background-color: #f3f4f6;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
    }

    .tiimo-checkbox {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        border: 2px solid #d1d5db;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s;
    }

    .tiimo-checkbox.checked {
        background-color: #10b981;
        border-color: #10b981;
        color: white;
    }

    .tiimo-checkbox.checked::after {
        content: "✓";
        font-size: 14px;
        font-weight: bold;
    }

    .tiimo-task-item.completed .tiimo-task-title {
        text-decoration: line-through;
        color: #9ca3af;
    }

    /* Category Colors for left bar */
    .cat-school {
        background-color: #fbbf24;
    }

    .cat-dsa {
        background-color: #3b82f6;
    }

    .cat-courses {
        background-color: #10b981;
    }

    .cat-job {
        background-color: #8b5cf6;
    }

    .cat-daily_task {
        background-color: #64748b;
    }

    .cat-social {
        background-color: #ec4899;
    }

    .cat-fun {
        background-color: #f97316;
    }

    .cat-others {
        background-color: #9ca3af;
    }

    .cat-bg-school {
        background-color: #fef3c7;
        color: #d97706;
    }

    .cat-bg-dsa {
        background-color: #dbeafe;
        color: #2563eb;
    }

    .cat-bg-courses {
        background-color: #d1fae5;
        color: #059669;
    }

    .cat-bg-job {
        background-color: #ede9fe;
        color: #7c3aed;
    }

    .cat-bg-daily_task {
        background-color: #f1f5f9;
        color: #475569;
    }

    .cat-bg-social {
        background-color: #fdf2f8;
        color: #db2777;
    }

    .cat-bg-fun {
        background-color: #fff7ed;
        color: #ea580c;
    }

    .tiimo-task-item {
        display: flex;
        flex-direction: column;
        background: transparent;
        margin-bottom: 24px;
        position: relative;
    }

    /* Flex row to put time on left, card on right */
    .tiimo-task-row {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        gap: 16px;
    }

    /* Left side: Time and Timeline line */
    .tiimo-task-time-col {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 80px;
        flex-shrink: 0;
        position: relative;
    }

    /* Vertical line connecting tasks - stretches down */
    .tiimo-task-time-col::after {
        content: "";
        position: absolute;
        top: 24px;
        /* Start below the dot */
        bottom: -40px;
        /* Extend to the next task */
        width: 2px;
        background-color: #e5e7eb;
        z-index: 0;
        left: 50%;
        transform: translateX(-50%);
    }

    /* The actual time text */
    .tiimo-task-time-label {
        font-size: 13px;
        font-weight: 700;
        color: #4b5563;
        text-align: center;
        margin-bottom: 4px;
        font-variant-numeric: tabular-nums;
        z-index: 1;
        background: #fdfdfc;
        /* Match page bg so line doesn't cut through */
        padding: 2px 0;
    }

    /* The dot below the time */
    .tiimo-task-time-dot {
        width: 10px;
        height: 10px;
        background-color: #d1d5db;
        /* Default gray dot */
        border-radius: 50%;
        z-index: 1;
        /* To make it look like a hollow ring on the line, we can add a border */
        border: 2px solid white;
        box-shadow: 0 0 0 1px #d1d5db;
        background-color: white;
    }

    /* The Card Container - Right side */
    .tiimo-task-card {
        flex: 1;
        display: flex;
        align-items: center;
        background: white;
        padding: 16px;
        border-radius: 20px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
        position: relative;
        overflow: hidden;
        transition: transform 0.2s, box-shadow 0.2s;
        border: 1px solid rgba(0, 0, 0, 0.02);
        /* Slight definition */
    }

    .tiimo-task-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    }

    /* Left Color Bar inside the card */
    .tiimo-task-left-bar {
        position: absolute;
        left: 0;
        top: 16px;
        bottom: 16px;
        width: 4px;
        border-radius: 0 4px 4px 0;
        background-color: #8b5cf6;
    }

    .tiimo-task-content {
        display: flex;
        align-items: center;
        width: 100%;
        padding-left: 12px;
    }

    .tiimo-task-text-group {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        margin-left: 16px;
    }

    .tiimo-task-title {
        font-size: 16px;
        /* larger */
        font-weight: 800;
        /* much bolder */
        color: #111827;
        margin-bottom: 4px;
        letter-spacing: -0.01em;
    }

    .tiimo-task-meta {
        font-size: 13px;
        color: #6b7280;
    }

    .tiimo-task-actions {
        display: flex;
        align-items: center;
        gap: 16px;
        margin-left: auto;
    }

    .tiimo-icon-circle {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background-color: #f3f4f6;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
    }

    .tiimo-checkbox {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        border: 2px solid #111827;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s;
        background: transparent;
    }

    .tiimo-checkbox.checked {
        background-color: #111827;
        border-color: #111827;
        color: white;
    }

    .tiimo-checkbox.checked::after {
        content: "✓";
        font-size: 16px;
        font-weight: bold;
    }

    .tiimo-task-item.completed .tiimo-task-title {
        text-decoration: line-through;
        color: #9ca3af;
    }

    /* Category Colors for left bar */
    .cat-school {
        background-color: #fbbf24;
    }

    .cat-dsa {
        background-color: #3b82f6;
    }

    .cat-courses {
        background-color: #10b981;
    }

    .cat-job {
        background-color: #8b5cf6;
    }

    .cat-daily_task {
        background-color: #64748b;
    }

    .cat-social {
        background-color: #ec4899;
    }

    .cat-fun {
        background-color: #f97316;
    }

    .cat-others {
        background-color: #9ca3af;
    }

    .cat-bg-school {
        background-color: #fef3c7;
        color: #d97706;
    }

    .cat-bg-dsa {
        background-color: #dbeafe;
        color: #2563eb;
    }

    .cat-bg-courses {
        background-color: #d1fae5;
        color: #059669;
    }

    .cat-bg-job {
        background-color: #ede9fe;
        color: #7c3aed;
    }

    .cat-bg-daily_task {
        background-color: #f1f5f9;
        color: #475569;
    }

    .cat-bg-social {
        background-color: #fdf2f8;
        color: #db2777;
    }

    .cat-bg-fun {
        background-color: #fff7ed;
        color: #ea580c;
    }

    .cat-bg-others {
        background-color: #f3f4f6;
        color: #4b5563;
    }

    /* Pomodoro Specifics */
    .tiimo-pomodoro {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 24px 16px;
        background: #fafaf9;
        border-radius: 24px;
        margin-top: 16px;
    }

    .tiimo-pomodoro-title {
        font-family: 'Georgia', serif;
        /* Tiimo uses serif for some headers */
        font-size: 24px;
        color: #111827;
        margin-bottom: 4px;
    }

    .tiimo-pomodoro-time {
        font-size: 13px;
        color: #4b5563;
        margin-bottom: 24px;
    }

    .tiimo-pomodoro-ring {
        width: 200px;
        height: 200px;
        border-radius: 50%;
        background: conic-gradient(#8b5cf6 0%, #e5e7eb 0%);
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 24px;
        position: relative;
        box-shadow: inset 0 0 0 20px #e5e7eb;
        /* Track background via shadow hack */
    }

    /* We use a pseudo element for the inner circle */
    .tiimo-pomodoro-ring::before {
        content: "";
        position: absolute;
        inset: 20px;
        background-color: #fafaf9;
        /* match parent background */
        border-radius: 50%;
    }

    .tiimo-pomodoro-icon {
        font-size: 48px;
        position: relative;
        /* over the pseudo element */
        z-index: 1;
    }

    .tiimo-pomodoro-timer {
        font-family: 'Georgia', serif;
        font-size: 48px;
        color: #111827;
        margin-bottom: 16px;
        line-height: 1;
    }

    .tiimo-pomodoro-controls {
        display: flex;
        gap: 12px;
        align-items: center;
    }

    .tiimo-pomodoro-btn {
        background: black;
        color: white;
        border: none;
        padding: 12px 24px;
        border-radius: 24px;
        font-size: 16px;
        font-weight: 500;
        cursor: pointer;
        min-width: 80px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .tiimo-pomodoro-btn.secondary {
        background: transparent;
        color: black;
        font-weight: 600;
        font-size: 14px;
        padding: 8px;
        min-width: auto;
    }
}