:root {
    --bg-color: #0F172A; /* Deep Navy Background */
    --card-bg: #1E293B; /* Slate Card Background */
    --accent-color: #3B82F6; /* Bright Blue Accent */
    --success-color: #10B981; /* Vibrant Green Success */
    --text-main: #F8FAFC; /* Slate-50 Main Text */
    --text-secondary: #94A3B8; /* Slate-400 Secondary Text */
    --border-color: #334155; /* Slate-700 Border */
    --tab-bg: rgba(15, 23, 42, 0.8); /* Translucent Navy for Nav */
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

input,
textarea,
select,
option,
[contenteditable="true"] {
    user-select: text;
    -webkit-user-select: text;
    -ms-user-select: text;
}

/* Container for all pages */
#app {
    flex: 1;
    overflow-y: auto;
    padding-bottom: calc(85px + var(--safe-bottom)); /* Nav height + padding */
    transition: opacity 0.3s ease;
}

.page {
    display: none;
    padding: 0 20px; /* Reduced vertical padding */
    animation: fadeIn 0.4s ease-out;
}

#habits.page {
    padding: 0; /* Remove padding for sticky header to go edge-to-edge */
}

#statistics.page {
    padding: 0;
}

.stats-container {
    padding: 20px;
}

/* Sticky Header Habits */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.7); /* Match --bg-color but semi-transparent */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 15px 20px 5px 20px; /* Adjusted top padding */
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: box-shadow 0.3s ease;
}

.sticky-header.scrolled {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
}

.motivation-quote {
    text-align: center;
    font-weight: 600; /* Semi-bold for clarity */
    color: var(--text-main); /* Softer white for eye comfort */
    font-size: 15px;
    margin: 0 0 15px 0;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05); /* More subtle background */
    border-radius: 12px;
    line-height: 1.5; /* Better line spacing for readability */
    word-wrap: break-word;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-style: normal; /* Normal straight font as requested */
    letter-spacing: 0.01em;
}

.sticky-header h1 {
    margin-bottom: 12px; /* Reduced margin inside sticky header */
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
}

.habits-list {
    padding: 0 20px; /* Re-add padding to list */
    position: relative;
    min-height: 100px;
}

/* Update global streak position for new header structure */
.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* iOS Typography */
h1 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 24px;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

/* --- GLOBAL STREAK INDICATOR --- */
.global-streak-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 159, 10, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(255, 159, 10, 0.2);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    z-index: 100;
}

.global-streak-container.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.global-streak-icon {
    font-size: 18px;
    filter: drop-shadow(0 0 5px rgba(255, 159, 10, 0.5));
}

.global-streak-count {
    font-size: 16px;
    font-weight: 800;
    color: #FF9F0A;
}

/* Streak Levels & Effects */
/* 4–7 hari → scale 1.2 + glow ringan */
.streak-level-1 {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(255, 159, 10, 0.3);
}

/* 8–14 hari → scale 1.3 + animasi pulse */
.streak-level-2 {
    transform: scale(1.3);
    box-shadow: 0 0 15px rgba(255, 159, 10, 0.5);
    animation: streak-pulse 2s infinite ease-in-out;
}

/* 15+ hari → scale 1.5 + efek api menyala */
.streak-level-3 {
    transform: scale(1.5);
    background: linear-gradient(135deg, rgba(255, 69, 58, 0.3), rgba(255, 159, 10, 0.3));
    border-color: rgba(255, 159, 10, 0.6);
    box-shadow: 0 0 25px rgba(255, 159, 10, 0.8);
    animation: streak-fire 1.2s infinite alternate ease-in-out;
}

@keyframes streak-pulse {
    0% { transform: scale(1.3); box-shadow: 0 0 15px rgba(255, 159, 10, 0.5); }
    50% { transform: scale(1.35); box-shadow: 0 0 25px rgba(255, 159, 10, 0.7); }
    100% { transform: scale(1.3); box-shadow: 0 0 15px rgba(255, 159, 10, 0.5); }
}

@keyframes streak-fire {
    0% { transform: scale(1.5) rotate(-2deg); box-shadow: 0 0 25px rgba(255, 69, 58, 0.6); }
    100% { transform: scale(1.55) rotate(2deg); box-shadow: 0 0 35px rgba(255, 159, 10, 0.9); }
}

.streak-update-anim {
    animation: streak-bump 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes streak-bump {
    0% { transform: scale(1); }
    50% { transform: scale(1.6); filter: brightness(1.5) contrast(1.2); }
    100% { transform: scale(1); }
}

/* Achievement Popup */
.achievement-popup {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--card-bg);
    padding: 20px 30px;
    border-radius: 20px;
    border: 2px solid var(--accent-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 2000;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.achievement-popup.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: all;
}

.achievement-popup .badge-icon {
    font-size: 60px;
}

.achievement-popup .badge-name {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent-color);
}

.achievement-popup .badge-desc {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
}

h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-main);
}

