/* Open Health - Minimal Monochrome Design */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Monochrome Palette */
    --black: #000000;
    --gray-900: #1a1a1a;
    --gray-800: #2a2a2a;
    --gray-700: #3a3a3a;
    --gray-600: #6a6a6a;
    --gray-500: #8a8a8a;
    --gray-400: #aaaaaa;
    --gray-300: #d0d0d0;
    --gray-200: #e5e5e5;
    --gray-100: #f5f5f5;
    --white: #ffffff;

    /* Semantic Colors */
    --primary: var(--black);
    --bg-primary: var(--white);
    --bg-secondary: var(--gray-100);
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-600);
    --border: var(--gray-300);
    --border-light: var(--gray-200);
    --shadow: rgba(0, 0, 0, 0.04);
    --hover-bg: var(--gray-100);
}

body {
    font-family: 'Lexend', -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Main Layout */
.health-container {
    display: flex;
    min-height: 100vh;
}

.health-container.no-sidebar {
    flex-direction: column;
    align-items: center;
}

.health-container.no-sidebar .main-content {
    max-width: 640px;
    width: 100%;
    padding-top: 40px;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--gray-900);
    color: white;
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.sidebar h2 {
    font-size: 1.5rem;
    margin-bottom: 30px;
    font-weight: 700;
}

.sidebar-hint {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    line-height: 1.4;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 5px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.1s;
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: none;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
}

.nav-icon {
    font-size: 1.3rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 16px;
    max-width: 1400px;
    margin: 0 auto;
    overflow-x: hidden;
    width: 100%;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: var(--bg-primary);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.05);
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.top-bar-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.top-bar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    font-weight: 700;
    font-size: 1.1rem;
}

.top-bar-brand [data-lucide] {
    width: 24px;
    height: 24px;
}

.health-container.no-sidebar .top-bar {
    flex-direction: column;
    text-align: center;
}

.health-container.no-sidebar .top-bar-actions {
    justify-content: center;
}

.top-bar-name {
    font-weight: 600;
    font-size: 1rem;
}

.top-bar-note {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.top-bar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Messages */
.message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.message.success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid var(--success);
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--danger);
}

