/* =========================================================
   HabitFlow – Design System & Styles
   ========================================================= */

/* ---------- CSS Variables ---------- */
:root {
    --bg-base: #0D0F12;
    --bg-surface: #161A20;
    --bg-elevated: #1E242D;
    --bg-hover: #242B36;
    --border: rgba(255, 255, 255, 0.07);
    --border-light: rgba(255, 255, 255, 0.12);

    --text-primary: #F0F4FF;
    --text-secondary: #8892A4;
    --text-muted: #4A5568;

    --accent: #7C3AED;
    --accent-light: #9D5FFF;
    --accent-glow: rgba(124, 58, 237, 0.25);

    --green: #10B981;
    --teal: #0EA5E9;
    --amber: #F59E0B;
    --red: #EF4444;
    --pink: #EC4899;
    --orange: #F97316;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;

    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.6);

    --sidebar-w: 240px;
    --topbar-h: 72px;
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);

    --font: 'Inter', system-ui, sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    line-height: 1.6;
}

button {
    font-family: var(--font);
    cursor: pointer;
    border: none;
    background: none;
}

input,
textarea,
select {
    font-family: var(--font);
}

ul {
    list-style: none;
}

img {
    display: block;
    max-width: 100%;
}

#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    transition: transform var(--transition);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 18px;
    border-bottom: 1px solid var(--border);
}

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

.logo-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.6));
    animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {

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

    50% {
        transform: scale(1.1);
    }
}

.logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-light), var(--teal));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-toggle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    padding: 4px;
    border-radius: var(--radius-sm);
    display: none;
}

.nav-section {
    padding: 20px 12px 12px;
    flex: 1;
}

.nav-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    padding: 0 8px;
    margin-bottom: 10px;
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    position: relative;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(14, 165, 233, 0.1));
    color: var(--text-primary);
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.3);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: linear-gradient(180deg, var(--accent-light), var(--teal));
    border-radius: 0 4px 4px 0;
}

.nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 16px 20px;
    border-top: 1px solid var(--border);
}

.streak-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(239, 68, 68, 0.1));
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius);
    padding: 12px 14px;
}

.streak-flame {
    font-size: 1.5rem;
    animation: flicker 1.5s ease-in-out infinite;
}

@keyframes flicker {

    0%,
    100% {
        transform: scale(1) rotate(-2deg);
    }

    50% {
        transform: scale(1.15) rotate(2deg);
    }
}

.streak-info {
    display: flex;
    flex-direction: column;
}

.streak-count {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--amber);
    leading-trim: both;
}

.streak-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* =========================================================
   MAIN CONTENT
   ========================================================= */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---------- Top Bar ---------- */