.subtext {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-body {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

#app.auth-app {
    padding: 24px 20px;
    padding-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(900px 500px at 20% 10%, rgba(59, 130, 246, 0.22), transparent 60%),
        radial-gradient(900px 500px at 80% 30%, rgba(16, 185, 129, 0.14), transparent 60%),
        radial-gradient(700px 450px at 50% 90%, rgba(255, 159, 10, 0.10), transparent 55%);
    pointer-events: none;
    z-index: 0;
    filter: saturate(1.1);
    animation: auth-bg 10s ease-in-out infinite alternate;
}

.auth-body::after {
    content: "";
    position: fixed;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.85), rgba(15, 23, 42, 1)),
        radial-gradient(1px 1px at 20px 30px, rgba(255, 255, 255, 0.10), transparent 45%),
        radial-gradient(1px 1px at 90px 120px, rgba(255, 255, 255, 0.08), transparent 45%),
        radial-gradient(1px 1px at 160px 80px, rgba(255, 255, 255, 0.06), transparent 45%);
    background-size: auto, 220px 220px, 220px 220px, 220px 220px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.9;
}

#app.auth-app,
.auth-card {
    position: relative;
    z-index: 1;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: rgba(30, 41, 59, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transform: translateY(0);
    animation: auth-float 4.8s ease-in-out infinite;
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 22px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(16, 185, 129, 0.55), rgba(255, 159, 10, 0.45));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.35;
}

.auth-card::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 24px;
    background: radial-gradient(600px 220px at 30% 0%, rgba(255, 255, 255, 0.12), transparent 60%);
    pointer-events: none;
    opacity: 0.9;
}

.auth-header {
    text-align: center;
    margin-bottom: 14px;
}

.auth-logo {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: block;
    margin: 2px auto 10px;
    object-fit: cover;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.auth-title {
    margin: 0 0 6px 0;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.03em;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.4;
}

.auth-alert {
    border-radius: 16px;
    padding: 12px 14px;
    margin: 14px 0 14px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    font-weight: 700;
}

.auth-alert-error {
    border-color: rgba(255, 69, 58, 0.45);
    background: rgba(255, 69, 58, 0.08);
    color: #FF453A;
}

.auth-alert-success {
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.08);
    color: rgba(16, 185, 129, 1);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-label {
    font-size: 12px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    font-weight: 900;
    color: var(--text-secondary);
}

.auth-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.55);
    color: var(--text-main);
    font-size: 16px;
    outline: none;
    transition: box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.auth-input::placeholder {
    color: rgba(148, 163, 184, 0.85);
}

.auth-input:focus {
    border-color: rgba(59, 130, 246, 0.8);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
}

.auth-input-row {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-row .auth-input {
    padding-right: 44px;
}

.auth-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(30, 41, 59, 0.45);
    color: rgba(248, 250, 252, 0.9);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

.auth-toggle:active {
    transform: translateY(-50%) scale(0.96);
}

.auth-toggle svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.auth-submit {
    margin-top: 6px;
    border-radius: 16px;
    font-weight: 900;
    letter-spacing: 0.2px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 1), rgba(99, 102, 241, 1));
    box-shadow: 0 14px 40px rgba(59, 130, 246, 0.22);
    transition: transform 0.15s ease, filter 0.2s ease;
}

.auth-submit:active {
    transform: scale(0.99);
    filter: brightness(0.98);
}

.auth-footer {
    margin-top: 14px;
    display: flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
}

.auth-input.auth-input-static {
    text-align: left;
    line-height: 1.45;
    font-size: 13px;
    font-weight: 750;
    color: rgba(226, 232, 240, 0.88);
    white-space: normal;
}

.auth-link {
    color: var(--accent-color);
    font-weight: 900;
    text-decoration: none;
}

@keyframes auth-bg {
    0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.95; }
    100% { transform: translate3d(0, -8px, 0) scale(1.02); opacity: 1; }
}

@keyframes auth-float {
    0% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
    100% { transform: translateY(0); }
}

.subscribe-app {
    padding: 22px 20px;
    padding-bottom: 26px;
    max-width: 520px;
    margin: 0 auto;
}

.subscribe-page-title {
    text-align: center;
    margin-bottom: 14px;
    font-size: 28px;
    font-weight: 900;
}

.subscribe-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 20px;
    padding: 18px 16px;
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    margin-bottom: 14px;
}

.subscribe-section-title {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.subscribe-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.subscribe-row:last-of-type {
    border-bottom: none;
}

.subscribe-label {
    font-size: 14px;
    color: rgba(248, 250, 252, 0.9);
    font-weight: 700;
}

.subscribe-value {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: right;
    font-weight: 700;
}

.subscribe-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    font-weight: 900;
    letter-spacing: 0.2px;
}

.subscribe-status-active {
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.35);
}

.subscribe-status-locked {
    color: #FF9F0A;
    background: rgba(255, 159, 10, 0.08);
    border-color: rgba(255, 159, 10, 0.35);
}

.subscribe-status-wait {
    color: rgba(59, 130, 246, 1);
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.35);
}

.subscribe-note {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.subscribe-bank-box {
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 16px;
    padding: 12px 14px;
}

.subscribe-bank-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px;
    padding: 6px 0;
}

.subscribe-bank-label {
    color: rgba(248, 250, 252, 0.9);
    font-weight: 800;
    font-size: 13px;
}

