﻿*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f8f9ff;
    color: #1a1a2e;
    -webkit-tap-highlight-color: transparent;
}

/* ── Layout ───────────────────────────────────────────────── */
.content {
    padding: 16px;
    max-width: 960px;
    margin: 0 auto;
    padding-bottom: 48px;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
    border: 1px solid #eef0ff;
    padding: 16px;
    margin-bottom: 16px;
}

    .card h2 {
        font-size: 1rem;
        font-weight: 700;
        margin-bottom: 12px;
    }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: .9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all .15s;
    width: 100%;
}

    .btn:active {
        transform: scale(.97);
    }

    .btn:disabled {
        opacity: .5;
        cursor: not-allowed;
        transform: none;
    }

.btn-primary {
    background: #4f46e5;
    color: white;
}

    .btn-primary:hover {
        background: #4338ca;
    }

.btn-secondary {
    background: #f1f3ff;
    color: #4f46e5;
}

    .btn-secondary:hover {
        background: #e0e7ff;
    }

.btn-success {
    background: #10b981;
    color: white;
}

    .btn-success:hover {
        background: #059669;
    }

.btn-danger {
    background: #ef4444;
    color: white;
}

    .btn-danger:hover {
        background: #dc2626;
    }

.btn-warning {
    background: #f59e0b;
    color: white;
}

    .btn-warning:hover {
        background: #d97706;
    }

.btn-outline {
    background: transparent;
    color: #4f46e5;
    border: 2px solid #4f46e5;
}

    .btn-outline:hover {
        background: #eef2ff;
    }

.btn-sm {
    padding: 8px 14px;
    font-size: .78rem;
    border-radius: 8px;
    width: auto;
}

.btn-row {
    display: flex;
    gap: 8px;
}

    .btn-row .btn {
        flex: 1;
    }

/* ── Forms ────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: .9rem;
    color: #1a1a2e;
    background: white;
    outline: none;
    transition: border-color .15s;
}

    .form-control:focus {
        border-color: #4f46e5;
    }

.form-hint {
    font-size: .75rem;
    color: #9ca3af;
    margin-top: 4px;
}

/* ── Progress Bar ─────────────────────────────────────────── */
.progress-track {
    height: 20px;
    background: #f3f4f6;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #a855f7);
    border-radius: 999px;
    transition: width .6s;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: .8rem;
    color: #6b7280;
    margin-bottom: 6px;
}

