/* ==========================================================================
   ATOMIC HABITS TRACKER DESIGN SYSTEM (PREMIUM DARK GLASSMORPHISM)
   ========================================================================== */

:root {
    --bg-main: #090d16;
    --bg-sidebar: #0e1423;
    --bg-card: rgba(19, 27, 46, 0.65);
    --bg-card-hover: rgba(28, 39, 64, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-active: rgba(255, 255, 255, 0.18);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Core Glowing Accents */
    --clr-emerald: #10b981;
    --clr-emerald-glow: rgba(16, 185, 129, 0.2);
    --clr-blue: #3b82f6;
    --clr-blue-glow: rgba(59, 130, 246, 0.2);
    --clr-purple: #8b5cf6;
    --clr-purple-glow: rgba(139, 92, 246, 0.2);
    --clr-orange: #f59e0b;
    --clr-orange-glow: rgba(245, 158, 11, 0.2);
    --clr-rose: #f43f5e;
    --clr-rose-glow: rgba(244, 63, 94, 0.2);
    
    --sidebar-width: 280px;
    --mobile-nav-height: 70px;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Rich background ambient glows */
.glow-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(150px);
    opacity: 0.15;
}

.glow-1 {
    top: -10%;
    right: 5%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--clr-blue) 0%, transparent 70%);
}

.glow-2 {
    bottom: 5%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--clr-purple) 0%, transparent 70%);
}

/* App Core Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 2.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 3.5rem;
}

.brand-icon {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--clr-blue) 0%, var(--clr-purple) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.35);
}

.brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.brand .subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.nav-item i {
    width: 20px;
    height: 20px;
    transition: var(--transition-smooth);
}

.nav-item:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border-color);
}

.nav-item.active i {
    color: var(--clr-blue);
    filter: drop-shadow(0 0 8px var(--clr-blue-glow));
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.philosophy-quote {
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
    padding: 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    text-align: center;
}

.philosophy-quote p {
    font-style: italic;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.philosophy-quote cite {
    color: var(--text-muted);
    font-size: 0.75rem;
    display: block;
}

/* Main Content Panel */
.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    padding: 2.5rem 3rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header/Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.welcome h2 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.welcome p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition-bounce);
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--clr-blue) 0%, var(--clr-purple) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

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

.btn-danger:hover {
    background-color: #e11d48;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px var(--clr-rose-glow);
}

.btn-block {
    width: 100%;
    padding: 0.95rem;
}

/* Tab Sections */
.tab-content {
    display: none;
    flex-grow: 1;
    animation: fadeIn 0.4s ease-out;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

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

.stat-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: var(--transition-smooth);
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-color-active);
    background-color: var(--bg-card-hover);
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon i {
    width: 26px;
    height: 26px;
}

.completed-glow {
    background-color: var(--clr-emerald-glow);
    color: var(--clr-emerald);
}

.streak-glow {
    background-color: var(--clr-orange-glow);
    color: var(--clr-orange);
}

.alert-glow {
    background-color: var(--clr-rose-glow);
    color: var(--clr-rose);
}

.alert-glow.safe {
    background-color: var(--clr-emerald-glow);
    color: var(--clr-emerald);
}

.stat-info {
    flex-grow: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.25rem;
}

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.progress-bar-container {
    height: 6px;
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--clr-blue) 0%, var(--clr-emerald) 100%);
    border-radius: 10px;
    transition: width 0.5s ease-out;
}

/* Habits Dashboard */
.habits-section {
    flex-grow: 1;
}

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

.section-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.filter-tabs {
    display: flex;
    gap: 0.5rem;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.25rem;
    border-radius: 10px;
}

.filter-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.45rem 1rem;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.filter-btn:hover {
    color: var(--text-primary);
}

.filter-btn.active {
    background-color: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.habits-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    background-color: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.empty-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--clr-blue);
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.1);
}

.empty-icon i {
    width: 32px;
    height: 32px;
}

.empty-state h4 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 400px;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Habit Card (Gorgeous UI) */
.habit-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.habit-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--habit-color, var(--clr-blue));
}

.habit-card:hover {
    border-color: var(--border-color-active);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.habit-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.habit-title-container {
    flex-grow: 1;
}

.habit-header-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.35rem;
}

