:root {
    /* Premium Vibrant Palette */
    --bg-color: #050505;
    /* Deep black, not pure void */

    /* Lighter, more transparent glass for cards to show background color */
    --card-color: rgba(255, 255, 255, 0.07);
    --card-border: 1px solid rgba(255, 255, 255, 0.12);

    --primary: #0A84FF;
    --primary-glow: rgba(10, 132, 255, 0.8);
    /* Stronger glow */

    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.7);
    /* Brighter secondary text */

    --separator: rgba(255, 255, 255, 0.15);
    --safe-area-bottom: env(safe-area-inset-bottom, 20px);

    --glass: blur(50px) saturate(180%);
    --glass-bg: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    /* Solid sleek background as requested */
    background-color: #050505;
    background-image: none;
    /* subtle noise or grain could be added here if valid, but user said "no gradient" */

    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", sans-serif;
    margin: 0;
    padding: 0;
    padding-bottom: calc(60px + var(--safe-area-bottom));
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    overflow-x: hidden;
    /* Prevent horizontal shake */
    width: 100%;
}

/* Header */
.ios-header {
    background: rgba(28, 28, 30, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: var(--card-border);

    /* Flex layout for alignment */
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center title */
    min-height: 44px;
}

.back-btn {
    background: transparent;
    border: none;
    color: var(--primary);
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ... existing styles ... */

/* iOS Input Styling */
input[type="date"],
input[type="time"],
input[type="text"],
input[type="number"] {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.05);
    /* Glassy input */
    border: var(--card-border);
    border-radius: 12px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    width: 100%;
    height: 44px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
}

input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
}

.ios-header.center {
    text-align: center;
}

.ios-header h1 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
}

.greeting-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    font-size: 24px;
    background: #2C2C2E;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
}

.greet-text {
    flex: 1;
}

.greet-text .sub {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
}

.greet-text .name {
    font-size: 17px;
    font-weight: 700;
}

.xp-badge {
    background: #FFD60A;
    color: black;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
}

/* Main Content */
main {
    padding: 20px;
    animation: fadeIn 0.3s;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

/* Quick Actions Grid */
.grid-4-quick {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.q-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.q-btn .icon-box {
    width: 50px;
    height: 50px;
    background: var(--card-color);
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: var(--primary);
}

.q-btn span {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
}

/* Section Headers */
.section-header {
    font-size: 20px;
    font-weight: 700;
    margin: 24px 0 12px 0;
    color: var(--text-primary);
}

/* Habit Scroll */
.habit-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: none;
}

.habit-scroll::-webkit-scrollbar {
    display: none;
}

.habit-bubble {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: var(--card-color);
    border: 2px solid transparent;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.habit-bubble.done {
    border-color: #30D158;
    color: #30D158;
    background: rgba(48, 209, 88, 0.1);
}

.habit-bubble.add {
    background: #2C2C2E;
    font-size: 30px;
    color: var(--primary);
}

/* Widgets Grid */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.widget {
    background: var(--card-color);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border: var(--card-border);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.1s;
}

.widget:active {
    transform: scale(0.96);
}

.widget i {
    color: var(--primary);
}

.widget .val {
    font-size: 20px;
    font-weight: 700;
}

.widget .label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Task Card */
.task-card-ios {
    background: var(--card-color);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.check-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--text-secondary);
}

.t-title {
    font-weight: 600;
    font-size: 16px;
    display: block;
}

.t-time {
    font-size: 13px;
    color: var(--text-secondary);
}

/* iOS List */
.ios-list {
    background: transparent;
    /* Container is transparent now */
    border-radius: 16px;
    margin-top: 10px;
}

.ios-item {
    background: var(--card-color);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border: var(--card-border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.1s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.ios-item:active {
    transform: scale(0.97);
}

/* No border bottom needed for separated cards design */
.ios-item:last-child {
    border-bottom: var(--card-border);
}

/* Pomodoro Redesign */
.center-vertical {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 80vh;
}

.pomo-card {
    background: var(--card-color);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border: var(--card-border);
    border-radius: 30px;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 90%;
    max-width: 340px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.timer-ring {
    /* Subtle glow instead of heavy blur */
    filter: drop-shadow(0 0 8px rgba(10, 132, 255, 0.3));
}

.timer-display {
    font-size: 64px;
    font-weight: 200;
    font-feature-settings: "tnum";
    margin: 10px 0;
}

.timer-sub {
    font-size: 14px;
    color: var(--primary);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 2px;
}

.pomo-controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.pomo-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: none;
    background: var(--glass-bg);
    backdrop-filter: var(--glass);
    color: white;
    display: grid;
    place-items: center;
    transition: all 0.2s;
    cursor: pointer;
}

.pomo-btn.secondary {
    background: rgba(255, 255, 255, 0.02);
    color: rgba(255, 255, 255, 0.4);
}

.pomo-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.1);
}

.pomo-btn#pomo-toggle {
    background: var(--primary);
    width: 64px;
    height: 64px;
    box-shadow: 0 10px 25px var(--primary-glow);
}

