:root {
    color-scheme: light dark;
    --vh: 1vh;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #eef2f8;
    --text: #0f172a;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
    --accent: #2f80ed;
    --accent-soft: rgba(47, 128, 237, 0.15);
    --danger: #ef4444;
    --success: #10b981;
    --success-soft: rgba(16, 185, 129, 0.12);
    --bottom-nav-h: 90px;
}

body[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #111827;
    --surface-soft: #1f2937;
    --text: #f9fafb;
    --text-muted: #9ca3af;
    --border: #2f3a4d;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    --success: #059669;
    --success-soft: rgba(5, 150, 105, 0.12);
}

body[data-accent="orange"] {
    --accent: #f97316;
    --accent-soft: rgba(249, 115, 22, 0.18);
}

body[data-accent="pink"] {
    --accent: #ec4899;
    --accent-soft: rgba(236, 72, 153, 0.18);
}

body[data-accent="blue"] {
    --accent: #2f80ed;
    --accent-soft: rgba(47, 128, 237, 0.15);
}

body[data-accent="cyan"] {
    --accent: #22d3ee;
    --accent-soft: rgba(34, 211, 238, 0.18);
}

body[data-accent="red"] {
    --accent: #ef4444;
    --accent-soft: rgba(239, 68, 68, 0.15);
}

body[data-accent="purple"] {
    --accent: #8b5cf6;
    --accent-soft: rgba(139, 92, 246, 0.18);
}

body[data-accent="magenta"] {
    --accent: #d946ef;
    --accent-soft: rgba(217, 70, 239, 0.18);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* normalize list markers (remove unexpected bullets) */
ul,
ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}

body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    /* original: keep body non-scrollable and let .container handle scrolling */
    overflow: hidden;
    overflow-x: hidden;
}

.app-shell {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.preloader {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: grid;
    place-items: center;
    z-index: 999;
}

.preloader-card {
    background: var(--surface);
    border-radius: 24px;
    padding: 52px 52px;
    box-shadow: var(--shadow);
    text-align: center;
    border: 1px solid var(--border);
}

.preloader-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--accent);
}

.preloader-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.app-header {
    padding: 32px 20px 10px;
    position: sticky;
    top: 0;
    z-index: 20;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.2));
    backdrop-filter: blur(6px);
}

.header-left h1 {
    font-size: 24px;
}

/* Profile / Gamification UI */
.profile-top {
    display: flex;
    gap: 12px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.avatar {
    width: 72px;
    height: 72px;
    border-radius: 14px;
    overflow: hidden;
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: var(--text-muted);
}

.profile-identity {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-weight: 700;
    font-size: 16px;
}

.profile-mini-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.level-badge {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: var(--surface);
    display: grid;
    place-items: center;
    font-weight: 700;
    border: 1px solid var(--border);
}

.profile-mini {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.xp-info {
    flex: 1;
}

.xp-bar {
    height: 10px;
    background: var(--surface-soft);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.xp-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 420ms ease;
}

.xp-numbers {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.streak {
    font-weight: 700;
    color: var(--accent);
}

.badge-list {
    display: flex;
    gap: 8px;
    list-style: none;
    padding: 8px 0 0;
    flex-wrap: wrap;
}

.badge-list li {
    background: var(--surface-soft);
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 13px;
}

/* badge appear animation */
.badge-new {
    animation: badge-pop 900ms cubic-bezier(.2, .9, .2, 1);
}

@keyframes badge-pop {
    0% {
        transform: scale(.6);
        opacity: 0
    }

    60% {
        transform: scale(1.06);
        opacity: 1
    }

    100% {
        transform: scale(1);
    }
}

/* xp graph */
#xp-graph {
    width: 100%;
    height: 64px;
    display: block;
    background: transparent;
}

.xp-graph-svg {
    width: 100%;
    height: 64px;
    position: relative;
}

.xp-graph-svg svg {
    width: 100%;
    height: 64px;
    overflow: visible;
}

.xp-graph-tooltip {
    position: absolute;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 6px 8px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    font-size: 12px;
    pointer-events: none;
    transform: translate(-50%, -120%);
    white-space: nowrap;
    display: none;
}

/* badge modal styles */
.badge-modal .modal-dialog {
    width: min(420px, 92%);
    padding: 18px;
}

.big-badge {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    font-size: 48px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 100%);
    color: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    transform: scale(.6);
    opacity: 0;
    transition: transform 420ms cubic-bezier(.2, .9, .2, 1), opacity 420ms ease;
}

.big-badge.show {
    transform: scale(1);
    opacity: 1;
}

/* history */
.history-list {
    list-style: none;
    padding: 8px 0 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 160px;
    overflow: auto;
}

.history-list li {
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    right: 16px;
    bottom: calc(var(--bottom-nav-h) + 16px);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    color: var(--text);
}

.header-left p {
    color: var(--text-muted);
    font-size: 14px;
}

.container {
    padding: 10px 20px calc(var(--bottom-nav-h) + 32px);
    display: grid;
    gap: 20px;
    max-width: 840px;
    margin: 0 auto;
    width: 100%;
    /* allow flex child to shrink inside .app-shell so scrolling works correctly */
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    /* ensure scrolling can reach content behind fixed bottom nav */
    scroll-padding-bottom: calc(var(--bottom-nav-h) + 32px);
    overscroll-behavior: contain;

}

/* Settings list menu + subsections */
.settings-home { display: none; }
.settings-home.active { display: block; }

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    margin: 0;
}