.habit-name {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.badge-2min {
    background-color: rgba(59, 130, 246, 0.12);
    color: var(--clr-blue);
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.badge-avoidance {
    background-color: rgba(244, 63, 94, 0.12);
    color: var(--clr-rose);
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.habit-formula {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.habit-formula span {
    color: var(--text-primary);
    font-weight: 500;
}

.habit-stats-pills {
    display: flex;
    gap: 0.85rem;
    align-items: center;
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
}

.stat-pill.streak {
    color: var(--clr-orange);
    border-color: rgba(245, 158, 11, 0.2);
}

.stat-pill.success-rate {
    color: var(--clr-emerald);
    border-color: rgba(16, 185, 129, 0.2);
}

.stat-pill.alert-pill {
    color: var(--clr-orange);
    background-color: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.3);
    animation: pulseBorder 2s infinite;
}

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

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.icon-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.08);
}

.icon-btn.delete:hover {
    color: white;
    background-color: var(--clr-rose);
    border-color: var(--clr-rose);
}

/* Calendar Grid Row (Rolling 21 days visualizer) */
.track-grid-container {
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
}

.track-grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.grid-cells-row {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.grid-cell {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: var(--transition-bounce);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    user-select: none;
    position: relative;
}

.grid-cell:hover {
    transform: scale(1.1);
    z-index: 10;
    border-color: rgba(255, 255, 255, 0.2);
}

.grid-cell.active-today {
    border-color: var(--habit-color, var(--clr-blue));
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.1);
}

.grid-cell.completed {
    background-color: var(--habit-color, var(--clr-blue));
    border-color: transparent;
    color: white;
    box-shadow: 0 0 10px var(--habit-glow, var(--clr-blue-glow));
}

.grid-cell.completed::after {
    content: '✓';
    font-weight: bold;
    font-size: 0.8rem;
}

.grid-cell.missed {
    background-color: rgba(244, 63, 94, 0.06);
    border-color: rgba(244, 63, 94, 0.2);
    color: var(--clr-rose);
}

.grid-cell.missed::after {
    content: '×';
    font-weight: bold;
    font-size: 0.8rem;
}

/* Tooltip overlay styling */
.grid-cell::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background-color: #0b0f19;
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    color: var(--text-primary);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
    z-index: 20;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.grid-cell:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Modal Overlay & Card */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(6, 9, 17, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
    padding: 1.5rem;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background-color: #0e1423;
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 600px;
    border-radius: 24px;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: var(--transition-bounce);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal-card {
    transform: scale(1) translateY(0);
}

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

.modal-header h3 {
    font-size: 1.35rem;
    font-weight: 700;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-body {
    padding: 2rem;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
}

/* Form Styling */
.form-group {
    margin-bottom: 1.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="text"], select {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

input[type="text"]:focus, select:focus {
    outline: none;
    border-color: var(--clr-blue);
    background-color: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Stacking Builder UI */
.stacking-inputs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    flex-wrap: wrap;
}

.formula-prefix {
    color: var(--clr-blue);
    font-weight: 600;
    font-size: 0.95rem;
}

.stacking-inputs input[type="text"] {
    flex: 1 1 200px;
    background: none;
    border: none;
    border-bottom: 1px dashed var(--text-muted);
    border-radius: 0;
    padding: 0.2rem 0;
    font-size: 0.95rem;
}

.stacking-inputs input[type="text"]:focus {
    border-bottom-color: var(--clr-blue);
    box-shadow: none;
    background: none;
}

.formula-action-placeholder {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
}

/* Quick templates horizontally scrollable list */
.templates-scroll {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.25rem 0.25rem 0.75rem 0;
    scrollbar-width: thin;
}

.template-chip {
    flex: 0 0 auto;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.45rem 0.85rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-bounce);
}

.template-chip:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.08);
    transform: scale(1.03);
}

/* Custom Color Picker */
.color-picker {
    display: flex;
    gap: 0.75rem;
    padding-top: 0.25rem;
}

.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition-bounce);
}

.color-btn:hover {
    transform: scale(1.15);
}

.color-btn.active {
    border-color: white;
    transform: scale(1.15);
}

.color-btn.emerald { background-color: var(--clr-emerald); }
.color-btn.blue { background-color: var(--clr-blue); }
.color-btn.purple { background-color: var(--clr-purple); }
.color-btn.orange { background-color: var(--clr-orange); }
.color-btn.rose { background-color: var(--clr-rose); }