.inline-alert {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.inline-alert.error {
    background: #fdecea;
    color: #c53030;
}

/* Page Headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}
.header-actions .btn {
    white-space: nowrap;
    text-align: center;
}

.header-date {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.1s;
    display: inline-block;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--gray-900);
    color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.btn-primary:hover {
    transform: none;
    box-shadow: 0 1px 2px rgba(102, 126, 234, 0.4);
}

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

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

.btn-small {
    padding: 8px 12px;
    font-size: 0.85rem;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-link {
    border: none;
    background: transparent;
    color: var(--gray-900);
    font-weight: 600;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 8px;
}

.btn-link:hover {
    background: var(--bg-secondary);
}

.btn-link.danger {
    color: #dc2626;
}

.btn-block {
    width: 100%;
    text-align: center;
}

/* Timeframe Controls */
.timeframe-selector {
    display: flex;
    gap: 8px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 8px;
    flex-wrap: wrap;
}

.timeframe-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.timeframe-btn:hover {
    background: var(--gray-200);
    color: var(--text-primary);
}

.timeframe-btn.active {
    background: var(--gray-900);
    color: var(--white);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.period-pill {
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}
.section-subtitle {
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.timeframe-selector--compact {
    background: transparent;
    padding: 0;
    flex-wrap: wrap;
    width: 100%;
}
.timeframe-selector--compact .timeframe-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
}
@media (max-width: 640px) {
    .timeframe-selector--compact .timeframe-btn {
        flex: 1 1 calc(50% - 6px);
        text-align: center;
    }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    gap: 15px;
}
.stats-grid--six {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

@media (max-width: 1100px) {
    .stats-grid--six {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
}

.stat-mini {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 18px 20px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
    text-align: left;
}

.stat-mini-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stat-mini-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}
.workouts-overview-grid,
.activity-overview-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.intimacy-timeframe {
    margin: 12px 0 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}
.intimacy-timeframe .timeframe-btn {
    flex: 1 1 120px;
    text-align: center;
}
.workouts-overview-grid .stat-mini,
.activity-overview-grid .stat-mini {
    min-height: 110px;
    padding: 16px 18px;
}
.stat-mini-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-mini-delta {
    margin-top: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.stat-mini-delta.over {
    color: #dc2626;
}

.stat-mini-delta.under {
    color: #16a34a;
}

.stat-mini-delta.on_target {
    color: #2563eb;
}

/* Badges & Pills */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--gray-900);
    color: #fff;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-muted {
    background: var(--gray-200);
    color: var(--gray-700);
}

.goal-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.goal-pill.over {
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
}

.goal-pill.under {
    background: rgba(22, 163, 74, 0.15);
    color: #15803d;
}

.goal-pill.on_target {
    background: rgba(37, 99, 235, 0.15);
    color: #1d4ed8;
}

.goal-callout {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 18px;
    padding: 16px 20px;
    border-radius: 12px;
    background: linear-gradient(120deg, rgba(15, 23, 42, 0.08), rgba(15, 23, 42, 0.02));
    border: 1px solid var(--border-light);
}

.goal-callout-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

.goal-callout-value {
    font-size: 1.4rem;
    font-weight: 700;
}

.goal-callout-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.table-metric {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Data Tables */
.data-card-table {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.1);
    padding: 20px;
    overflow-x: auto;
}

.data-card-table table {
    width: 100%;
    border-collapse: collapse;
}

.data-card-table thead th {
    background: transparent;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    padding: 12px 10px;
    border-bottom: 2px solid var(--gray-200);
}

.data-card-table tbody td {
    padding: 15px 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    font-size: 0.95rem;
}

.data-card-table tbody tr:hover {
    background: rgba(15, 23, 42, 0.02);
}

.data-card-table .notes-row td {
    background: rgba(15, 23, 42, 0.03);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--bg-secondary);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--gray-300);
}

.data-table td {
    padding: 15px 12px;
    border-bottom: 1px solid var(--gray-200);
}

.data-table tbody tr:hover {
    background: rgba(15, 23, 42, 0.03);
}

.data-table .notes-row td,
.notes-row td {
    background: rgba(15, 23, 42, 0.03);
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 10px 12px;
}

/* Table Actions */
.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-icon {
    padding: 6px 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: transform 0.2s, background 0.2s;
}

.btn-icon:hover {
    transform: scale(1.1);
    background: rgba(15, 23, 42, 0.06);
}

.btn-icon.btn-danger {
    color: #b91c1c;
}

.btn-icon.btn-danger:hover {
    background: rgba(185, 28, 28, 0.1);
}

.btn-back {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}

.btn-back:hover {
    text-decoration: underline;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: background 0.1s;
}

.stat-card:hover {
    box-shadow: 0 1px 2px var(--shadow);
    transform: none;
}

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

.stat-icon {
    font-size: 2rem;
}

.stat-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.stat-body {
    margin-bottom: 15px;
}