.top-bar {
    height: var(--topbar-h);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: rgba(13, 15, 18, 0.6);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.mobile-menu-btn {
    display: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    padding: 6px;
    border-radius: var(--radius-sm);
}

.page-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.page-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.date-chip {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 5px 13px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ---------- Primary Button ---------- */
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 9px 20px;
    border-radius: 99px;
    transition: all var(--transition);
    box-shadow: 0 0 0 0 var(--accent-glow);
    white-space: nowrap;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-ghost {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 9px 18px;
    border-radius: 99px;
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: linear-gradient(135deg, #B91C1C, var(--red));
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 9px 20px;
    border-radius: 99px;
    transition: all var(--transition);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

/* =========================================================
   VIEW SYSTEM
   ========================================================= */
.view-container {
    padding: 28px;
    flex: 1;
}

.view {
    display: none;
    animation: fadeUp 0.35s var(--transition);
}

.view.active {
    display: block;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

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

/* =========================================================
   TODAY VIEW
   ========================================================= */
.progress-ring-wrap {
    display: flex;
    align-items: center;
    gap: 32px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 36px;
    margin-bottom: 28px;
    box-shadow: var(--shadow);
}

.progress-card {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.ring-svg {
    width: 120px;
    height: 120px;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: var(--bg-elevated);
    stroke-width: 10;
}

.ring-fill {
    fill: none;
    stroke: url(#ringGradient);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 314;
    stroke-dashoffset: 314;
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.6));
}

.ring-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ring-percent {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
}

.ring-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.today-meta {
    display: flex;
    align-items: center;
    gap: 24px;
}

.meta-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.meta-val {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.meta-lbl {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meta-divider {
    width: 1px;
    height: 36px;
    background: var(--border);
}

/* Filter Tabs */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
}

.filter-tabs {
    display: flex;
    gap: 6px;
}

.filter-tab {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 5px 14px;
    border-radius: 99px;
    transition: all var(--transition);
}

.filter-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

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

/* Habit Cards (Today) */
.habits-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.habit-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    cursor: default;
}

.habit-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 0 4px 4px 0;
}

.habit-item:hover {
    border-color: var(--border-light);
    transform: translateX(2px);
    box-shadow: var(--shadow);
}

.habit-item.done {
    opacity: 0.7;
}

.habit-item.done .habit-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

.check-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition);
    font-size: 0.85rem;
}

.check-btn:hover {
    transform: scale(1.1);
}

.check-btn.checked {
    background: var(--green);
    border-color: var(--green);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
    color: #fff;
}

.habit-main {
    flex: 1;
    min-width: 0;
}

.habit-name {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.habit-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
}

.habit-cat {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.habit-streak-pill {
    display: flex;
    align-items: center;
    gap: 3px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 99px;
    padding: 1px 8px;
    font-size: 0.7rem;
    color: var(--amber);
    font-weight: 600;
}

/* ---------- All Habits Grid ---------- */
.habits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.habit-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.habit-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.habit-card:hover {
    border-color: var(--border-light);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

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

.card-icon-wrap {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.card-actions {
    display: flex;
    gap: 4px;
}

.action-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: all var(--transition);
}

.action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.action-btn.del:hover {
    background: rgba(239, 68, 68, 0.12);
    color: var(--red);
}

.card-name {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.card-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    min-height: 18px;
}

.card-stats {
    display: flex;
    gap: 16px;
}

.card-stat-item {
    display: flex;
    flex-direction: column;
}

.card-stat-val {
    font-size: 1.1rem;
    font-weight: 700;
}

.card-stat-lbl {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mini-bar-wrap {
    margin-top: 14px;
}

.mini-bar-bg {
    background: var(--bg-elevated);
    border-radius: 99px;
    height: 5px;
    overflow: hidden;
}

.mini-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.8s ease;
}

/* =========================================================
   STATS VIEW
   ========================================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all var(--transition);
}

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

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

.stat-body {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.6rem;
    font-weight: 800;
}

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

.accent-purple {
    border-color: rgba(124, 58, 237, 0.3);
    background: linear-gradient(135deg, var(--bg-surface), rgba(124, 58, 237, 0.07));
}

.accent-purple .stat-number {
    color: var(--accent-light);
}

.accent-teal {
    border-color: rgba(14, 165, 233, 0.3);
    background: linear-gradient(135deg, var(--bg-surface), rgba(14, 165, 233, 0.07));
}

.accent-teal .stat-number {
    color: var(--teal);
}

.accent-orange {
    border-color: rgba(249, 115, 22, 0.3);
    background: linear-gradient(135deg, var(--bg-surface), rgba(249, 115, 22, 0.07));
}

.accent-orange .stat-number {
    color: var(--orange);
}

.accent-pink {
    border-color: rgba(236, 72, 153, 0.3);
    background: linear-gradient(135deg, var(--bg-surface), rgba(236, 72, 153, 0.07));
}

.accent-pink .stat-number {
    color: var(--pink);
}

/* Performance list */
.performance-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.perf-item {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}

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

.perf-name {
    font-size: 0.875rem;
    font-weight: 600;
}

.perf-rate {
    font-size: 0.875rem;
    font-weight: 700;
}

.perf-bar-bg {
    background: var(--bg-elevated);
    border-radius: 99px;
    height: 6px;
    overflow: hidden;
}

.perf-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 1s ease;
}

/* =========================================================
   HISTORY VIEW (HEATMAP)
   ========================================================= */
.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.heatmap-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    overflow-x: auto;
    margin-bottom: 24px;
}

.heatmap-grid {
    display: flex;
    gap: 3px;
}

.heatmap-week {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.heatmap-cell {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    cursor: pointer;
    transition: transform 0.1s;
}

.heatmap-cell:hover {
    transform: scale(1.4);
}

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

.heatmap-cell.level-1 {
    background: rgba(124, 58, 237, 0.25);
}

.heatmap-cell.level-2 {
    background: rgba(124, 58, 237, 0.45);
}

.heatmap-cell.level-3 {
    background: rgba(124, 58, 237, 0.7);
}

.heatmap-cell.level-4 {
    background: var(--accent-light);
    box-shadow: 0 0 6px rgba(124, 58, 237, 0.5);
}

/* Daily Log */
.daily-log {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.log-entry {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.log-date {
    font-size: 0.875rem;
    font-weight: 600;
}

.log-pills {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.log-pill {
    background: var(--bg-elevated);
    border-radius: 99px;
    padding: 2px 10px;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.log-pill.done {
    background: rgba(16, 185, 129, 0.12);
    color: var(--green);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.log-rate {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.log-rate.perfect {
    color: var(--green);
}

/* =========================================================
   EMPTY STATE
   ========================================================= */
.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 64px 24px;
    text-align: center;
}

.empty-state.show {
    display: flex;
}

.empty-icon {
    font-size: 3rem;
    filter: drop-shadow(0 0 12px rgba(124, 58, 237, 0.4));
    animation: breathe 3s ease-in-out infinite;
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

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

/* =========================================================
   MODAL
   ========================================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    padding: 16px;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 540px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.96) translateY(12px);
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
}

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

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

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

.modal-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.modal-close {
    color: var(--text-muted);
    font-size: 1rem;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

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

.modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 22px;
    border-top: 1px solid var(--border);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-input {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 10px 13px;
    outline: none;
    transition: border-color var(--transition);
    width: 100%;
}

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

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.form-select {
    appearance: none;
}

/* Category Grid */
.category-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cat-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 6px 14px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.cat-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.cat-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* Color Picker */
.color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all var(--transition);
}

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

.color-dot.active {
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
    transform: scale(1.15);
}

/* =========================================================
   TOAST
   ========================================================= */
.toast-container {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 12px 20px;
    font-size: 0.875rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 320px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

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

.toast.success {
    border-color: rgba(16, 185, 129, 0.4);
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.4);
}

.toast-icon {
    font-size: 1rem;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 400;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .mobile-menu-btn {
        display: flex;
    }

    .sidebar-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0;
    }

    .top-bar {
        padding: 0 16px;
    }

    .view-container {
        padding: 16px;
    }

    .progress-ring-wrap {
        flex-direction: column;
        align-items: flex-start;
        gap: 18px;
        padding: 20px;
    }

    .today-meta {
        gap: 16px;
    }

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

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

    .date-chip {
        display: none;
    }
}

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

    .habits-grid {
        grid-template-columns: 1fr;
    }

    .meta-val {
        font-size: 1.5rem;
    }
}