/* Tab Content: Wisdom Panel */
.wisdom-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.wisdom-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.wisdom-card.highlight {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-color: rgba(59, 130, 246, 0.2);
}

@media (min-width: 1024px) {
    .wisdom-card.highlight {
        padding: 3rem;
    }
}

.quote-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quote-icon {
    width: 36px;
    height: 36px;
    color: var(--clr-blue);
    opacity: 0.5;
}

.badge {
    background-color: var(--clr-blue-glow);
    color: var(--clr-blue);
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.wisdom-card h2 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.wisdom-explanation {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    margin-top: 0.5rem;
}

.wisdom-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.wisdom-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.wisdom-examples {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.wisdom-examples li {
    padding: 0.5rem 0.75rem;
    background-color: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    font-size: 0.85rem;
    border-left: 3px solid var(--clr-blue);
}

.wisdom-examples li span {
    font-weight: 600;
}

.stacking-formula {
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    padding: 0.85rem;
    border-radius: 8px;
    text-align: center;
}

.stacking-formula code {
    font-family: monospace;
    color: var(--clr-purple);
    font-size: 0.9rem;
}

.benefits-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.benefit-item {
    display: flex;
    gap: 1rem;
}

.benefit-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--clr-blue-glow);
    color: var(--clr-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.benefit-item h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.benefit-item p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Tab Content: Analytics */
.analytics-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.analytics-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
}

.card-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.chart-placeholder {
    display: flex;
    align-items: center;
    gap: 3rem;
    padding: 1rem 0;
    flex-wrap: wrap;
}

.consistency-rate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 6px solid var(--clr-blue);
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.15);
    flex-shrink: 0;
}

.consistency-rate h2 {
    font-size: 2.25rem;
    font-weight: 700;
}

.consistency-rate span {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.bars-container {
    flex-grow: 1;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 150px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
    overflow-x: auto;
}

.analytics-bar-wrapper {
    flex: 1;
    min-width: 30px;
    max-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: 100%;
    justify-content: flex-end;
}

.analytics-bar {
    width: 100%;
    background: linear-gradient(180deg, var(--clr-blue) 0%, var(--clr-purple) 100%);
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.analytics-bar::before {
    content: attr(data-value);
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0;
    transition: var(--transition-smooth);
}

.analytics-bar-wrapper:hover .analytics-bar::before {
    opacity: 1;
}

.bar-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    max-width: 100%;
}

.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

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

.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background-color: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.breakdown-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.breakdown-value {
    font-weight: 700;
    font-size: 0.95rem;
}

.streak-records {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.streak-record-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.streak-record-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background-color: var(--clr-orange-glow);
    color: var(--clr-orange);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Settings */
.settings-container {
    max-width: 800px;
}

.action-box {
    padding: 1.5rem;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    margin-bottom: 1.5rem;
}

.action-box h4 {
    font-size: 1.05rem;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.action-box p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    line-height: 1.4;
}

.action-box.danger {
    border-color: rgba(244, 63, 94, 0.2);
    background-color: rgba(244, 63, 94, 0.02);
}

/* Confetti Effect Shell */
.sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
    animation: sparkleAnim 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

/* Mobile Nav Bar and Mobile Styling */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--mobile-nav-height);
    background-color: var(--bg-sidebar);
    border-top: 1px solid var(--border-color);
    z-index: 200;
    justify-content: space-around;
    align-items: center;
    padding: 0.5rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    flex: 1;
}

.mobile-nav-item i {
    width: 20px;
    height: 20px;
}

.mobile-nav-item.active {
    color: var(--clr-blue);
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
    .sidebar {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        padding: 1.5rem 1.5rem calc(var(--mobile-nav-height) + 1.5rem) 1.5rem;
    }
    
    .mobile-nav {
        display: flex;
    }

    .top-bar {
        margin-bottom: 2rem;
    }
}

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

@keyframes pulseBorder {
    0% {
        border-color: rgba(245, 158, 11, 0.3);
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.2);
    }
    70% {
        border-color: rgba(245, 158, 11, 0.6);
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
    }
    100% {
        border-color: rgba(245, 158, 11, 0.3);
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

@keyframes sparkleAnim {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--x, 50px), var(--y, -50px)) scale(0);
        opacity: 0;
    }
}