.settings-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    cursor: pointer;
    text-align: left;
}

.settings-item-icon {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    color: var(--text-muted);
}

.settings-item-icon svg {
    width: 18px;
    height: 18px;
}

.settings-item-text {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
}

.settings-item-chev {
    color: var(--text-muted);
    font-size: 18px;
}

.settings-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 600;
}

.settings-back-icon {
    font-size: 18px;
    line-height: 1;
}

.settings-subsection { display: none; }
.settings-subsection.active { display: block; }

.settings-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: center;
}

.settings-actions .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: normal;
    max-width: 100%;
}

.settings-actions > * {
    width: 100%;
}


/* For small screens, use block layout so cards stretch full width
   (fixes card overflow issues on narrow mobile devices) */
@media (max-width: 767px) {
    .container {
        display: block;
        padding: 10px 14px 110px;
    }

    .card {
        margin: 0 6px;
    }
}

.page-section {
    display: none;
    opacity: 0;
    transition: opacity 200ms ease;
}

.page-section.active {
    display: block;
    opacity: 1;
}

.card {
    background: var(--surface);
    border-radius: 20px;
    padding: 14px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    /* allow internal content to overflow so parent container can scroll properly */
    overflow: visible;
    position: relative;
}

/* Tasks page: top card (calendar+filter) is separate from list card; make list card scrollable */
.tasks-top-card {
    margin-bottom: 8px;
}

.tasks-list-card {
    margin-bottom: 0;
}

.tasks-list-card {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

.tasks-list-card .task-list-wrap {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 6px;
    padding-bottom: calc(var(--bottom-nav-h) + 16px);
}

.tasks-list-card .task-list {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.card h2 {
    font-size: 18px;
    margin-bottom: 14px;
}

.date-strip {
    display: grid;
    grid-auto-flow: column;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 6px;
    scrollbar-width: none;
}


.date-strip::-webkit-scrollbar {
    display: none;
}

.date-pill {
    min-width: 50px;
    padding: 8px 10px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
    text-align: center;
    display: grid;
    gap: 2px;
    cursor: pointer;
}

.date-pill .weekday {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.date-pill .day {
    font-size: 16px;
    font-weight: 700;
}

.date-pill.active {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
}

.date-pill.active .weekday {
    color: rgba(255, 255, 255, 0.8);
}

/* Categories in add form */
.category-strip-wrap {
    margin-top: 8px;
}

.category-select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
}

.category-icon {
    display: inline-grid;
}

.cat-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 6px 0;
}

.task-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
    min-width: 0;
}

.text-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.task-text .category-icon svg {
    width: 18px;
    height: 18px;
    opacity: 0.9;
}

.category-label {
    font-size: 13px;
    color: var(--text-muted);
}

.hide-native-select {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

.category-picker,
.filter-picker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
    cursor: pointer;
}

.category-picker .category-icon svg,
.filter-picker .category-icon svg {
    width: 18px;
    height: 18px;
}

.category-list,
.filter-list {
    position: absolute;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: 10px;
    margin-top: 8px;
    list-style: none;
    padding: 8px;
    display: none;
    z-index: 9999;
    max-height: 45vh;
    overflow-y: auto;
}

.category-list.open,
.filter-list.open {
    display: block;
}

.category-option,
.filter-option {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
}

.category-option:hover,
.filter-option:hover {
    background: var(--surface-soft);
}

.category-label-inline {
    font-size: 14px;
    color: var(--text);
}

.filter-label {
    font-size: 14px;
    color: var(--text-muted);
}