.pomo-current-task {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(10, 132, 255, 0.1);
    padding: 8px 16px;
    border-radius: 12px;
    text-align: center;
}

.pomo-controls {
    display: flex;
    align-items: center;
    gap: 30px;
}

/* Glass Buttons Utility */
.ios-btn {
    background: var(--glass-bg);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
}

.ios-btn.primary {
    background: var(--primary);
    border: none;
    box-shadow: 0 8px 20px var(--primary-glow);
}

.ios-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
}

.ios-btn:active {
    transform: scale(0.96);
    opacity: 0.9;
}

.icon-box {
    background: var(--glass-bg);
    backdrop-filter: var(--glass);
    border-radius: 12px;
}

/* Chat */
.chat-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    height: calc(100vh - 180px);
    padding-bottom: 20px;
}

.message {
    display: flex;
}

.message.ai {
    justify-content: flex-start;
}

.message.user {
    justify-content: flex-end;
}

.bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 16px;
    line-height: 1.4;
}

.ai .bubble {
    background: var(--card-color);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.user .bubble {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-input-area {
    position: fixed;
    bottom: calc(60px + var(--safe-area-bottom));
    left: 0;
    right: 0;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    gap: 10px;
    border-top: 0.5px solid var(--separator);
}

.chat-input-area input {
    flex: 1;
    background: #1C1C1E;
    border: 1px solid #333;
    border-radius: 20px;
    padding: 10px 16px;
    color: white;
    font-size: 16px;
    outline: none;
}

.chat-input-area button {
    background: var(--primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    display: grid;
    place-items: center;
}

/* Tab Bar */
.bottom-nav,
.ios-tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(50px + var(--safe-area-bottom));
    background: rgba(28, 28, 30, 0.9);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    padding-bottom: var(--safe-area-bottom);
    border-top: 0.5px solid var(--separator);
}

.tab {
    flex: 1;
    background: none;
    border: none;
    color: #8E8E93;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.tab.active span,
.tab.active i {
    color: var(--primary);
}

.tab span {
    font-size: 10px;
    font-weight: 500;
}

.tab svg {
    width: 24px;
    height: 24px;
}

/* Finance */
.balance-big {
    text-align: center;
    margin: 30px 0;
}

.balance-big .sub {
    color: var(--text-secondary);
    font-size: 14px;
    text-transform: uppercase;
}

.balance-big .amount {
    font-size: 42px;
    font-weight: 700;
    letter-spacing: -1px;
}

.chart-box {
    background: var(--card-color);
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 20px;
}

.small {
    height: 250px;
}

.chart-box.wheel-wrapper {
    height: auto;
    min-height: 320px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Limits Section */
.limit-item {
    background: var(--card-color);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border: var(--card-border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
}

.limit-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.limit-info .cat {
    font-weight: 600;
}

.limit-info .amount {
    color: var(--text-secondary);
}

.progress-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #5E5CE6);
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(0.1, 0.7, 1.0, 0.1);
}

.progress-bar.warning {
    background: linear-gradient(90deg, #FF9F0A, #FFD60A);
}

.progress-bar.danger {
    background: linear-gradient(90deg, #FF3B30, #FF453A);
}

/* Savings Section */
.savings-grid {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: none;
}

.savings-grid::-webkit-scrollbar {
    display: none;
}

.saving-card {
    width: 200px;
    flex-shrink: 0;
    background: var(--card-color);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border: var(--card-border);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.saving-card .title {
    font-weight: 700;
    font-size: 16px;
}

.saving-card .progress-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.saving-card .target {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.message .bubble {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 14px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    display: inline-block;
    max-width: 80%;
    margin-bottom: 4px;
    line-height: 1.4;
    word-wrap: break-word;
    word-break: break-word;
}

.saving-btn-small {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 10px;
    color: white;
    padding: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

/* MODALS */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 200;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-overlay.open {
    display: block;
    opacity: 1;
}

.modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1C1C1E;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 24px 20px 40px 20px;
    /* Safe area handled by body padding usually, but ample bottom padding */
    z-index: 201;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);

    /* Scroll fix */
    max-height: 90vh;
    overflow-y: auto;
}

.modal.open {
    transform: translateY(0);
}

.modal-header {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 25px;
    text-align: center;
    letter-spacing: -0.5px;
}

.modal input[type="text"],
.modal input[type="number"] {
    width: 100%;
    box-sizing: border-box;
    background: #2C2C2E;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 18px;
    color: white;
    margin-bottom: 16px;
    outline: none;
}

.full {
    width: 100%;
    border-radius: 12px;
    font-weight: 600;
    font-size: 17px;
}

/* Segment Control */
.ios-seg-control {
    display: flex;
    background: #2C2C2E;
    padding: 4px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.seg-item {
    flex: 1;
    text-align: center;
    padding: 8px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 7px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.seg-item.active {
    background: #636366;
    color: white;
}

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.cat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 8px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.cat-item.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 8px 16px var(--primary-glow);
    color: white;
}

.cat-icon {
    font-size: 24px;
}

.cat-name {
    font-size: 10px;
}

/* Amount Input Redesign (Wallet-style) */
.amount-input-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}

.amount-input-wrapper .input-group {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.amount-input-wrapper span {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
}

.amount-input-wrapper input {
    text-align: center;
    background: transparent !important;
    font-size: 48px !important;
    font-weight: 800;
    margin: 0 !important;
    width: auto !important;
    min-width: 100px;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    color: white !important;
    font-family: inherit;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 24px;
}

/* Slider */
.pomo-slider-val {
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 20px;
}

input[type=range] {
    width: 100%;
    margin-bottom: 30px;
}

/* Shop Specific */
.ios-item .content {
    flex: 1;
}

.ios-item .t-xp {
    font-weight: 700;
    color: var(--primary);
}

.ios-btn.small {
    width: auto;
    height: 32px;
    border-radius: 16px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
}

.ios-btn.action {
    background: rgba(10, 132, 255, 0.1);
    color: var(--primary);
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-size: 14px;
}

.xp-cost {
    font-weight: 700;
    color: #FF453A;
}

.icon-box-small {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 16px;
}


/* Modal Improvements */
.modal {
    z-index: 10001;
    /* Ensure above overlay */
}

input,
select,
textarea {
    z-index: 10002;
    /* Ensure clickable */
}

/* Header Button */
.ios-header-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--primary);
}

/* FINANCE PREMIUM UI */
.wallet-card-premium {
    position: relative;
    background: linear-gradient(135deg, #0A84FF 0%, #5E5CE6 100%);
    border-radius: 24px;
    padding: 24px;
    color: white;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(10, 132, 255, 0.3);
}

.wallet-card-premium .card-content {
    position: relative;
    z-index: 2;
}

.wallet-card-premium .val {
    font-size: 36px;
    font-weight: 700;
    margin: 4px 0 16px 0;
    letter-spacing: -0.5px;
}

.wallet-card-premium .label {
    font-size: 13px;
    opacity: 0.8;
    text-transform: uppercase;
    font-weight: 600;
}

.wallet-card-premium .trend-row {
    display: flex;
    gap: 16px;
}

.trend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.trend-item i {
    width: 14px;
    height: 14px;
}

.trend-item.up {
    color: #30D158;
}

.trend-item.down {
    color: #FF453A;
}

.wallet-card-premium .card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 60%);
    opacity: 0.5;
    z-index: 1;
    pointer-events: none;
}

.finance-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 30px;
}

.fin-action-card {
    background: var(--card-color);
    border: var(--card-border);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: transform 0.1s, background 0.2s;
}

.fin-action-card:active {
    transform: scale(0.96);
    background: rgba(44, 44, 46, 0.8);
}

.fin-action-card .icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 24px;
}

.fin-action-card.income .icon-circle {
    background: rgba(48, 209, 88, 0.15);
    color: #30D158;
}

.fin-action-card.expense .icon-circle {
    background: rgba(255, 69, 58, 0.15);
    color: #FF453A;
}

.fin-action-card .label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.save-btn-small {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 12px;
    padding: 8px 12px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

/* Pomo Task Card */
.pomo-task-card {
    background: #2C2C2E;
    border-radius: 12px;
    padding: 16px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.pomo-task-card .label {
    font-size: 12px;
    color: #8E8E93;
}

.pomo-task-card .val {
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.pomo-task-card .icon {
    color: #8E8E93;
}

/* Calendar Polish */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    /* Slightly more gap */
    margin-bottom: 20px;
    padding: 0 5px;
}

.cal-day {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.05);
    /* Slight bg for better touch area */
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
    position: relative;
    border: 1px solid transparent;
}

.cal-day:active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.95);
}

.cal-day.today {
    background: rgba(10, 132, 255, 0.15);
    color: #0A84FF;
    border: 1px solid rgba(10, 132, 255, 0.3);
    font-weight: 700;
}

.cal-day.selected {
    background: #0A84FF;
    color: white;
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.4);
}

/* Dots alignment fix */
.cal-dots {
    display: flex;
    gap: 2px;
    margin-top: 2px;
    height: 4px;
    /* Fixed height to prevent jumping */
}

.dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
}

