:root {
    /* Premium Palette */
    --bg-color: #000000;
    --card-color: rgba(28, 28, 30, 0.6);
    /* More transparent */
    --card-border: 1px solid rgba(255, 255, 255, 0.08);

    --primary: #0A84FF;
    --primary-glow: rgba(10, 132, 255, 0.4);

    --text-primary: #FFFFFF;
    --text-secondary: rgba(235, 235, 245, 0.6);

    --separator: rgba(255, 255, 255, 0.1);
    --safe-area-bottom: env(safe-area-inset-bottom, 20px);

    --glass: blur(20px) saturate(180%);
}

body {
    background-color: #000000;
    /* Deep Gradient Mesh Background */
    background-image:
        radial-gradient(circle at 0% 0%, rgba(10, 132, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 100% 0%, rgba(172, 50, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(10, 132, 255, 0.1) 0%, transparent 50%);
    background-attachment: fixed;

    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;
}

/* 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);
}

/* ... 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 */
.center-vertical {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 80vh;
}

.timer-circle-container {
    position: relative;
    width: 280px;
    height: 280px;
    margin-bottom: 40px;
}

.timer-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: #2C2C2E;
    stroke-width: 4;
}

.timer-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 4;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 56px;
    font-weight: 200;
    font-feature-settings: "tnum";
}

.timer-sub {
    position: absolute;
    top: 70%;
    left: 50%;
    transform: translate(-50%, 0);
    font-size: 15px;
    color: var(--text-secondary);
}

.pomo-controls {
    display: flex;
    align-items: center;
    gap: 30px;
}

.ios-btn {
    background: var(--card-color);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: grid;
    place-items: center;
}

.ios-btn.big {
    width: 80px;
    height: 80px;
    font-size: 32px;
    background: var(--primary);
    box-shadow: 0 10px 40px var(--primary-glow);
    transition: transform 0.1s, box-shadow 0.2s;
}

.ios-btn.big:active {
    transform: scale(0.9);
    box-shadow: 0 5px 20px var(--primary-glow);
}

.ios-btn:active {
    transform: scale(0.95);
    opacity: 0.8;
}

/* 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 */
.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 {
    color: var(--primary);
}

.tabspan {
    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;
}

/* 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);
}

.modal.open {
    transform: translateY(0);
}

.modal-header {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

.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;
    gap: 6px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.cat-item.active {
    background: var(--primary);
    color: white;
}

.cat-icon {
    font-size: 24px;
}

.cat-name {
    font-size: 10px;
}

.amount-input-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-bottom: 20px;
}

.amount-input-wrapper span {
    font-size: 32px;
    font-weight: 700;
}

.amount-input-wrapper input {
    text-align: center;
    background: transparent !important;
    font-size: 40px !important;
    font-weight: 700;
    margin: 0 !important;
    width: 150px !important;
    padding: 0 !important;
}

.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: #2C2C2E;
    border-radius: 8px;
    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);
}

color: var(--primary);
width: 36px;
height: 36px;
border-radius: 50%;
display: grid;
place-items: center;
}

/* 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 Input Styling */
input[type="date"],
input[type="time"] {
    appearance: none;
    -webkit-appearance: none;
    background: #1C1C1E;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    flex: 1;
    height: 44px;
    /* Standard iOS touch height */
    outline: none;
    transition: border-color 0.2s;
}

input[type="date"]:focus,
input[type="time"]:focus {
    border-color: #0A84FF;
}

/* 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;
}

.content {
    flex: 1;
    display: flex;
    align-items: center;
}

.icon-btn-small {
    background: none;
    border: none;
    color: #8E8E93;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
}
