/* ── 2026 Fluid Glass Design System ─────────────────── */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: rgba(255, 255, 255, 0.03);
    --bg-tertiary: rgba(255, 255, 255, 0.06);

    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.15);

    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;

    --accent-purple: #8b5cf6;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-red: #ef4444;

    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.15);

    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Ambient Background */
.ambient-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s infinite ease-in-out;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    top: -200px;
    left: -200px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    bottom: -150px;
    right: -150px;
    animation-delay: -5s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
    opacity: 0.2;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -30px) scale(1.05);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.95);
    }
}

/* Layout */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: var(--shadow-glow);
}

.brand h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.date-display {
    text-align: right;
}

.date-display .day {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.date-display .date {
    display: block;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
}

/* People Navigation */
.people-nav {
    margin-bottom: 2rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.people-nav::-webkit-scrollbar {
    display: none;
}

.people-scroll {
    display: flex;
    gap: 0.75rem;
    padding-bottom: 0.5rem;
}

.person-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem 0.5rem 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s var(--ease-spring);
    white-space: nowrap;
    backdrop-filter: blur(10px);
}

.person-chip:hover {
    background: var(--bg-tertiary);
    border-color: var(--glass-highlight);
    transform: translateY(-2px);
}

.person-chip.active {
    background: var(--chip-color, var(--accent-purple));
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.person-chip.add-new {
    border-style: dashed;
    opacity: 0.7;
}

.person-chip.add-new:hover {
    opacity: 1;
    border-style: solid;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.person-chip.active .avatar {
    background: rgba(255, 255, 255, 0.2);
}

/* Habits Grid */
.habits-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-bottom: 6rem;
}

/* Habit Card */
.habit-card {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.4s var(--ease-spring);
    animation: cardEnter 0.6s var(--ease-spring) both;
    animation-delay: calc(var(--index) * 80ms);
    backdrop-filter: blur(20px);
}

@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.card-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), var(--theme) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.habit-card:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: var(--theme);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--theme);
}

.habit-card:hover .card-glow {
    opacity: 0.05;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.habit-meta {
    display: flex;
    gap: 0.875rem;
    align-items: center;
}

.habit-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    flex-shrink: 0;
}

.habit-titles h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.streak-badge svg {
    color: #fbbf24;
}

.check-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    border: 2px solid var(--glass-border);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: all 0.3s var(--ease-spring);
    position: relative;
    overflow: hidden;
}

.check-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--theme);
    opacity: 0;
    transition: opacity 0.3s;
}

.check-btn:hover {
    border-color: var(--theme);
    color: var(--theme);
    transform: scale(1.05);
}

.check-btn.completed {
    background: var(--theme);
    border-color: var(--theme);
    color: white;
    box-shadow: 0 4px 20px var(--theme);
}

.check-btn.completed:hover {
    transform: scale(1.1);
}

.check-icon {
    position: relative;
    z-index: 1;
    transform: scale(0);
    transition: transform 0.4s var(--ease-spring);
}

.check-btn.completed .check-icon {
    transform: scale(1);
}

/* Heatmap Track */
.heatmap-track {
    display: flex;
    gap: 4px;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.track-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.track-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    background: var(--bg-tertiary);
    transition: all 0.3s var(--ease-smooth);
    min-width: 8px;
}

.track-cell.filled {
    background: var(--cell-color);
    box-shadow: 0 0 8px var(--cell-color);
    transform: scale(1.1);
}

/* Progress Bar */
.progress-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 1s var(--ease-spring);
    box-shadow: 0 0 10px currentColor;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-illustration {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 0.875rem;
}

/* Floating Action Button */
.fab-add {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    color: white;
    border: none;
    border-radius: 100px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    transition: all 0.3s var(--ease-spring);
    z-index: 50;
}

.fab-add:hover {
    transform: translateX(-50%) translateY(-4px) scale(1.05);
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.5);
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s var(--ease-smooth);
    z-index: 100;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 420px;
    padding: 2rem;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s var(--ease-spring);
    backdrop-filter: blur(40px);
    box-shadow: var(--shadow-md);
}

.modal-overlay.open .modal-card {
    transform: scale(1) translateY(0);
}