/* ==========================================================================
   DAILY MEMOS / CHECKLIST COMPONENT STYLES
   ========================================================================== */

.dashboard-layout-split {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    align-items: stretch;
}

@media (min-width: 1100px) {
    .dashboard-layout-split {
        display: grid;
        grid-template-columns: 1.7fr 1fr;
        gap: 2.5rem;
        align-items: start;
    }
}

.habits-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.memos-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.memos-section {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    transition: var(--transition-smooth);
}

.memos-section:hover {
    border-color: var(--border-color-active);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Memo Add Form */
.memo-add-form {
    display: flex;
    flex-direction: column;
    background-color: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 0.75rem;
    transition: var(--transition-smooth);
}

.memo-add-form:focus-within {
    border-color: rgba(59, 130, 246, 0.4);
    background-color: rgba(255, 255, 255, 0.03);
}

.memo-input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.memo-input-wrapper input[type="text"] {
    flex-grow: 1;
    background: none;
    border: none;
    padding: 0.5rem 0.25rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.memo-input-wrapper input[type="text"]:focus {
    outline: none;
    box-shadow: none;
    background: none;
}

.btn-toggle-scheduler {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-bounce);
}

.btn-toggle-scheduler:hover,
.btn-toggle-scheduler.active {
    color: var(--clr-blue);
    background-color: var(--clr-blue-glow);
    border-color: rgba(59, 130, 246, 0.3);
}

.btn-memo-add {
    background: linear-gradient(135deg, var(--clr-blue) 0%, var(--clr-purple) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-bounce);
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
}

.btn-memo-add:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(59, 130, 246, 0.35);
}

/* Scheduler Drawer Styling */
.memo-scheduler-drawer {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.memo-scheduler-drawer.expanded {
    max-height: 180px;
    opacity: 1;
    margin-top: 0.75rem;
    border-top: 1px dashed var(--border-color);
    padding-top: 0.75rem;
}

.drawer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.drawer-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.drawer-field:last-child {
    grid-column: 1 / -1;
}

.drawer-field label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.drawer-field input,
.drawer-field select {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    transition: var(--transition-smooth);
}

.drawer-field input:focus,
.drawer-field select:focus {
    border-color: var(--clr-blue);
    background-color: rgba(0, 0, 0, 0.3);
}

/* Memo Filter Tabs */
.memo-filter-tabs {
    display: flex;
    gap: 0.35rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.memo-filter-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.memo-filter-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.memo-filter-btn.active {
    color: var(--clr-blue);
    background-color: var(--clr-blue-glow);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Memos List */
.memos-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.06) transparent;
}

.memos-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    border: 1px dashed var(--border-color);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.memos-empty-state p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Memo Item */
.memo-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: var(--transition-smooth);
    gap: 0.75rem;
    animation: fadeIn 0.3s ease-out;
}

.memo-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: var(--border-color-active);
}

.memo-item-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    flex-grow: 1;
    cursor: pointer;
    user-select: none;
}

.memo-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    color: transparent;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.memo-item-content:hover .memo-checkbox {
    border-color: var(--clr-blue);
}

.memo-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-grow: 1;
    overflow: hidden;
}

.memo-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.4;
    transition: var(--transition-smooth);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    max-width: 240px;
}

@media (min-width: 1400px) {
    .memo-text {
        max-width: 320px;
    }
}

/* Scheduler / Repeat Labels in Memo Card */
.memo-schedule-pills {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    align-items: center;
}