.subscribe-bank-value {
    color: var(--text-secondary);
    font-weight: 800;
    font-size: 13px;
    text-align: right;
}

.subscribe-alert {
    border-radius: 16px;
    padding: 12px 14px;
    margin: 10px 0 14px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(255, 255, 255, 0.04);
    font-weight: 800;
}

.subscribe-alert-error {
    border-color: rgba(255, 69, 58, 0.45);
    background: rgba(255, 69, 58, 0.08);
    color: #FF453A;
}

.subscribe-alert-success {
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.08);
    color: var(--success-color);
}

.subscribe-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.subscribe-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.subscribe-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.55);
    color: var(--text-main);
    font-size: 16px;
    outline: none;
}

.subscribe-file {
    width: 100%;
    padding: 10px 12px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.55);
    color: var(--text-main);
    font-size: 14px;
}

.subscribe-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

/* --- BOTTOM NAVIGATION --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(80px + var(--safe-bottom)); /* Menambah tinggi container agar ikon bisa naik lebih tinggi */
    background: var(--tab-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: calc(20px + var(--safe-bottom)); /* Menaikkan posisi ikon lebih jauh ke atas */
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.35);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 10px;
    padding: 0; /* Reset padding */
    transition: color 0.2s;
    cursor: pointer;
    flex: 1;
}

.nav-item.active {
    color: var(--text-main); /* Mengubah warna aktif menjadi putih */
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon svg {
    fill: currentColor;
    transition: transform 0.2s ease;
}

.nav-item.active .nav-icon svg {
    transform: scale(1.1);
}

/* --- ADD HABIT PAGE --- */
.form-group {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    margin-bottom: 24px;
    overflow: hidden;
}

.form-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 0.5px solid var(--border-color);
}

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

.form-label { font-size: 17px; }

.form-input {
    background: transparent;
    border: none;
    color: white;
    font-size: 17px;
    text-align: right;
    width: 60%;
    outline: none;
}

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

.color-picker {
    display: flex;
    gap: 8px;
}

.color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
}

.color-dot.active { border-color: white; }

.day-picker {
    display: flex;
    gap: 5px;
    padding: 10px 16px;
    background: var(--card-bg);
    border-radius: 12px;
    margin-bottom: 20px;
    justify-content: space-between;
}

.day-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.day-btn.active {
    background: var(--accent-color);
    color: white;
}

.preview-container {
    margin-bottom: 25px;
}

.preview-label {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 8px;
    margin-left: 5px;
}

.btn-save {
    background: var(--accent-color);
    color: white;
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    border: none;
    font-size: 17px;
    font-weight: 600;
    margin-top: 10px;
    cursor: pointer;
}

.btn-delete-habit {
    background: #FF453A;
    color: white;
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: none;
    font-size: 15px;
    margin-top: 20px;
    cursor: pointer;
    opacity: 0.8;
}

#add-habit.page {
    padding-bottom: 220px;
}

#add-habit .header-nav.edit-header {
    margin-bottom: 14px;
    padding-top: 10px;
}

.edit-back {
    width: 64px;
    height: 64px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.edit-back svg {
    width: 30px;
    height: 30px;
}

.edit-header-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.edit-header-spacer {
    width: 64px;
    height: 64px;
}

.edit-title {
    margin: 0;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.edit-subtitle {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

.edit-card {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 14px;
    padding: 12px 12px 10px 12px;
    margin-bottom: 12px;
}

.edit-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 2px 10px 2px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.10);
    margin-bottom: 10px;
}

.edit-card-title-icon {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    font-weight: 900;
}

.edit-card-title-text {
    font-weight: 900;
    font-size: 15px;
}

.edit-field {
    padding: 8px 2px 10px 2px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.10);
    margin-bottom: 6px;
}

.edit-field-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.edit-field-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 700;
}

.edit-counter {
    font-size: 12px;
    color: rgba(148, 163, 184, 0.9);
    font-weight: 700;
}

.edit-input {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.35);
    color: var(--text-main);
    padding: 12px 12px;
    border-radius: 12px;
    outline: none;
    font-size: 15px;
}

.edit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 2px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.10);
}

.edit-row-label {
    font-size: 14px;
    color: rgba(248, 250, 252, 0.92);
    font-weight: 700;
}

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

.edit-icon-thumb {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.edit-outline-btn {
    background: transparent;
    color: #60A5FA;
    border: 1px solid rgba(59, 130, 246, 0.35);
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.edit-chevron {
    color: rgba(148, 163, 184, 0.9);
    font-weight: 900;
    font-size: 18px;
    line-height: 1;
}

.edit-color-picker .color-dot {
    width: 28px;
    height: 28px;
    position: relative;
}

.edit-color-picker .color-dot.active {
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.edit-color-picker .color-dot.active::after {
    content: "✓";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0B1220;
    font-size: 14px;
    font-weight: 900;
}

.edit-select {
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.35);
    color: var(--text-main);
    padding: 10px 12px;
    border-radius: 12px;
    outline: none;
    font-size: 14px;
    font-weight: 700;
}

.edit-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.35);
}

.edit-pill-icon {
    font-size: 14px;
    opacity: 0.9;
}