.modal-card.compact {
    max-width: 360px;
    padding: 1.5rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.modal-header {
    text-align: center;
    margin-bottom: 2rem;
}

.modal-header h2,
.modal-header h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.modal-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Stats Ring */
.stats-ring {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.ring-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.progress-ring {
    display: block;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 12;
}

.ring-progress {
    fill: none;
    stroke: var(--modal-color, var(--accent-purple));
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 565.48;
    transition: stroke-dashoffset 1.5s var(--ease-spring);
}

.ring-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ring-percent {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ring-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.25rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-box {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--glass-border);
}

.stat-box.highlight {
    background: linear-gradient(135deg, var(--bg-tertiary), rgba(251, 191, 36, 0.1));
    border-color: rgba(251, 191, 36, 0.3);
}

.stat-value {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Form Elements */
.modal-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    position: relative;
}

.input-group input {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.input-group input::placeholder {
    color: var(--text-tertiary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-md);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.3s var(--ease-spring);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: var(--glass-border);
    transform: translateY(-2px);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: translateY(-2px);
}

.btn-full {
    width: 100%;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.4s var(--ease-spring) forwards;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Responsive — Mobile first tweaks */
@media (max-width: 640px) {
    .app-container {
        padding: 1rem 0.75rem;
        padding-bottom: env(safe-area-inset-bottom, 1rem);
    }

    .app-header {
        flex-wrap: wrap;
        gap: 0.75rem;
        margin-bottom: 1.25rem;
        padding-bottom: 1rem;
    }

    .brand {
        flex: 1;
        min-width: 0;
    }

    .brand h1 {
        font-size: 1.125rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .logo {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
        flex-shrink: 0;
    }

    .date-display {
        text-align: left;
        flex-basis: 100%;
        order: 3;
        font-size: 0.8125rem;
    }

    .date-display .day,
    .date-display .date {
        font-size: 0.8125rem;
    }

    .people-nav {
        margin-bottom: 1.25rem;
        margin-left: -0.25rem;
        margin-right: -0.25rem;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    .people-scroll {
        gap: 0.5rem;
        padding-bottom: 0.25rem;
    }

    .person-chip {
        padding: 0.4rem 0.75rem 0.4rem 0.4rem;
        font-size: 0.8125rem;
    }

    .avatar {
        width: 28px;
        height: 28px;
        font-size: 0.8125rem;
    }

    .category-filter {
        margin-bottom: 1rem;
        gap: 0.375rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0.25rem;
        margin-left: -0.25rem;
        margin-right: -0.25rem;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    .category-filter::-webkit-scrollbar {
        display: none;
    }

    .cat-chip {
        padding: 0.3125rem 0.75rem;
        font-size: 0.75rem;
        flex-shrink: 0;
    }

    .habits-grid {
        padding-bottom: 5rem;
    }

    .habit-card {
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    .habit-card:hover {
        transform: translateY(-2px);
    }

    .habit-card:hover .card-glow {
        opacity: 0;
    }

    .card-header {
        flex-wrap: wrap;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .habit-meta {
        flex: 1;
        min-width: 0;
        gap: 0.625rem;
    }

    .habit-icon {
        width: 38px;
        height: 38px;
        font-size: 1.125rem;
    }

    .habit-titles h3 {
        font-size: 1rem;
        line-height: 1.3;
        word-break: break-word;
    }

    .habit-badges {
        gap: 0.375rem;
    }

    .streak-badge {
        font-size: 0.6875rem;
    }

    .streak-badge svg {
        width: 12px;
        height: 12px;
    }

    .card-actions {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.5rem;
        align-items: center;
    }

    .yesterday-btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.6875rem;
    }

    .yesterday-btn span {
        display: none;
    }

    .check-btn {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }

    .heatmap-track {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-left: -0.25rem;
        margin-right: -0.25rem;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
        margin-bottom: 0.75rem;
        scrollbar-width: none;
    }

    .heatmap-track::-webkit-scrollbar {
        display: none;
    }

    .track-col {
        flex: 0 0 auto;
    }

    .track-cell {
        min-width: 10px;
        width: 10px;
        height: 10px;
        min-height: 10px;
        aspect-ratio: 1;
    }

    .progress-bar {
        height: 3px;
    }

    .empty-state {
        padding: 2.5rem 1rem;
    }

    .empty-illustration {
        font-size: 3rem;
    }

    .empty-state h3 {
        font-size: 1.125rem;
    }

    .fab-add {
        bottom: max(1rem, env(safe-area-inset-bottom));
        left: 50%;
        transform: translateX(-50%);
        padding: 1rem;
        border-radius: 50%;
        min-width: 56px;
        min-height: 56px;
    }

    .fab-add span {
        display: none;
    }

    .fab-add:hover {
        transform: translateX(-50%) translateY(-4px) scale(1.05);
    }

    /* Modals — mobile */
    .modal-overlay {
        padding: 0.75rem;
        align-items: flex-end;
    }

    .modal-card {
        max-width: 100%;
        width: 100%;
        padding: 1.5rem;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-card.compact {
        max-width: 100%;
        padding: 1.25rem;
    }

    .modal-close {
        top: 0.75rem;
        right: 0.75rem;
        width: 32px;
        height: 32px;
    }

    .modal-header {
        margin-bottom: 1.5rem;
    }

    .modal-header h2,
    .modal-header h3 {
        font-size: 1.25rem;
    }

    .modal-header p {
        font-size: 0.8125rem;
    }

    .stats-ring {
        margin-bottom: 1.5rem;
    }

    .ring-container {
        width: 160px;
        height: 160px;
    }

    .ring-bg,
    .ring-progress {
        stroke-width: 10;
    }

    .ring-content {
        font-size: 0.9rem;
    }

    .ring-percent {
        font-size: 2rem;
    }

    .ring-label {
        font-size: 0.6875rem;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        margin-bottom: 1.5rem;
    }

    .stat-box {
        padding: 0.75rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.6875rem;
    }

    .modal-actions {
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .modal-actions .btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .input-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .input-group.half {
        flex: none;
    }

    .input-group input,
    .input-group select {
        padding: 0.875rem 1rem;
        font-size: 0.9375rem;
    }

    .day-picker {
        gap: 0.25rem;
    }

    .day-toggle span {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }

    .color-swatch span {
        width: 28px;
        height: 28px;
    }

    #toast-container {
        top: max(0.75rem, env(safe-area-inset-top));
        left: 0.75rem;
        right: 0.75rem;
        transform: none;
        max-width: calc(100vw - 1.5rem);
    }

    .toast {
        padding: 0.75rem 1rem;
        font-size: 0.8125rem;
    }
}

/* Very small screens */
@media (max-width: 380px) {
    .app-container {
        padding: 0.75rem 0.5rem;
    }

    .brand h1 {
        font-size: 1rem;
    }

    .habit-card {
        padding: 0.875rem;
    }

    .habit-titles h3 {
        font-size: 0.9375rem;
    }

    .track-cell {
        min-width: 8px;
        width: 8px;
        height: 8px;
        min-height: 8px;
    }

    .ring-container {
        width: 140px;
        height: 140px;
    }

    .ring-percent {
        font-size: 1.75rem;
    }

    .stat-value {
        font-size: 1.125rem;
    }
}

/* Mouse tracking for card glow */
.habit-card {
    --mouse-x: 50%;
    --mouse-y: 50%;
}

/* ── Category Filter ──────────────────────────────────── */
.category-filter {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.cat-chip {
    padding: 0.375rem 1rem;
    border-radius: 100px;
    border: 1px solid var(--glass-border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s var(--ease-spring);
    font-family: inherit;
}

.cat-chip:hover {
    border-color: var(--glass-highlight);
    color: var(--text-primary);
}

.cat-chip.active {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: white;
}

/* ── Habit Badges ─────────────────────────────────────── */
.habit-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cat-badge,
.freq-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 100px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cat-badge {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.freq-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

/* ── Card Actions (yesterday + check) ─────────────────── */
.card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Yesterday Button ─────────────────────────────────── */
.yesterday-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 100px;
    border: 1px solid var(--glass-border);
    background: transparent;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s var(--ease-spring);
    font-family: inherit;
    white-space: nowrap;
}

.yesterday-btn:hover {
    border-color: var(--theme);
    color: var(--theme);
    background: rgba(255, 255, 255, 0.03);
}

.yesterday-btn.done {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
}

.yesterday-btn.done:hover {
    background: rgba(16, 185, 129, 0.25);
}

/* ── Color Picker ─────────────────────────────────────── */
.color-picker-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.color-swatch {
    cursor: pointer;
}

.color-swatch input {
    display: none;
}

.color-swatch span {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid transparent;
    transition: all 0.2s var(--ease-spring);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.color-swatch input:checked+span {
    border-color: white;
    transform: scale(1.2);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.3), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.color-swatch:hover span {
    transform: scale(1.1);
}

/* ── Form Enhancements ────────────────────────────────── */
.input-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.input-row {
    display: flex;
    gap: 0.75rem;
}

.input-group.half {
    flex: 1;
}

.input-group select {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s;
    appearance: none;
    cursor: pointer;
}

.input-group select:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* ── Day Picker ───────────────────────────────────────── */
.day-picker {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.day-toggle {
    cursor: pointer;
}

.day-toggle input {
    display: none;
}

.day-toggle span {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.2s var(--ease-spring);
}

.day-toggle input:checked+span {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: white;
}

.day-toggle:hover span {
    border-color: var(--accent-purple);
}

.freq-days-group {
    margin-top: -0.25rem;
}

/* ── Best Streak Stat Box ─────────────────────────────── */
.stat-box.highlight-best {
    background: linear-gradient(135deg, var(--bg-tertiary), rgba(251, 191, 36, 0.08));
    border-color: rgba(251, 191, 36, 0.2);
}

/* ── Drag & Drop ──────────────────────────────────────── */
.habit-card[draggable="true"] {
    cursor: grab;
}

.habit-card.dragging {
    opacity: 0.4;
    transform: scale(0.95);
    cursor: grabbing;
}

.habit-card.drag-over {
    border-color: var(--accent-purple);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

/* ── Editable track cells ─────────────────────────────── */
.track-cell.editable:hover {
    outline: 2px solid rgba(255, 255, 255, 0.3);
    outline-offset: 1px;
    transform: scale(1.3);
    z-index: 2;
}
option {
    color: black;
}