/* ── Stat Boxes ───────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.stats-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-top: 14px;
}

.stat-box {
    padding: 12px;
    border-radius: 10px;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
}

.stat-label {
    font-size: .7rem;
    color: #6b7280;
    margin-top: 2px;
}

.bg-indigo {
    background: #eef2ff;
}

.text-indigo {
    color: #4f46e5;
}

.bg-purple {
    background: #faf5ff;
}

.text-purple {
    color: #9333ea;
}

.bg-slate {
    background: #f8fafc;
}

.text-slate {
    color: #475569;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-approved {
    background: #d1fae5;
    color: #065f46;
}

.badge-partial {
    background: #d7750c;
    color: #3b1e00;
}

.badge-rejected {
    background: #fee2e2;
    color: #991b1b;
}

.badge-available {
    background: #eef2ff;
    color: #4338ca;
}

.badge-completed {
    background: #f3f4f6;
    color: #6b7280;
}

.badge-limit {
    background: #ffedd5;
    color: #9a3412;
}

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: .85rem;
    margin-bottom: 12px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
    text-align: center;
    color: #9ca3af;
    font-size: .85rem;
    padding: 24px 0;
}

/* ── Goal Items ───────────────────────────────────────────── */
.goal-item {
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.goal-meta {
    display: flex;
    gap: 12px;
    margin-top: 6px;
    font-size: .72rem;
    color: #9ca3af;
    flex-wrap: wrap;
}

/* ── Request Cards ────────────────────────────────────────── */
.request-card {
    border: 1.5px solid #fde68a;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    background: #fffbeb;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}

    .history-item:last-child {
        border-bottom: none;
    }

/* ── Target Banner ────────────────────────────────────────── */
.target-banner {
    background: #d1fae5;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    color: #065f46;
    font-weight: 700;
    margin-top: 12px;
}

/* ── Home Screen ──────────────────────────────────────────── */
.home-screen {
    min-height: 100vh;
    background: linear-gradient(135deg, #eef2ff, #faf5ff);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* ── PIN / Login Screen ───────────────────────────────────── */
.pin-screen {
    min-height: 100vh;
    background: linear-gradient(135deg, #eef2ff, #faf5ff);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.pin-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    background: white;
    transition: all .15s;
}

    .pin-dot.filled {
        background: #4f46e5;
        border-color: #4f46e5;
    }

    .pin-dot.error {
        background: #ef4444;
        border-color: #ef4444;
    }

.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 280px;
}

.numpad-key {
    height: 64px;
    border-radius: 14px;
    font-size: 1.3rem;
    font-weight: 600;
    border: 1px solid #e5e7eb;
    background: white;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

    .numpad-key:active {
        transform: scale(.94);
        background: #eef2ff;
    }

/* ── Toggle ───────────────────────────────────────────────── */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
}

.toggle {
    position: relative;
    width: 48px;
    height: 26px;
    background: #d1d5db;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
}

    .toggle.on {
        background: #4f46e5;
    }

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    transition: transform .2s;
}

.toggle.on .toggle-thumb {
    transform: translateX(22px);
}

/* ── Period Selector ──────────────────────────────────────── */
.period-selector {
    display: flex;
    gap: 8px;
}

.period-opt {
    flex: 1;
    padding: 10px;
    text-align: center;
    border-radius: 10px;
    font-size: .8rem;
    font-weight: 600;
    border: 1.5px solid #e5e7eb;
    background: white;
    cursor: pointer;
}

    .period-opt.selected {
        background: #4f46e5;
        color: white;
        border-color: #4f46e5;
    }

/* ── Top Bar ──────────────────────────────────────────────── */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: white;
    border-bottom: 1px solid #eef0ff;
    font-size: 1rem;
}

.logout-btn {
    padding: 8px 16px;
    border-radius: 10px;
    font-size: .85rem;
    font-weight: 600;
    border: 1.5px solid #e5e7eb;
    background: white;
    color: #ef4444;
    cursor: pointer;
    transition: all .15s;
}

    .logout-btn:hover {
        background: #fee2e2;
        border-color: #ef4444;
    }

/* ── Nav Tabs ─────────────────────────────────────────────── */
.nav-tabs {
    display: flex;
    background: white;
    border-bottom: 1px solid #eef0ff;
    padding: 0 8px;
}

.nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 4px;
    min-height: 60px;
    font-size: .72rem;
    font-weight: 600;
    color: #9ca3af;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all .15s;
    -webkit-tap-highlight-color: transparent;
}

    .nav-tab span {
        font-size: 1.3rem;
    }

    .nav-tab:active {
        background: #f5f3ff;
    }

    .nav-tab.active {
        color: #4f46e5;
        border-bottom-color: #4f46e5;
    }

/* ── Request Button ───────────────────────────────────────── */
.request-btn-available {
    padding: 10px 16px;
    border-radius: 10px;
    font-size: .82rem;
    font-weight: 600;
    border: none;
    background: #4f46e5;
    color: white;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all .15s;
    min-width: 80px;
    min-height: 44px;
}

    .request-btn-available:active {
        transform: scale(.96);
        background: #4338ca;
    }

.request-btn-disabled {
    padding: 10px 16px;
    border-radius: 10px;
    font-size: .82rem;
    font-weight: 600;
    border: none;
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 80px;
    min-height: 44px;
}

/* ── Goal Tiles Grid ──────────────────────────────────────── */
.goal-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

/* ── Individual Tile ──────────────────────────────────────── */
.goal-tile {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    aspect-ratio: 1 / 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    transition: transform .15s, box-shadow .15s;
}

    .goal-tile:not(.goal-tile-exhausted) {
        cursor: pointer;
    }

        .goal-tile:not(.goal-tile-exhausted):hover {
            transform: scale(1.03);
            box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
        }

        .goal-tile:not(.goal-tile-exhausted):active {
            transform: scale(.97);
        }

    .goal-tile.goal-tile-exhausted {
        filter: grayscale(50%);
        opacity: .7;
        cursor: default;
    }

/* Tile colour variants */
.goal-tile-color-0 {
    background: #4f46e5;
}

.goal-tile-color-1 {
    background: #0ea5e9;
}

.goal-tile-color-2 {
    background: #10b981;
}

.goal-tile-color-3 {
    background: #f59e0b;
}

.goal-tile-color-4 {
    background: #ef4444;
}

.goal-tile-color-5 {
    background: #8b5cf6;
}

.goal-tile-color-6 {
    background: #ec4899;
}

.goal-tile-color-7 {
    background: #14b8a6;
}

/* ── Tile Icon ────────────────────────────────────────────── */
.goal-tile-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 64px;
}

.goal-tile-img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 6px;
}

.goal-tile-emoji {
    font-size: 3rem;
}

/* ── Tile Footer ──────────────────────────────────────────── */
.goal-tile-footer {
    position: relative;
    background: rgba(0, 0, 0, .32);
    backdrop-filter: blur(4px);
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.goal-tile-name {
    font-size: .78rem;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.goal-tile-reward {
    font-size: .72rem;
    color: rgba(255, 255, 255, .85);
    font-weight: 600;
}

/* ── Slot Checkboxes ──────────────────────────────────────── */
.goal-tile-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.slot-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, .6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    color: white;
    pointer-events: none;
}

.slot-unclaimed {
    background: rgba(255, 255, 255, .1);
}

.slot-pending {
    background: #f59e0b;
    border-color: #f59e0b;
}

.slot-approved {
    background: #10b981;
    border-color: #10b981;
}

.slot-partial {
    border-color: #d7750c;
    background: #d7750c;
}
/* ── Admin Requests ───────────────────────────────────────── */
.section-label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
    font-size: .85rem;
}

.resolve-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #fde68a;
}

.partial-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

    .partial-row .form-control {
        flex: 1;
        padding: 8px 12px;
    }

.collapse-btn {
    font-size: .75rem;
    color: #9ca3af;
    background: none;
    border: none;
    cursor: pointer;
    text-align: center;
    padding: 4px;
}

    .collapse-btn:hover {
        color: #6b7280;
    }