.edit-pill-input {
    border: none;
    background: transparent;
    color: var(--text-main);
    outline: none;
    font-size: 14px;
    font-weight: 700;
    min-width: 110px;
    text-align: right;
}

.edit-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    padding: 2px 0 8px 0;
}

#add-habit .day-btn {
    width: auto;
    height: 36px;
    border-radius: 12px;
    background: rgba(51, 65, 85, 0.9);
    color: rgba(148, 163, 184, 0.95);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.2px;
}

#add-habit .day-btn.active {
    background: rgba(37, 99, 235, 0.95);
    color: #fff;
}

.repeat-summary {
    color: rgba(148, 163, 184, 0.95);
    font-size: 13px;
    font-weight: 700;
    padding: 0 2px 2px 2px;
}

.delete-text {
    width: 100%;
    background: transparent;
    border: none;
    color: #FF453A;
    font-size: 14px;
    font-weight: 800;
    padding: 6px 0;
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.delete-text-icon {
    font-size: 16px;
}

.habit-save-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(80px + var(--safe-bottom));
    padding: 10px 16px calc(10px + var(--safe-bottom));
    background: rgba(15, 23, 42, 0.92);
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.habit-save-bar .btn-save {
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 900;
    padding: 14px 16px;
    border-radius: 14px;
    line-height: 1;
}

.habit-save-bar .save-icon {
    font-size: 16px;
    line-height: 1;
    width: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 3000;
    padding: 12px;
}

.modal-sheet {
    width: 100%;
    max-width: 560px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.modal-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
}

.modal-title-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.modal-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 650;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-handle {
    width: 46px;
    height: 5px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.25);
    margin: 10px auto 0 auto;
}

.detail-actions-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.detail-actions-dot {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(10, 132, 255, 0.15);
    border: 1px solid rgba(10, 132, 255, 0.25);
    color: #79b8ff;
    font-weight: 900;
    letter-spacing: 1px;
    line-height: 1;
    flex: 0 0 auto;
}

.detail-actions-close {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: rgba(226, 232, 240, 0.9);
    display: grid;
    place-items: center;
    font-size: 20px;
    font-weight: 900;
    cursor: pointer;
}

.detail-action-btn {
    width: 100%;
    padding: 14px 14px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
    text-align: left;
}

.detail-action-btn:active:not(:disabled) {
    transform: scale(0.99);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(148, 163, 184, 0.26);
}

.detail-action-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.detail-action-icon {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: rgba(148, 163, 184, 0.10);
    border: 1px solid rgba(148, 163, 184, 0.18);
    font-size: 18px;
    font-weight: 900;
    flex: 0 0 auto;
}

.detail-action-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1 1 auto;
}

.detail-action-title {
    font-size: 15px;
    font-weight: 900;
    line-height: 1.1;
}

.detail-action-subtitle {
    font-size: 12.5px;
    font-weight: 650;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-action-toggle {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 2px solid rgba(148, 163, 184, 0.35);
    background: transparent;
    flex: 0 0 auto;
    position: relative;
}

.detail-action-toggle.is-on {
    border-color: rgba(148, 163, 184, 0.5);
    background: rgba(148, 163, 184, 0.22);
}

.detail-action-toggle.is-on::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 900;
    color: rgba(226, 232, 240, 0.92);
}

.detail-action-chevron {
    color: rgba(148, 163, 184, 0.9);
    font-size: 22px;
    font-weight: 900;
    flex: 0 0 auto;
}

.detail-action-btn--complete .detail-action-icon,
.detail-action-btn--complete .detail-action-title {
    color: #30D158;
}

.detail-action-btn--complete .detail-action-icon {
    background: rgba(48, 209, 88, 0.12);
    border-color: rgba(48, 209, 88, 0.22);
}

.detail-action-btn--complete .detail-action-toggle {
    border-color: rgba(48, 209, 88, 0.45);
}

.detail-action-btn--complete .detail-action-toggle.is-on {
    background: rgba(48, 209, 88, 0.20);
}

.detail-action-btn--skip .detail-action-icon,
.detail-action-btn--skip .detail-action-title {
    color: #BF5AF2;
}

.detail-action-btn--skip .detail-action-icon {
    background: rgba(191, 90, 242, 0.12);
    border-color: rgba(191, 90, 242, 0.22);
}

.detail-action-btn--skip .detail-action-toggle {
    border-color: rgba(191, 90, 242, 0.45);
}

.detail-action-btn--skip .detail-action-toggle.is-on {
    background: rgba(191, 90, 242, 0.18);
}

.detail-action-btn--edit .detail-action-icon,
.detail-action-btn--edit .detail-action-title {
    color: #0A84FF;
}

.detail-action-btn--edit .detail-action-icon {
    background: rgba(10, 132, 255, 0.12);
    border-color: rgba(10, 132, 255, 0.22);
}

.detail-action-hint {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(148, 163, 184, 0.08);
    color: rgba(226, 232, 240, 0.86);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12.5px;
    font-weight: 650;
}

.detail-action-hint-icon {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.25);
    font-size: 12px;
    font-weight: 900;
    flex: 0 0 auto;
}

.detail-action-cancel {
    width: 100%;
    padding: 13px 14px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(226, 232, 240, 0.92);
    font-weight: 850;
    text-align: center;
    cursor: pointer;
}