.dot.task {
    background: #FF453A;
}

.dot.reminder {
    background: #0A84FF;
}


/* IOS Modal Input Glassmorphism */
.modal input[type="text"],
.modal input[type="number"],
.modal input[type="date"],
.modal input[type="time"] {
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 14px !important;
    color: white !important;
    padding: 14px !important;
    font-size: 16px !important;
    margin-bottom: 12px !important;
}

input[type="date"]:focus,
input[type="time"]:focus,
input[type="text"]:focus,
input[type="number"]:focus {
    border-color: var(--primary) !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Fix for dark mode calendar icon visibility usually handled by browser, 
   but ensuring text color is contrasty */
::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.6;
}



/* Form improvements */
.form-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* Fix input issues? */
/* ensure inputs are not hidden or have pointer-events none */
input {
    pointer-events: auto;
}


/* List updates */
.deadline-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: #333;
    border-radius: 4px;
    color: #aaa;
    margin-left: 8px;
}

.deadline-badge.urgent {
    background: rgba(255, 69, 58, 0.2);
    color: #FF453A;
}

/* Modern Profile View */
#view-profile {
    padding-bottom: 40px;
}

.profile-card {
    background: linear-gradient(135deg, #1c1c1e 0%, #2c2c2e 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 30px 20px;
    text-align: center;
    margin-bottom: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.profile-card::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(10, 132, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.profile-avatar {
    font-size: 64px;
    margin-bottom: 15px;
    display: inline-block;
}

.profile-name {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 5px;
    background: linear-gradient(to bottom, #fff, #bbb);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.profile-level {
    font-size: 14px;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.profile-xp-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    overflow: hidden;
    margin-top: 15px;
    margin-bottom: 10px;
}

.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #0A84FF, #5E5CE6);
    box-shadow: 0 0 8px rgba(10, 132, 255, 0.3);
    transition: width 1s ease-out;
}

.profile-xp-text {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Tab Bar Highlighting Fix */
.tab.active i {
    color: var(--primary) !important;
    /* Removed drop-shadow to fix muddiness */
}

.tab.active span {
    color: var(--primary) !important;
    font-weight: 700;
}

/* Profile Specific Fixes */
.back-btn {
    background: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: var(--glass);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--primary);
    display: grid;
    place-items: center;
    position: absolute;
    left: 20px;
}

.modal.open {
    transform: translateY(0);
    backdrop-filter: blur(20px) saturate(200%);
    background: rgba(28, 28, 30, 0.8);
}

.icon-btn-small {
    background: none;
    border: none;
    color: #8E8E93;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
}

/* Currency Select Styling */
.currency-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0 12px;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    min-width: 80px;
    margin-right: 8px;
}

.currency-select:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary);
}