.stat-main {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-details {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

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

.stat-empty {
    color: var(--text-secondary);
    font-style: italic;
    margin: 12px 0;
}

.stat-action {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.stat-action:hover {
    text-decoration: underline;
}

/* Content Sections */
.content-section {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.integration-sync-summary {
    margin-top: 14px;
    padding: 12px 16px;
    border: 1px dashed rgba(148, 163, 184, 0.5);
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.6);
}

.integration-sync-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.integration-sync-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.integration-sync-value {
    font-weight: 600;
    color: var(--text-primary);
}

.integration-sync-pill {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.integration-sync-pill strong {
    font-weight: 600;
    color: var(--text-primary);
}

.integration-sync-pill--muted {
    background: transparent;
    border-style: dashed;
}

.integration-sync-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.integration-sync-grid .integration-sync-pill {
    border-radius: 10px;
}

.integration-sync-empty {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

@media (max-width: 640px) {
    .content-section {
        padding: 18px;
    }
    .content-section .form-grid,
    .content-section .settings-form,
    .content-section form {
        width: 100%;
    }
}


.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.intimacy-heading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.date-picker-row {
    margin-bottom: 20px;
}

.date-picker-row input[type="date"] {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
}
.entries-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.entries-header .date-picker-row {
    width: auto;
    margin-bottom: 0;
}
.entries-header input[type="date"] {
    width: auto;
    min-width: 200px;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1rem;
}

/* Forms */
.form-container {
    max-width: 1200px;
    margin: 0 auto;
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.form-header h1 {
    margin: 0;
    color: var(--text-primary);
    font-size: 2rem;
}

.form-card {
    background: var(--bg-secondary);
    padding: 14px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
}

.form-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.form-section h3 {
    margin: 0 0 20px 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 700;
}

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

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-hint {
    margin-top: 15px;
    padding: 12px 15px;
    background: #f0f4ff;
    border-left: 3px solid var(--primary);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

/* Input Styling */
input[type="date"],
input[type="time"] {
    cursor: pointer;
}

/* Lists and Items */
.item-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.item-card {
    background: var(--bg-secondary);
    padding: 14px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: background 0.1s;
    border-left: 4px solid var(--primary);
}

.item-card:hover {
    box-shadow: 0 1px 2px var(--shadow);
    transform: none;
}

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

.item-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    text-decoration: none;
    font-size: 1.2rem;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.1s;
    background: var(--bg-primary);
    cursor: pointer;
    border: none;
}

.action-btn:hover {
    background: var(--border);
    transform: none;
}

.action-btn.delete:hover {
    background: #fed7d7;
}

/* Badge and Tags */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-primary);
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* Activity Heatmap (GitHub-style) */
.activity-heatmap {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.heatmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.heatmap-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.heatmap-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.heatmap-days-labels {
    display: flex;
    flex-direction: column;
    gap: 3px;
    justify-content: space-around;
    padding-top: 20px;
}

.heatmap-day-label {
    height: 12px;
    font-size: 10px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    line-height: 12px;
}

.heatmap-months-and-grid {
    display: flex;
    flex-direction: column;
}

.heatmap-months {
    display: flex;
    gap: 3px;
    margin-bottom: 5px;
    height: 15px;
}

.heatmap-month {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 600;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 12px);
    grid-auto-flow: column;
    grid-template-rows: repeat(7, 12px);
    gap: 3px;
    max-width: fit-content;
}

.heatmap-day {
    width: 12px;
    height: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s;
    position: relative;
}

.heatmap-day:hover {
    transform: none;
    box-shadow: 0 1px 2px var(--shadow);
    z-index: 100;
}

.heatmap-day[data-level="0"] {
    background: #ebedf0;
}

.heatmap-day[data-level="1"] {
    background: #c6e48b;
}

.heatmap-day[data-level="2"] {
    background: #7bc96f;
}

.heatmap-day[data-level="3"] {
    background: #239a3b;
}

.heatmap-day[data-level="4"] {
    background: #196127;
}

.heatmap-day::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: none translateY(-8px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.heatmap-day:hover::after {
    opacity: 1;
}

.heatmap-stats {
    display: flex;
    gap: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.heatmap-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.heatmap-stat strong {
    color: var(--text-primary);
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.heatmap-legend-item {
    width: 12px;
    height: 12px;
    border-radius: 8px;
}

/* Responsive Design */
@media (max-width: 968px) {
    .health-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 14px;
    }

    .nav-menu {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 10px;
    }

    .main-content {
        padding: 14px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        text-align: center;
    }
}

/* Supplement Stacks */
.stacks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.stack-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 1px 2px var(--shadow);
    transition: background 0.1s;
    border: 2px solid var(--border);
}

.stack-card:hover {
    box-shadow: 0 1px 3px var(--shadow);
    border-color: var(--primary);
}

.stack-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.stack-header h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin: 0;
}

.stack-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
    font-style: italic;
}

.stack-supplements {
    margin: 10px 0;
    padding: 15px;
    background: var(--bg-primary);
    border-radius: 8px;
}

.stack-supplements-header {
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

.supplement-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.supplement-list li:last-child {
    border-bottom: none;
}

.supplement-bullet {
    font-size: 1rem;
}

.supplement-name {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
}

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

.stack-footer {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Stack Form - Dynamic Supplement Rows */
.supplement-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.supplement-row-fields {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr;
    gap: 10px;
    flex: 1;
}

.supplement-row input,
.supplement-row select {
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.supplement-row input:focus,
.supplement-row select:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-remove {
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.1s;
    flex-shrink: 0;
}

.btn-remove:hover {
    background: #e53e3e;
    transform: none;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 1rem;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Stack Tracking */
.tracking-stacks {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tracking-stack-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 2px var(--shadow);
    border: 2px solid var(--border);
}

.tracking-stack-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.tracking-stack-header h3 {
    font-size: 1.4rem;
    margin: 0;
    color: var(--text-primary);
}

.stack-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-text {
    font-weight: 600;
    color: var(--primary);
    min-width: 50px;
}

.progress-bar {
    width: 150px;
    height: 8px;
    background: var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gray-900);
    transition: width 0.3s ease;
}

.progress-bar--wide {
    width: 100%;
    max-width: 520px;
    height: 16px;
}

.progress-bar--wide .progress-fill {
    display: flex;
    align-items: center;
}

.tracking-supplements {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.supplement-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s;
    border: 2px solid transparent;
}

.supplement-checkbox:hover {
    background: white;
    border-color: var(--primary);
}

.supplement-checkbox input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--primary);
}

.supplement-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

/* Adherence Chart */
.adherence-chart {
    padding: 14px;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow-x: auto;
}

.chart-bars {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    min-height: 200px;
}

.chart-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex: 1;
}

.chart-bar {
    width: 100%;
    min-height: 4px;
    max-height: 180px;
    background: var(--bg-primary);
    border-radius: 8px 4px 0 0;
    position: relative;
    cursor: pointer;
    transition: background 0.1s;
}

.chart-bar:hover {
    transform: none;
    z-index: 100;
}

.chart-bar-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: var(--gray-900);
    border-radius: 8px 4px 0 0;
}

.chart-bar::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: none translateY(-8px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.chart-bar:hover::after {
    opacity: 1;
}

.chart-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Adherence Heatmap */
.adherence-heatmap {
    display: grid;
    grid-template-columns: repeat(auto-fill, 20px);
    gap: 4px;
    padding: 14px;
    background: var(--bg-secondary);
    border-radius: 8px;
    max-width: fit-content;
}

.adherence-day {
    width: 20px;
    height: 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s;
    position: relative;
}

.adherence-day:hover {
    transform: none;
    box-shadow: 0 1px 2px var(--shadow);
    z-index: 100;
}

.adherence-day[data-level="0"] {
    background: #ebedf0;
}

.adherence-day[data-level="1"] {
    background: #ffd6a5;
}

.adherence-day[data-level="2"] {
    background: #fdab3d;
}

.adherence-day[data-level="3"] {
    background: #fd8c24;
}

.adherence-day[data-level="4"] {
    background: #f57c00;
}

.adherence-day::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: none translateY(-8px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.adherence-day:hover::after {
    opacity: 1;
}

.adherence-legend {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 15px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.adherence-legend-item {
    width: 16px;
    height: 16px;
    border-radius: 8px;
}

.adherence-legend-item[data-level="0"] {
    background: #ebedf0;
}

.adherence-legend-item[data-level="1"] {
    background: #ffd6a5;
}

.adherence-legend-item[data-level="2"] {
    background: #fdab3d;
}

.adherence-legend-item[data-level="3"] {
    background: #fd8c24;
}

.adherence-legend-item[data-level="4"] {
    background: #f57c00;
}

/* Supplement Details List */
.supplement-details-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.supplement-detail-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 2px solid var(--border);
    transition: background 0.1s;
}

.supplement-detail-card:hover {
    border-color: var(--primary);
    box-shadow: 0 1px 2px var(--shadow);
}

.supplement-icon {
    font-size: 2rem;
}

.supplement-detail-content h4 {
    margin: 0 0 5px 0;
    color: var(--text-primary);
}

.supplement-detail-dosage {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Intimacy Tracking */
.intimacy-entries {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.intimacy-entry-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 1px 2px var(--shadow);
    border: 2px solid var(--border);
    transition: background 0.1s;
}

.intimacy-entry-card:hover {
    border-color: var(--primary);
    box-shadow: 0 1px 2px var(--shadow);
}

.intimacy-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.intimacy-entry-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.intimacy-time, .intimacy-duration, .intimacy-rating {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.intimacy-entry-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.intimacy-field {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.intimacy-field strong {
    color: var(--text-secondary);
    margin-right: 8px;
}

.intimacy-stats-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.intimacy-stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: var(--bg-primary);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.intimacy-notes {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border-left: 3px solid var(--primary);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
}

.recent-timeline {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timeline-item {
    display: flex;
    gap: 15px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s;
    border: 2px solid transparent;
}

.timeline-item:hover {
    border-color: var(--primary);
    background: white;
}

.timeline-date {
    font-weight: 600;
    color: var(--primary);
    min-width: 60px;
}

.timeline-content {
    flex: 1;
    color: var(--text-secondary);
}

.timeline-rating {
    float: right;
    color: var(--text-primary);
    font-weight: 500;
}

/* Stats Table */
.stats-table {
    overflow-x: auto;
}

.stats-table table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.stats-table th {
    background: var(--bg-primary);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border);
}

.stats-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.stats-table tr:last-child td {
    border-bottom: none;
}

.stats-table tr:hover {
    background: var(--bg-primary);
}

/* Calendar View - Compact List */
.calendar-view {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.calendar-item {
    display: grid;
    grid-template-columns: 70px 1fr auto;
    align-items: center;
    gap: 15px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: background 0.1s;
}

.calendar-item:hover {
    border-color: var(--primary);
    box-shadow: 0 1px 2px var(--shadow);
}

.calendar-item-time {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
}

.calendar-item-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendar-item-content strong {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.calendar-item-content .dosage {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-left: 8px;
}

.calendar-item-notes {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 4px;
    font-style: italic;
}

.calendar-item-actions {
    display: flex;
    gap: 8px;
}

/* Entry mode switch / ingredient builder */
.entry-mode-switch {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.entry-mode-btn {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    text-align: left;
    background: var(--bg-primary);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.entry-mode-btn.active {
    border-color: var(--gray-900);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.entry-mode-btn .mode-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.entry-mode-btn .mode-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.entry-panel {
    display: none;
}

.entry-panel.is-active {
    display: block;
}

.ingredient-builder {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.food-description-group {
    margin-bottom: 20px;
}

.ingredient-header,
.ingredient-row {
    display: grid;
    grid-template-columns: 2fr repeat(5, minmax(70px, 1fr)) auto;
    gap: 8px;
    align-items: center;
}

.ingredient-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
}

.ingredient-row input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.ingredient-row .remove-ingredient {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
}

.ingredient-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.9rem;
}

.food-api-cta {
    background: linear-gradient(135deg, #1f2a44, #172041);
    border-radius: 20px;
    padding: 24px 28px;
    color: #e2e8f0;
    margin: 24px 0;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.45);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.food-api-cta__header h3 {
    margin: 8px 0;
    font-size: 1.6rem;
}

.food-api-cta__pill {
    display: inline-flex;
    padding: 6px 14px;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    border-radius: 999px;
    background: rgba(255,255,255,0.1);
    text-transform: uppercase;
}

.food-api-cta__steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.food-api-cta__steps div {
    background: rgba(15, 23, 42, 0.35);
    border-radius: 14px;
    padding: 14px;
}

.food-api-cta__steps p {
    margin: 0;
    line-height: 1.4;
    color: #f8fafc;
}

.step-number {
    display: inline-flex;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #38bdf8;
    color: #0f172a;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 8px;
}

.food-api-cta__hint {
    font-size: 0.9rem;
    color: rgba(248, 250, 252, 0.8);
    margin-bottom: 8px;
}

.food-api-cta pre {
    margin: 0;
    background: rgba(7, 11, 24, 0.6);
    color: #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    font-size: 0.85rem;
    overflow-x: auto;
    border: 1px solid rgba(255,255,255,0.1);
}

.habit-tracker-card {
    background: var(--bg-secondary);
    border-radius: 16px;
}

.habit-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.habit-date-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.habit-date-form input[type="date"] {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
}

.habit-timescale-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.habit-timescale-btn {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
}

.habit-timescale-btn.active {
    background: #1f2937;
    color: #fff;
}

.habit-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 20px;
}

.habit-summary-progress {
    min-width: 160px;
}

.habit-progress-value {
    font-size: 2.2rem;
    font-weight: 700;
}

.habit-total-count {
    margin-top: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.habit-summary-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.habit-summary-stat {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 10px 14px;
    min-width: 110px;
}

.habit-summary-stat .stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.habit-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.habit-column {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid var(--border);
}

.habit-column--graph {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 16px;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: 16px;
    border: 1px solid var(--border);
}


.habit-circles-row {
    margin: 18px 0 6px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-primary);
}

.habit-heatmap-row {
    margin: 0;
    display: flex;
    justify-content: flex-start;
}

.habit-heatmap-row [data-habit-heatmap-container] {
    width: 100%;
}

.habit-heatmap-card {
    width: 100%;
    padding: 12px 14px;
    gap: 10px;
}

.habit-progress-circles {
    display: grid;
    grid-template-columns: repeat(7, minmax(70px, 1fr));
    gap: 14px;
}

.habit-progress-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    gap: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 4px;
}

.habit-progress-circle:focus-visible {
    outline: 2px solid #111827;
    outline-offset: 2px;
}

.habit-progress-circle-meter {
    --habit-progress: 0%;
    width: 70px;
    aspect-ratio: 1/1;
    border-radius: 50%;
    background: conic-gradient(#22c55e var(--habit-progress), rgba(148, 163, 184, 0.3) var(--habit-progress) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-weight: 600;
    position: relative;
    box-shadow: inset 0 0 0 6px var(--bg-primary);
}

.habit-progress-circle-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.habit-progress-circle-day {
    font-weight: 600;
    color: var(--text-primary);
}

.habit-progress-circle-date {
    font-size: 0.75rem;
}

@media (max-width: 900px) {
    .habit-progress-circles {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    }
}

.habit-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.habit-archived-block {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px dashed rgba(148, 163, 184, 0.4);
    margin-bottom: 18px;
}

.habit-archived-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.habit-archived-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.habit-archived-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    padding: 8px 10px;
    border: 1px dashed rgba(148, 163, 184, 0.4);
    border-radius: 10px;
    background: rgba(247, 250, 252, 0.4);
}

.habit-archived-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.habit-archived-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.habit-archived-empty {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.habit-unarchive-btn {
    border: none;
    background: rgba(34,197,94,0.12);
    color: #15803d;
    border-radius: 999px;
    padding: 4px 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
}

.habit-unarchive-btn i {
    width: 16px;
    height: 16px;
}

.habit-delete-btn {
    border: none;
    background: rgba(248,113,113,0.15);
    color: #b91c1c;
    border-radius: 999px;
    padding: 4px 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
}

.habit-delete-btn i {
    width: 16px;
    height: 16px;
}

.habit-archived-toggle-form {
    margin-bottom: 12px;
    display: flex;
    justify-content: flex-end;
}

.habit-filter-toggle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.habit-filter-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.habit-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 10px;
    background: var(--bg-primary);
}

.habit-item-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.habit-item-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.habit-system-chip {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 12px;
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
    margin-left: 6px;
    text-transform: uppercase;
}

.habit-toggle {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.habit-toggle-btn {
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-secondary);
    border-radius: 999px;
    cursor: pointer;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.habit-toggle-btn--done.active {
    background: rgba(34, 197, 94, 0.12);
    border-color: #22c55e;
    color: #22c55e;
}

.habit-toggle-btn--not_done.active {
    background: rgba(248, 113, 113, 0.12);
    border-color: #f87171;
    color: #f87171;
}

.habit-toggle-btn--untracked.active {
    background: rgba(148, 163, 184, 0.15);
    border-color: rgba(148, 163, 184, 0.9);
    color: #64748b;
}

.habit-toggle-btn svg {
    width: 18px;
    height: 18px;
}

.habit-item-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.habit-edit-btn,
.habit-archive-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
}

.habit-edit-btn:hover,
.habit-archive-btn:hover {
    color: var(--text-primary);
    background: rgba(148, 163, 184, 0.15);
}

.habit-edit-row {
    display: none;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.habit-item.is-editing .habit-edit-row {
    display: flex;
}

.habit-edit-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.habit-edit-actions {
    display: flex;
    gap: 10px;
}

.habit-item.is-editing .habit-item-meta {
    opacity: 0.6;
}

.habit-add-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.habit-add-form input {
    flex: 1;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.habit-graph canvas {
    width: 100%;
    min-height: 280px;
}

.habit-empty {
    color: var(--text-secondary);
    padding: 20px 0;
    text-align: center;
}

.habit-heatmap-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.habit-heatmap-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.habit-heatmap-card-header h3 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.habit-heatmap-card-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.habit-heatmap-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.habit-heatmap-legend-label {
    font-size: 0.75rem;
}

.habit-heatmap-legend-scale {
    display: inline-flex;
    gap: 4px;
}

.habit-heatmap-legend-swatch {
    width: 20px;
    height: 10px;
    border-radius: 4px;
    border: 1px solid rgba(15,23,42,0.1);
}

.habit-heatmap-panels {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.habit-heatmap-grid-panel {
    display: inline-flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.habit-heatmap-grid-shell {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.habit-heatmap-weekdays {
    display: grid;
    grid-template-rows: repeat(7, 1fr);
    font-size: 0.65rem;
    color: var(--text-secondary);
    padding-top: 4px;
    gap: 4px;
    align-content: stretch;
}

.habit-heatmap-weekdays span:nth-child(2) {
    margin-top: 0;
}

.habit-heatmap-grid {
    display: grid;
    grid-template-rows: repeat(7, 1fr);
    grid-auto-flow: column;
    grid-auto-columns: 12px;
    column-gap: 4px;
    row-gap: 4px;
    width: fit-content;
    padding-right: 6px;
}

.habit-heatmap-cell {
    width: 12px;
    height: 12px;
    aspect-ratio: 1 / 1;
    border-radius: 3px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    cursor: pointer;
    background: var(--bg-secondary);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.habit-heatmap-cell:focus,
.habit-heatmap-cell:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.2);
}

.habit-heatmap-cell--level-0 {
    background: var(--bg-secondary);
}

.habit-heatmap-cell--level-1 {
    background: #dcfce7;
}

.habit-heatmap-cell--level-2 {
    background: #86efac;
}

.habit-heatmap-cell--level-3 {
    background: #22c55e;
}

.habit-heatmap-cell--level-4 {
    background: #15803d;
}

.habit-heatmap-cell--empty {
    border-style: dashed;
    opacity: 0.5;
}

.habit-heatmap-range {
    font-size: 0.75rem;
    color: var(--text-secondary);
}


.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Auth and Profile */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 120px);
}

.auth-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 30px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
}

.auth-header h1 {
    font-size: 1.5rem;
    margin-bottom: 6px;
}

.auth-header p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-switch {
    text-align: center;
    margin-top: 15px;
    color: var(--text-secondary);
}

.auth-switch a {
    font-weight: 600;
}

.profile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.danger-zone {
    border: 1px solid rgba(220, 38, 38, 0.3);
    background: rgba(220, 38, 38, 0.05);
}

.sidebar-hint,
.input-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

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

    .stat-main {
        font-size: 2rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .calendar-item {
        grid-template-columns: 60px 1fr auto;
        gap: 10px;
        padding: 10px 12px;
    }

    .calendar-item-time {
        font-size: 0.85rem;
    }
}

/* Lucide Icon Styling */
[data-lucide] {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    vertical-align: middle;
    display: inline-block;
}

.sidebar-icon {
    width: 24px;
    height: 24px;
    vertical-align: middle;
    margin-right: 8px;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.page-header h1 [data-lucide] {
    width: 28px;
    height: 28px;
    vertical-align: middle;
    margin-right: 8px;
}

.btn [data-lucide],
.action-btn [data-lucide] {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 6px;
}

.status-icon [data-lucide] {
    width: 24px;
    height: 24px;
}

.connection-status.connected .status-icon [data-lucide] {
    stroke: #10b981;
    fill: none;
}

.connection-status.disconnected .status-icon [data-lucide] {
    stroke: var(--gray-600);
    fill: none;
}

/* Icon-only buttons */
.btn-icon [data-lucide],
.action-btn [data-lucide] {
    width: 18px;
    height: 18px;
    margin-right: 0;
}

/* Section headers with icons */
.section-header h2 [data-lucide] {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    vertical-align: middle;
}

/* Stat icons */
.stat-icon [data-lucide] {
    width: 40px;
    height: 40px;
}

/* Empty state icons */
.empty-icon [data-lucide] {
    width: 64px;
    height: 64px;
    opacity: 0.3;
}
.health-container.no-sidebar .top-bar-actions {
    justify-content: center;
}
.sexual-header {
    flex-wrap: wrap;
    gap: 16px;
}
.sexual-header .header-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}
.intimacy-header-timeframes {
    width: 100%;
    margin: 0 0 10px;
}
.activity-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.intimacy-header-actions {
    align-items: flex-start;
    flex-direction: column;
    width: 100%;
    gap: 12px;
}
.add-entry-btn {
    width: auto;
    white-space: nowrap;
}
.intimacy-header-cta {
    width: 100%;
    display: flex;
    justify-content: flex-start;
}
.intimacy-header-timeframes {
    flex-wrap: wrap;
    width: 100%;
}
.intimacy-header-timeframes .timeframe-btn {
    padding: 6px 12px;
}
.header-actions input[type="date"] {
    padding: 10px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
}
@media (max-width: 768px) {
    .sexual-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .sexual-header .header-title {
        order: 0;
        width: 100%;
    }
    .intimacy-header-actions {
        width: 100%;
    }
    .intimacy-header-timeframes {
        width: 100%;
        margin-left: 0;
        order: 1;
    }
    .intimacy-header-cta {
        order: 2;
        width: 100%;
    }
    .activity-header-actions {
        width: 100%;
        margin-top: 10px;
        justify-content: flex-start;
    }
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .header-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        align-items: stretch;
    }
    .intimacy-header-timeframes .timeframe-btn {
        flex: 1 1 calc(50% - 6px);
        text-align: center;
    }
}