.modal-close {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: var(--text-main);
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px 14px 14px;
}

.modal-action-btn {
    width: 100%;
    padding: 12px 12px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    font-size: 14px;
    font-weight: 750;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.modal-action-btn:active:not(:disabled) {
    transform: scale(0.99);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(148, 163, 184, 0.28);
}

.modal-action-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.18);
    flex: 0 0 auto;
    font-size: 16px;
}

.modal-action-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.modal-action-title {
    font-size: 14px;
    font-weight: 850;
    color: var(--text-main);
}

.modal-action-subtitle {
    font-size: 12px;
    font-weight: 650;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-action-right {
    color: rgba(148, 163, 184, 0.8);
    font-size: 18px;
    font-weight: 900;
    flex: 0 0 auto;
}

.modal-action-btn--skip .modal-action-icon {
    background: rgba(156, 163, 175, 0.12);
    border-color: rgba(156, 163, 175, 0.18);
}

.modal-action-btn--skip.is-active {
    border-color: rgba(156, 163, 175, 0.35);
    background: rgba(156, 163, 175, 0.08);
}

.modal-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-action-btn.modal-action-cancel {
    text-align: center;
    background: rgba(148, 163, 184, 0.08);
}

#icon-modal-grid.icon-picker-grid {
    grid-template-columns: repeat(7, 1fr);
    max-height: 55vh;
    margin-top: 0;
    padding: 12px 14px 14px 14px;
}

#icon-modal-grid .icon-option {
    font-size: 22px;
    border-radius: 10px;
}

/* List Items (iOS Style) */
.list-group {
    background: var(--card-bg);
    border-radius: 12px;
    margin-bottom: 25px;
    overflow: hidden;
}

.list-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 0.5px solid var(--border-color);
    cursor: pointer;
}

.list-item:last-child { border-bottom: none; }
.list-item:active { background: rgba(255,255,255,0.05); }

.list-label { font-size: 17px; }
.list-value { color: var(--text-secondary); font-size: 17px; }
.list-chevron { color: var(--text-secondary); margin-left: 8px; font-size: 14px; }

.list-header {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 12px;
    margin-left: 16px;
    margin-top: 10px;
    letter-spacing: 0.8px;
    font-weight: 700;
}

/* Habit Item UI Enhancement */
.habit-icon {
    font-size: 24px;
    margin-right: 15px;
    width: 40px;
    height: 40px;
    background: var(--border-color); /* Darker background */
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
     filter: grayscale(1) contrast(1.2); /* Make emoji look more black/white and sharper */
 }

.habit-card.completed .habit-icon {
    filter: grayscale(0); /* Return color when completed */
    opacity: 0.7;
}

.habit-content-main {
    display: flex;
    align-items: center;
    flex: 1;
}

.habit-meta {
    display: flex;
    flex-direction: column;
}

.habit-progress-text {
    font-size: 12px;
    color: var(--accent-color);
    font-weight: 600;
    margin-top: 2px;
}

.bad-habit .habit-check {
    border-color: #FF453A;
}

.bad-habit.completed .habit-check {
    background: #FF453A;
    border-color: #FF453A;
}

/* Header Navigation */
.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn-back {
    color: var(--accent-color);
    font-size: 17px;
    cursor: pointer;
    background: none;
    border: none;
}

/* --- HABITS PAGE --- */
.date-selector {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 0 20px;
    scrollbar-width: none;
}

.date-selector::-webkit-scrollbar {
    display: none;
  }

.date-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
    padding: 12px 8px;
    border-radius: 14px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    position: relative;
    cursor: pointer;
}

.date-item.is-today {
    background: rgba(59, 130, 246, 0.1); /* Subtle accent background for today */
    border: 1px solid var(--accent-color);
}