.chev {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.filter-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
    margin: 8px 0 12px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.counter {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}

.form {
    display: grid;
    gap: 12px;
}

.field {
    display: grid;
    gap: 2px;
    font-size: 11px;
    color: var(--text-muted);
    position: relative;
}

.settings-group {
    display: grid;
    gap: 10px;
}

.field.toggle-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: var(--text);
}

.field.toggle-field > span {
    color: var(--text);
}

.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex: 0 0 auto;
}

.toggle input {
    position: absolute;
    inset: 0;
    opacity: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.toggle-ui {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    transition: background 180ms ease, border-color 180ms ease;
}

.toggle-ui::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--border);
    transform: translateY(-50%);
    transition: left 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.toggle input:checked + .toggle-ui {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle input:checked + .toggle-ui::after {
    left: calc(100% - 21px);
    border-color: transparent;
}

.toggle input:focus-visible + .toggle-ui {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}


.field input,
.field select,
.field textarea {
    padding: 10px 6px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text);
    font-size: 12px;
}

.field textarea {
    min-height: 150px;
    resize: vertical;
    line-height: 1.4;
    white-space: pre-wrap;
}


.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 12px 18px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.btn-secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
}

.task-list {
    list-style: none;
    display: grid;
    gap: 12px;
    min-width: 0;
}

.trash-actions {
    margin-bottom: 10px;
}

.trash-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    margin: 0;
}

.trash-item {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
}