.memo-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.memo-pill.overdue {
    background-color: rgba(244, 63, 94, 0.12);
    color: var(--clr-rose);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.memo-pill.today {
    background-color: rgba(245, 158, 11, 0.12);
    color: var(--clr-orange);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.memo-pill.upcoming {
    background-color: rgba(59, 130, 246, 0.12);
    color: var(--clr-blue);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.memo-pill.recurring {
    background-color: rgba(139, 92, 246, 0.12);
    color: var(--clr-purple);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

/* Completed State */
.memo-item.completed {
    border-color: rgba(255, 255, 255, 0.04);
    background-color: rgba(255, 255, 255, 0.005);
}

.memo-item.completed .memo-checkbox {
    background-color: var(--clr-emerald);
    border-color: var(--clr-emerald);
    color: white;
    box-shadow: 0 0 8px var(--clr-emerald-glow);
}

.memo-item.completed .memo-checkbox::after {
    content: '✓';
}

.memo-item.completed .memo-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.memo-item.completed .memo-pill {
    opacity: 0.5;
    background-color: rgba(255, 255, 255, 0.04) !important;
    color: var(--text-muted) !important;
    border-color: transparent !important;
}

/* Manual Habit Completion Button */
.complete-today-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0 0.75rem;
    height: 34px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid rgba(59, 130, 246, 0.2);
    background-color: rgba(59, 130, 246, 0.05);
    color: #60a5fa;
}

.complete-today-btn:hover {
    background-color: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
}

.complete-today-btn.completed {
    background-color: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
    color: #34d399;
}

.complete-today-btn.completed:hover {
    background-color: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

/* Memo Actions & Dynamic Date Picker */
.memo-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.memo-date-picker-wrapper {
    position: relative;
    display: inline-block;
}

.memo-date-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.memo-date-input::-webkit-calendar-picker-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
}

/* Inline Habit Title Edit */
.habit-name {
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.habit-name:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.habit-name-input {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 0.15rem 0.4rem;
    outline: none;
    width: auto;
    max-width: 250px;
    font-family: inherit;
    transition: var(--transition-smooth);
}

.habit-name-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--clr-blue);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}

/* ---- Sync Indicator ---- */
.sync-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.02em;
}
.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--clr-emerald);
    transition: background 0.4s;
}
.sync-dot.syncing {
    background: var(--clr-orange);
    animation: pulse-dot 1s ease-in-out infinite;
}
.sync-dot.ok { background: var(--clr-emerald); }
.sync-dot.error { background: var(--clr-rose); }
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