.currency-select option {
    background: #1c1c1e;
    color: #fff;
}

.ios-btn {
    cursor: pointer;
    position: relative;
    z-index: 9999;
}

.wheel-wrapper {
    height: 250px;
    width: 90%;
    /* Reduced for safety */
    position: relative;
    margin: 20px auto;
    /* Centered */
    overflow: hidden;
}

.wheel-legend {
    display: none !important;
}



/* --- PREMIUM AI CHAT REDESIGN --- */

#view-ai {
    display: none;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    /* Below Nav which is 100? No, Nav is usually on top. Let's check. Nav should be visible. */
    background: #050505;
    overflow: hidden;
}

#view-ai.active {
    display: flex !important;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    width: 100%;
    padding: 20px;
    padding-bottom: 150px;
    /* Space for Input (60) + Nav (80) + Buffer */
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* Spacing between messages */
}

.chat-input-area {
    position: absolute;
    bottom: 90px;
    /* Sits exactly above Bottom Nav (~85px) */
    left: 0;
    width: 100%;
    background: rgba(28, 28, 30, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 10px;
}

#ai-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 10px 16px;
    color: white;
    font-size: 16px;
}

.chat-input-area button {
    background: var(--primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 10px rgba(10, 132, 255, 0.4);
}

/* Bubbles */
.message {
    display: flex;
    width: 100%;
}

.message.user {
    justify-content: flex-end;
}

.message.ai {
    justify-content: flex-start;
}

.message .bubble {
    padding: 12px 18px;
    max-width: 80%;
    line-height: 1.5;
    font-size: 15px;
    position: relative;
    word-wrap: break-word;
    user-select: text;
    /* Allow copying */
    -webkit-user-select: text;
}

/* AI Bubble: Glassy & Clean */
.message.ai .bubble,
.bubble-ai-glass {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 20px 20px 20px 4px !important;
    /* Tail bottom-left */
    color: #dedede !important;
    padding: 12px 18px;
    max-width: 80%;
    line-height: 1.5;
    font-size: 15px;
    position: relative;
    word-wrap: break-word;
    user-select: text;
}

/* User Bubble: Vibrant Gradient */
.message.user .bubble {
    background: linear-gradient(135deg, #0A84FF, #007AFF) !important;
    color: white !important;
    border-radius: 20px 20px 4px 20px !important;
    /* Tail bottom-right */
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.25) !important;
    font-weight: 500;
}

.wheel-legend {
    display: none !important;
}

/* Toast Notification */
.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: rgba(28, 28, 30, 0.9);
    color: #fff;
    text-align: center;
    border-radius: 50px;
    padding: 16px;
    position: fixed;
    z-index: 10000;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
    pointer-events: none;
}