.trash-item-text {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.trash-item-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.task-item {
    position: relative;
    display: block;
    padding: 0;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    overflow: hidden;
    width: 100%;
}

.task-item.task-highlight {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.task-content {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) 48px;
    gap: 10px;
    align-items: center;
    padding: 12px 10px 12px 14px;
    background: var(--surface-soft);
    border-radius: 16px;
    transition: transform 180ms ease;
    will-change: transform;
}

.task-item.task-highlight .task-content {
    background: var(--accent-soft);
    animation: task-highlight 3000ms ease;
}

@keyframes task-highlight {
    0% {
        box-shadow: inset 0 0 0 0 var(--accent-soft);
    }
    40% {
        box-shadow: inset 0 0 0 12px rgba(47, 128, 237, 0.18);
    }
    100% {
        box-shadow: inset 0 0 0 0 var(--accent-soft);
    }
}

.task-item.swiping .task-content {
    transition: none;
}

.task-item.swipe-active {
    background: var(--danger);
    border-color: var(--danger);
}

.task-item.swipe-remove .task-content {
    transform: translateX(-120%);
}

.swipe-hint {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    opacity: 0;
    transition: opacity 120ms ease;
    pointer-events: none;
}

.task-item.swipe-active .swipe-hint {
    opacity: 1;
}

.task-item.placeholder {
    background: transparent;
    border: 1px dashed transparent;
    min-height: 64px;
}

/* Enter animation for tasks for smoother appearance */
.task-item {
    transform: translateY(6px);
    opacity: 0;
    transition: transform 220ms cubic-bezier(.2, .9, .2, 1), opacity 220ms ease;
}

.task-item.visible {
    transform: translateY(0);
    opacity: 1;
}

/* Calendar styles */
.calendar-card {
    min-height: calc(100vh - var(--bottom-nav-h));
    padding: 6px;
    padding-bottom: calc(var(--bottom-nav-h) + 16px);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.calendar-header {
    display: flex;
    align-items: center;

    /* Subtle appear animation for calendar cells */
    .calendar-cell {
        transform: translateY(4px);
        opacity: 0;
        transition: transform 200ms ease, opacity 200ms ease;
    }

    .calendar-cell.visible {
        transform: translateY(0);
        opacity: 1;
    }

    justify-content: space-between;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-cell {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
}

.calendar-cell .day-num {
    font-weight: 700;
}

.calendar-cell.has-tasks {
    box-shadow: inset 0 -9px 0 var(--accent-soft);
}

.calendar-cell.selected {
    outline: 2px solid var(--accent);
}

.calendar-day-tasks {
    margin-top: 8px;
}


.text-body span {
    font-size: 15px;
    word-break: break-word;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.text-body small {
    color: var(--text-muted);
    font-size: 12px;
    /* reliable single-line ellipsis for reminder strings */
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.task-item.completed .task-text span {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Highlight completed task card */
.task-item.completed {
    border-color: rgba(16, 185, 129, 0.18);
}

.task-item.completed .task-content {
    background: var(--success-soft);
}

/* Make the done icon use success color when completed, but keep delete button red */
.task-item.completed .icon-btn.round:not(.delete) {
    background: rgba(16, 185, 129, 0.18);
    color: var(--success);
}

.task-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    align-items: center;
    /* keep the actions compact and flush to right */
    margin-left: auto;
}

.icon-btn {
    border: none;
    background: var(--accent-soft);
    color: var(--accent);
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: grid;
    place-items: center;
}

.icon-btn.delete {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.icon-btn svg {
    width: 16px;
    height: 16px;
}

/* Modal styles */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9999;
}

.modal[aria-hidden="false"] {
    display: flex;
}

.modal-dialog {
    background: var(--surface);
    color: var(--text);
    border-radius: 14px;
    width: min(680px, 92%);
    max-width: 680px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-category {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.modal-text {
    white-space: pre-wrap;
    color: var(--text);
    font-size: 16px;
}

.modal-meta {
    color: var(--text-muted);
    font-size: 13px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
    border: none;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
}

.empty {
    text-align: center;
    color: var(--text-muted);
    padding: 6px 0 6px;
}

.settings {
    display: grid;
    gap: 14px;
}

/* (removed temporary settings scroll patch to restore previous layout) */

.field input[type="checkbox"] {
    transform: scale(1.05);
    margin-left: 8px;
}

.field input[type="number"] {
    width: 120px;
}

/* Badge list: icon + name */
.badge-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
}

.badge-item {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 6px 8px;
    border-radius: 10px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
}

.badge-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 18px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 100%);
    color: #fff;
}

.badge-name {
    font-size: 13px;
    color: var(--text);
}

.app-version {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 13px;
    padding-top: 6px;
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 10px 14px 18px;
    gap: 10px;
    box-shadow: 0 -20px 40px rgba(15, 23, 42, 0.08);
    z-index: 10;
}

.nav-item {
    border: none;
    background: transparent;
    padding: 10px 12px;
    border-radius: 14px;
    color: var(--text-muted);
    cursor: pointer;
    display: grid;
    place-items: center;
}

.nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.nav-item svg {
    width: 26px;
    height: 26px;
}

@media (min-width: 768px) {
    .container {
        padding: 20px 30px 120px;
    }

    .form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form .btn-primary {
        grid-column: span 2;
        justify-self: start;
    }

}

@media (max-width: 320px) {
    .calendar-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .field input,
    .field select,
    .field textarea {
        font-size: 12px;
    }

    .btn-primary {
        padding: 9px 10px;
        font-size: 12px;
    }

}

/* -- Profile redesign (based on provided mock) -- */
.profile-card {
    max-width: 760px;
    margin: 0 auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
}

.profile-title {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
}

.profile-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding-top: 6px;
}

.avatar-large {
    width: 110px;
    height: 110px;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    border: 4px solid var(--accent-soft);
    background: var(--surface);
    display: grid;
    place-items: center;
}

.avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-placeholder {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 28px;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    background: transparent;
}

.avatar-edit {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 2px solid var(--surface);
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

/* pill under name */
.profile-name {
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
    text-align: center;
}

.profile-pill {
    margin-top: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
    display: inline-block;
}

/* XP card layout */
.profile-xp-card {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.xp-left {
    width: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.level-badge {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: var(--surface);
    display: grid;
    place-items: center;
    font-weight: 700;
    border: 1px solid var(--border);
}

.xp-middle {
    flex: 1;
    min-width: 0;
}

.xp-row {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
}

.xp-label {
    min-width: 36px;
    font-weight: 600;
    color: var(--text-muted);
}

.xp-bar {
    height: 12px;
    background: var(--surface-soft);
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    border: 1px solid var(--border);
}

.xp-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 420ms ease;
}

.xp-numbers.small {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* right flame & number */
.xp-right {
    width: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.flame {
    font-size: 18px;
}

.xp-count {
    font-weight: 700;
    color: var(--text);
}

/* section divider and headings */
.section-divider {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 8px 0 0;
}

.section-heading {
    margin: 12px 0 8px;
    text-align: center;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.4px;
    color: var(--text);
}

/* action buttons (outline + primary) */
.profile-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding-top: 6px;
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.12);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
}

/* responsive tweaks */
@media (max-width: 640px) {
    .profile-xp-card {
        flex-direction: column;
        align-items: stretch;
    }

    .xp-left,
    .xp-right {
        width: auto;
        display: flex;
        justify-content: center;
    }

    .xp-right {
        flex-direction: row;
        gap: 8px;
        justify-content: flex-end;
    }
}