.date-item.active {
    background: var(--accent-color) !important; /* Ensure active wins background */
    color: white;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.date-item.is-today::before {
    content: '';
    position: absolute;
    top: 6px;
    width: 4px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 50%;
    z-index: 3;
}

.date-item.active.is-today::before {
    background: white; /* Dot white on active today */
}

.date-item.is-today .date-num {
    color: var(--accent-color); /* Highlight today's number */
}

.date-item.active .date-num {
    color: white !important; /* Reset to white if active */
}

/* Streak Line for Date Selector */
.date-item.streak-day {
    border: 2px solid var(--success-color);
}

.date-item .streak-line {
    position: absolute;
    top: 50%;
    height: 4px;
    background: linear-gradient(90deg, var(--success-color), #059669);
    transform: translateY(-50%);
    z-index: 0;
    pointer-events: none;
    border-radius: 2px;
    opacity: 0;
    transition: width 0.3s ease-in-out, opacity 0.3s ease;
}

.date-item .streak-line.left {
    left: -14px; /* Match gap between items */
    width: 14px;
}

.date-item .streak-line.right {
    right: -14px;
    width: 14px;
}

.date-item.show-left .streak-line.left,
.date-item.show-right .streak-line.right {
    opacity: 1;
}

/* Per-Habit Streak 🔥 */
.habit-streak-badge {
    position: absolute;
    top: 12px;
    right: 50px; /* Near check button */
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 700;
    color: #FF9F0A; /* iOS Orange */
    background: rgba(255, 159, 10, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.habit-streak-badge.bounce {
    transform: scale(1.3);
}

.habit-streak-badge.hidden {
    display: none;
}

.habit-streak-icon {
    filter: drop-shadow(0 0 2px rgba(255, 159, 10, 0.5));
    animation: flicker 2s infinite alternate;
}

@keyframes flicker {
    0% { opacity: 0.8; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.1); }
}

.date-day { 
    font-size: 10px; 
    text-transform: uppercase; 
    margin-bottom: 6px; 
    z-index: 2; 
    font-weight: 500;
    letter-spacing: 0.05em;
    opacity: 0.8;
}
.date-num { font-size: 16px; font-weight: 600; z-index: 2; }

.habits-list {
    position: relative;
    min-height: 100px;
}

.habit-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.4s ease, color 0.4s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.habit-card:active {
    transform: scale(0.98);
}

.habit-card.completed {
    background: var(--success-color);
    border-color: var(--success-color);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.habit-card.skipped {
    background: rgba(148, 163, 184, 0.10);
    border-color: rgba(148, 163, 184, 0.18);
    box-shadow: none;
}

.habit-card.skipped .habit-name {
    color: rgba(226, 232, 240, 0.9);
}

.habit-card.skipped .subtext {
    color: rgba(226, 232, 240, 0.7);
}

.habit-card.skipped .habit-icon {
    background: rgba(148, 163, 184, 0.12);
    filter: grayscale(1) brightness(1.1);
}

.habit-card.skipped .habit-check {
    background: rgba(148, 163, 184, 0.14);
    border-color: rgba(148, 163, 184, 0.25);
    color: rgba(226, 232, 240, 0.9);
}

.skip-label {
    background: rgba(148, 163, 184, 0.18);
    color: rgba(226, 232, 240, 0.9);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.habit-card.completed .habit-name {
    color: white; /* In the image, completed card text is white */
    text-decoration: none; /* Let's remove line-through to match image */
}

.habit-card.completed .subtext,
.habit-card.completed .habit-progress-text {
    color: rgba(255, 255, 255, 0.8);
}

.habit-card.completed .habit-icon {
    background: rgba(255, 255, 255, 0.2);
    filter: grayscale(0) brightness(1.5);
}

.habit-card.completed .habit-check {
    background: rgba(255, 255, 255, 0.3);
    border-color: transparent;
    color: white;
}

.habit-card.bad-habit.completed {
    background: #FF453A;
    border-color: #FF453A;
    box-shadow: 0 4px 15px rgba(255, 69, 58, 0.3);
}

.habit-card.bad-habit.completed .habit-check {
    background: rgba(255, 255, 255, 0.3);
}

.habit-card.moving {
    z-index: 10;
}

.confetti-particle {
    position: fixed;
    border-radius: 2px; /* Square like real confetti */
    pointer-events: none;
    z-index: 9999;
    will-change: transform, opacity;
}

.habit-check {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: transparent;
}

.floating-btn {
    position: fixed;
    right: 20px;
    bottom: calc(105px + var(--safe-bottom)); /* Naikkan dari 90px ke 105px */
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    z-index: 99;
}

/* --- STATISTICS PAGE --- */
.stats-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.insight-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    border-left: 4px solid var(--accent-color);
    margin-bottom: 12px;
}

.insight-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 15px;
}

.insight-body {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.weekly-comp {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.weekly-comp > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.comp-value {
    font-size: 24px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.comp-label {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

#weekly-indicator {
    font-size: 14px;
    line-height: 1.5;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    width: 100%;
}

.indicator-up { color: var(--success-color); }
.indicator-down { color: #FF453A; }

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 0.5px solid var(--border-color);
    background: transparent;
    transition: background 0.2s;
}

.ranking-item:active {
    background: rgba(255, 255, 255, 0.05);
}

.ranking-number {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-secondary);
    min-width: 20px;
    text-align: center;
}

.ranking-item:nth-child(1) .ranking-number { color: #FFD700; font-size: 18px; } /* Gold */
.ranking-item:nth-child(2) .ranking-number { color: #C0C0C0; font-size: 16px; } /* Silver */
.ranking-item:nth-child(3) .ranking-number { color: #CD7F32; font-size: 15px; } /* Bronze */

.ranking-icon {
    font-size: 20px;
}

.ranking-name {
    font-weight: 600;
    font-size: 16px;
}

.ranking-points {
    font-weight: 800;
    color: var(--accent-color);
    font-size: 14px;
    background: rgba(59, 130, 246, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
}

.calendar-placeholder {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
     padding: 20px;
    text-align: center;
    margin-bottom: 20px;
}

.calendar-content {
    text-align: left;
}

.calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.calendar-select {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.35);
    color: var(--text-main);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 700;
    outline: none;
}

.calendar-select option {
    background: var(--bg-color);
    color: var(--text-main);
}

.cal-date.habit-on {
    background: rgba(16, 185, 129, 0.75);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: white;
    font-weight: 700;
}

.cal-date.habit-missed {
    background: rgba(148, 163, 184, 0.10);
    border: 1px solid rgba(148, 163, 184, 0.10);
    color: rgba(148, 163, 184, 0.9);
    font-weight: 700;
}

.cal-date.habit-neutral {
    background: rgba(148, 163, 184, 0.10);
    border: 1px solid rgba(148, 163, 184, 0.10);
    color: rgba(148, 163, 184, 0.9);
}

.cal-date.is-today {
    outline: 2px solid var(--accent-color);
    outline-offset: 1px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.cal-day { font-size: 12px; color: var(--text-secondary); margin-bottom: 5px; }
.cal-date { 
    height: 40px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 14px;
    border-radius: 8px;
    background: var(--border-color); /* Use border-color for empty days */
    position: relative;
    overflow: visible; /* Changed from hidden to allow lines to connect */
}

/* Streak Line for Calendar */
.cal-date.streak-day.show-right::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -8px; /* Match the gap of calendar-grid */
    width: 8px;
    height: 4px;
    background-color: var(--success-color);
    transform: translateY(-50%);
    z-index: 1;
}

.cal-date.has-activity {
    color: white;
    font-weight: 600;
}

.cal-date.filled { background: var(--success-color); color: white; }

.level-profile-card {
    margin-bottom: 14px;
    padding: 18px 16px;
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background:
        radial-gradient(520px 220px at 20% 20%, rgba(59, 130, 246, 0.22), transparent 60%),
        radial-gradient(520px 220px at 90% 40%, rgba(16, 185, 129, 0.14), transparent 60%),
        rgba(30, 41, 59, 0.75);
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

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

.level-profile-kicker {
    font-size: 11px;
    color: rgba(148, 163, 184, 0.85);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 800;
}

.level-profile-level {
    margin-top: 6px;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.level-profile-exp {
    font-size: 12px;
    font-weight: 800;
    color: rgba(148, 163, 184, 0.9);
    white-space: nowrap;
    margin-top: 2px;
}

.level-progress {
    height: 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.18);
    overflow: hidden;
}

.level-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.95), rgba(16, 185, 129, 0.9));
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    transition: width 0.35s ease;
}

.level-profile-footer {
    margin-top: 10px;
    font-size: 13px;
    font-weight: 700;
}

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

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.2s ease;
}

.stat-card:active {
    transform: scale(0.97);
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    margin: 8px 0 2px;
    color: var(--text-main);
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

/* --- SETTINGS PAGE --- */
.settings-group {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 24px;
}

.settings-profile-card {
    margin: -8px 0 24px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background:
        radial-gradient(520px 220px at 30% 20%, rgba(59, 130, 246, 0.22), transparent 60%),
        radial-gradient(520px 220px at 90% 40%, rgba(16, 185, 129, 0.14), transparent 60%),
        rgba(30, 41, 59, 0.75);
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 18px;
    color: var(--text-main);
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
}

.settings-profile-name {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.settings-profile-username {
    margin-top: 3px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
}

.settings-profile-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.settings-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 0.5px solid var(--border-color);
}

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

.settings-label {
    font-size: 17px;
}

/* iOS Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border-color);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 27px; width: 27px;
    left: 2px; bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

input:checked + .slider { background-color: var(--success-color); }
input:checked + .slider:before { transform: translateX(20px); }

/* Icon Picker Style */
.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-top: 10px;
    max-height: 220px;
    overflow-y: auto;
    width: 100%;
    padding: 10px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) transparent;
}

.icon-picker-grid::-webkit-scrollbar {
    width: 4px;
}

.icon-picker-grid::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 10px;
}

.icon-option {
    font-size: 24px;
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.icon-option:active {
    transform: scale(0.9);
}

.icon-option.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

/* Achievements Section */
.achievements-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 20px;
    padding-bottom: 20px;
}

.achievement-badge {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    opacity: 0.3;
    filter: grayscale(1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.achievement-badge.unlocked {
    opacity: 1;
    filter: grayscale(0);
    border-color: var(--accent-color);
    background: linear-gradient(135deg, var(--card-bg), rgba(59, 130, 246, 0.1));
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.achievement-badge .badge-icon {
    font-size: 32px;
}

.achievement-badge .badge-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.achievement-badge.unlocked .badge-label {
    color: var(--text-main);
}

/* Custom form item for icons */
.form-item.icon-section {
    flex-direction: column;
    align-items: flex-start;
}

.form-item.icon-section .form-label {
    margin-bottom: 8px;
}

/* Custom Time Picker Style */
input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

/* Glow and Soon Effect */
.habit-card.is-soon {
    border: 2px solid var(--accent-color);
    animation: glow-pulse 2s infinite ease-in-out;
}

@keyframes glow-pulse {
    0% { box-shadow: 0 0 5px rgba(59, 130, 246, 0.3); }
    50% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.6); }
    100% { box-shadow: 0 0 5px rgba(59, 130, 246, 0.3); }
}

.habit-card.highlighted {
    border: 3px solid #FFD700 !important;
    transform: scale(1.05);
    z-index: 1000;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.soon-label {
    animation: bounce-soft 2s infinite ease-in-out;
}

@keyframes bounce-soft {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

/* List Page Styles */
.list-container {
    padding: 0 20px;
}

#list {
    background: var(--bg-color);
    padding: 0;
}

#list.page {
    padding: 0;
}

.list-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
}

.list-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.list-controls {
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-search {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.35);
    color: var(--text-main);
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 700;
    outline: none;
}

.list-search::placeholder {
    color: rgba(148, 163, 184, 0.75);
    opacity: 1;
}

.list-search:disabled {
    opacity: 0.55;
}

.list-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

.list-chips::-webkit-scrollbar {
    display: none;
}

.list-chip {
    border: 1px solid rgba(148, 163, 184, 0.20);
    background: rgba(30, 41, 59, 0.55);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.list-chip.active {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.45);
    color: var(--text-main);
}

.list-chip:active {
    transform: scale(0.98);
}

#list h1 {
    margin-bottom: 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
}

.list-future-btn {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.list-future-btn:hover {
    background: var(--accent-color);
    color: white;
}

/* Filter Button Styles */
.list-filter-container {
    position: relative;
    margin-bottom: 0;
    padding: 0;
}

.list-filter-btn {
    background: linear-gradient(135deg, var(--card-bg), rgba(30, 41, 59, 0.8));
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    min-width: 90px;
    justify-content: space-between;
}

.list-filter-btn:hover {
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

.filter-icon {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.list-filter-btn:hover .filter-icon {
    transform: rotate(180deg);
}

.list-filter-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-top: 4px;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    min-width: 120px;
}

.list-filter-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.filter-option {
    padding: 8px 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 12px;
    border-bottom: 1px solid var(--border-color);
}

.filter-option:last-child {
    border-bottom: none;
}

.filter-option:hover {
    background: rgba(59, 130, 246, 0.1);
}

.filter-option:first-child {
    border-radius: 6px 6px 0 0;
}

.filter-option:last-child {
    border-radius: 0 0 6px 6px;
}

.list-date-section {
    margin-bottom: 24px;
    padding-top: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
}

.empty-state-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 20px;
    padding: 18px 16px;
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    margin-top: 18px;
    text-align: left;
}

.empty-state-title {
    font-weight: 900;
    font-size: 16px;
    margin-bottom: 6px;
}

.empty-state-btn {
    margin-top: 14px;
}

.list-date-section:last-child {
    border-bottom: none;
}

.list-date-section.today-section {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid var(--accent-color);
    border-radius: 16px;
    padding: 16px;
    margin: 0 -16px 24px -16px;
}

.list-date-header {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 12px;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.list-date-header.today-header {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    padding: 0;
}

.today-badge {
    background: var(--accent-color);
    color: white;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
    margin-left: 8px;
}

.list-items-group {
    padding: 0;
}

.list-item {
    display: flex;
    align-items: flex-start;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.list-item:hover {
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.list-item.selected {
    border: 2px solid var(--accent-color);
    background: rgba(59, 130, 246, 0.05);
}

.list-item.completed {
    opacity: 0.7;
    background: var(--card-bg);
}

.list-item-checkbox {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    margin-top: 2px;
    accent-color: var(--accent-color);
    cursor: pointer;
    border-radius: 4px;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
    appearance: none;
    background: transparent;
    position: relative;
    transition: all 0.2s ease;
}

.list-item-checkbox:checked {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.list-item-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.list-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    padding-top: 1px;
}

.list-item-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.list-item-time-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.list-item-missed-badge {
    background: rgba(255, 69, 58, 0.12);
    border: 1px solid rgba(255, 69, 58, 0.35);
    color: #FF453A;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 999px;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.list-item-done-badge {
    background: rgba(50, 215, 75, 0.12);
    border: 1px solid rgba(50, 215, 75, 0.35);
    color: #32D74B;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 999px;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.list-item-time {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-right: 8px;
}

.list-item-name {
    font-size: 15px;
    color: var(--text-main);
    transition: all 0.2s ease;
    font-weight: 500;
    line-height: 1.3;
    flex: 1;
}

.list-item-name.completed {
    text-decoration: line-through;
    opacity: 0.6;
    color: var(--text-secondary);
}

.list-item-description {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
    margin-top: 2px;
    opacity: 0.8;
}

/* Enhanced visual feedback */
.list-item:active {
    transform: scale(0.98);
}

/* Add subtle animation for new items */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.list-item {
    animation: slideIn 0.3s ease-out;
}

/* List form styles */
#add-list-item.page {
    padding: 0 20px;
}

/* Enhanced floating button */
#list .floating-btn {
    background: var(--accent-color);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
}

#list .floating-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

/* Textarea styling */
textarea.form-input {
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

/* Responsive adjustments */
@media (max-width: 380px) {
    .list-item {
        padding: 10px;
        margin-bottom: 6px;
    }
    
    .list-item-name {
        font-size: 13px;
    }
    
    .list-item-time {
        font-size: 11px;
    }
    
    .list-item-description {
        font-size: 11px;
    }
    
    .list-date-header {
        font-size: 14px;
        padding: 0 16px;
    }
    
    .list-items-group {
        padding: 0 16px;
    }
    
    .list-filter-container {
        padding: 0 16px;
    }
    
    .list-filter-dropdown {
        left: 16px;
        right: 16px;
    }
}