.toast.show {
    visibility: visible;
    opacity: 1;
    bottom: 40px;
}

/* --- FORCE LAYOUT FIXES (v4: Solid Flex Layout) --- */

/* 1. View Container: Flex Column, constrained to 100vh */
#view-ai {
    display: none;
    /* Toggled by JS */
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    /* Full viewport */
    flex-direction: column !important;
    /* PADDING BOTTOM: Removed, handled by absolute positioning */
    padding-bottom: 0 !important;
    box-sizing: border-box !important;
    background: #1c1c1e !important;
    /* MATCH NAV COLOR to hide any gap */
    z-index: 50;
}

#view-ai.active {
    display: flex !important;
}

/* 2. Chat Input: Absolute Positioning to sit on top of Nav */
.chat-input-area {
    position: absolute !important;
    bottom: 60px !important;
    left: 0 !important;
    width: 100% !important;
    background: #1c1c1e !important;
    /* Match Global BG */
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 10px 16px !important;
    z-index: 60;
    margin-bottom: 0 !important;
}

/* 3. Chat Messages */
.chat-container {
    flex: 1 !important;
    height: 100% !important;
    overflow-y: auto !important;
    padding: 20px !important;
    /* PADDING BOTTOM = Nav(60) + Input(60) + Buffer(20) = 140px */
    padding-bottom: 140px !important;
    -webkit-overflow-scrolling: touch;
}