/* ---- Emoji Picker ---- */
.habit-name-emoji-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.emoji-pick-btn {
    font-size: 1.4rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition-smooth);
}
.emoji-pick-btn:hover { background: rgba(255,255,255,0.1); }
.emoji-palette {
    display: none;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.6rem;
    background: rgba(19, 27, 46, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-top: 0.4rem;
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1.6;
}
.emoji-palette.open { display: flex; }
.emoji-palette span, .emoji-palette { user-select: none; }

/* ---- Days of Week Picker ---- */
.days-picker {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.3rem;
}
.day-btn {
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.day-btn:hover { border-color: var(--clr-blue); color: var(--clr-blue); }
.day-btn.active {
    background: var(--clr-blue-glow);
    border-color: var(--clr-blue);
    color: var(--clr-blue);
}

/* ---- Heatmap ---- */
.heatmap-container { overflow-x: auto; padding-bottom: 0.5rem; }
.heatmap-grid { display: flex; flex-direction: column; gap: 3px; min-width: 500px; }
.heatmap-row { display: flex; gap: 3px; }
.heatmap-cell {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: rgba(255,255,255,0.05);
    flex-shrink: 0;
    transition: transform 0.15s;
    cursor: default;
}
.heatmap-cell:hover { transform: scale(1.3); }
.heatmap-cell.empty { opacity: 0; pointer-events: none; }
.heatmap-cell.level-0 { background: rgba(255,255,255,0.06); }
.heatmap-cell.level-1 { background: rgba(16, 185, 129, 0.25); }
.heatmap-cell.level-2 { background: rgba(16, 185, 129, 0.45); }
.heatmap-cell.level-3 { background: rgba(16, 185, 129, 0.7); }
.heatmap-cell.level-4 { background: #10b981; box-shadow: 0 0 6px rgba(16,185,129,0.5); }

/* ---- Sidebar quote fade ---- */
#sidebar-quote-text {
    transition: opacity 0.4s ease;
}

/* ---- Top bar actions gap ---- */
.actions { gap: 0.6rem; }

/* ---- Enhanced Mobile Layout Improvements ---- */
@media (max-width: 768px) {
    /* Stack top bar actions */
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
    }
    
    .actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .actions .sync-indicator {
        width: 100%;
        margin-bottom: 0.25rem;
    }
    
    .actions .btn {
        flex: 1; /* Make buttons expand evenly side-by-side */
        justify-content: center;
        padding: 0.65rem 0.5rem;
        font-size: 0.85rem;
    }

    /* Compress the habit card for smaller screens */
    .habit-card {
        padding: 1.25rem;
        gap: 1rem;
    }
    
    .habit-stats-pills {
        flex-wrap: wrap;
    }
    
    .habit-actions-menu {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .complete-today-btn {
        flex: 1; /* Stretch the complete button to fill width */
    }
    
    .icon-btn {
        flex-shrink: 0;
    }

    /* Modal spacing */
    .modal-card {
        margin: 1rem;
        width: calc(100% - 2rem);
        max-height: calc(100vh - 2rem);
        border-radius: 16px;
    }
    
    .modal-header, .modal-body {
        padding: 1.25rem;
    }
    
    .modal-body {
        max-height: calc(100vh - 140px);
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    /* Memos compress */
    .memo-item {
        padding: 0.75rem 1rem;
    }
}

/* ==========================================================================
   MOBILE SEGMENTED CONTROLLER & COMPRESSED STATS STYLES
   ========================================================================== */
.mobile-dashboard-segmented-tabs {
    display: none;
}

@media (max-width: 768px) {
    /* Mobile-only segmented controller display */
    .mobile-dashboard-segmented-tabs {
        display: flex;
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid var(--border-color);
        border-radius: 14px;
        padding: 0.25rem;
        margin-bottom: 1.25rem;
        gap: 0.25rem;
        backdrop-filter: blur(12px);
    }
    
    .mobile-dashboard-tab-btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        padding: 0.65rem 0.5rem;
        background: transparent;
        border: none;
        border-radius: 10px;
        color: var(--text-secondary);
        font-size: 0.85rem;
        font-weight: 600;
        cursor: pointer;
        transition: var(--transition-smooth);
    }
    
    .mobile-dashboard-tab-btn i {
        width: 14px;
        height: 14px;
        transition: transform 0.2s ease;
    }
    
    .mobile-dashboard-tab-btn:active i {
        transform: scale(0.9);
    }
    
    .mobile-dashboard-tab-btn.active {
        background: rgba(59, 130, 246, 0.12);
        color: var(--clr-blue);
        border: 1px solid rgba(59, 130, 246, 0.2);
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
    }
    
    /* Fluid Column / Section Toggle display */
    .dashboard-layout-split.show-habits .habits-column {
        display: flex !important;
    }
    .dashboard-layout-split.show-habits .memos-column {
        display: none !important;
    }
    
    .dashboard-layout-split.show-memos .habits-column {
        display: none !important;
    }
    .dashboard-layout-split.show-memos .memos-column {
        display: flex !important;
    }
    .dashboard-layout-split.show-memos .memos-section {
        display: flex !important;
    }
    .dashboard-layout-split.show-memos .scratchpad-section {
        display: none !important;
    }
    
    .dashboard-layout-split.show-scratchpad .habits-column {
        display: none !important;
    }
    .dashboard-layout-split.show-scratchpad .memos-column {
        display: flex !important;
    }
    .dashboard-layout-split.show-scratchpad .memos-section {
        display: none !important;
    }
    .dashboard-layout-split.show-scratchpad .scratchpad-section {
        display: flex !important;
        margin-top: 0 !important; /* Reset margin on notes subtab */
    }

    /* High-density mobile stats grid */
    .stats-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.4rem !important;
        margin-bottom: 1.25rem !important;
    }
    
    .stat-card {
        padding: 0.65rem 0.4rem !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 0.3rem !important;
        border-radius: 12px !important;
    }
    
    .stat-icon {
        width: 32px !important;
        height: 32px !important;
        margin: 0 !important;
    }
    
    .stat-icon i {
        width: 15px !important;
        height: 15px !important;
    }
    
    .stat-info {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }
    
    .stat-label {
        font-size: 0.65rem !important;
        white-space: nowrap;
    }
    
    .stat-card h3 {
        font-size: 0.9rem !important;
        margin-top: 0.1rem !important;
    }
    
    .stat-subtext, .progress-bar-container {
        display: none !important; /* Hide layout clutter */
    }

    /* Screen spacing optimization */
    .main-content {
        padding: 1rem 1rem calc(var(--mobile-nav-height) + 1rem) 1rem !important;
    }
    
    .top-bar {
        margin-bottom: 1.25rem !important;
    }
    
    .habits-section, .memos-section {
        padding: 1rem !important;
        border-radius: 16px !important;
    }
    
    .section-header h3 {
        font-size: 1.05rem !important;
    }
}