/* 4. Bottom Nav: Fix Height */
.bottom-nav {
    height: 60px !important;
    /* Force exact height */
    box-sizing: border-box !important;
    padding-bottom: 5px !important;
    /* Safe area reduced */
    z-index: 9999 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    background: #1c1c1e !important;
    /* SOLID MATCH */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* 5. Copy/Select Fixes */
.bubble-ai-glass,
.message.ai .bubble {
    user-select: text !important;
    -webkit-user-select: text !important;
    -webkit-touch-callout: default !important;
    /* Enable native menu */
    cursor: text !important;

    /* Design */
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    border-radius: 20px 20px 20px 4px !important;
}

/* POMODORO STYLES (Fixes) */
.pomo-card {
    background: #1C1C1E;
    border-radius: 40px;
    padding: 50px 30px;
    /* Increased padding */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin: 20px 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    min-height: 60vh;
}

.timer-display {
    font-size: 80px;
    font-weight: 200;
    letter-spacing: -2px;
    margin: 30px 0;
    font-variant-numeric: tabular-nums;
}

.pomo-controls {
    display: flex;
    gap: 24px;
    /* Space between buttons */
    margin-top: 50px;
    /* Space above buttons */
    align-items: center;
}

.pomo-btn {
    width: 64px;
    height: 64px;
    border-radius: 24px;
    background: var(--primary);
    border: none;
    color: white;
    font-size: 24px;
    display: grid;
    place-items: center;
    box-shadow: 0 10px 20px rgba(10, 132, 255, 0.3);
    transition: transform 0.1s;
}

.pomo-btn:active {
    transform: scale(0.95);
}

.pomo-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    width: 56px;
    height: 56px;
    border-radius: 20px;
}

/* --- NEW STYLES (LOADER, UI UPDATES) --- */

/* Loader */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Close Icon Button in Modal Header */
.modal-header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.close-icon-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-icon-btn i {
    width: 24px;
    height: 24px;
}

/* History Date */
.ios-item .date-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Wheel Banner */
.wheel-cta-banner {
    background: linear-gradient(135deg, rgba(10, 132, 255, 0.2), rgba(94, 92, 230, 0.2));
    border: 1px solid rgba(10, 132, 255, 0.3);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
}

.wheel-cta-banner h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: white;
}

.wheel-cta-banner p {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.full-width-btn {
    width: 100%;
}

/* Small Retake Button */
.retake-btn-small {
    margin-top: 10px;
    font-size: 12px;
    padding: 6px 12px;
    height: auto;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border-radius: 20px;
}