/* ============================================================
   FamilyMonte — design tokens + premium glass UI
   ============================================================ */
:root {
    --bg-0: #07091a;
    --bg-1: #0b1020;
    --bg-2: #131a36;
    --bg-3: #1a2244;
    --line-1: rgba(255,255,255,0.07);
    --line-2: rgba(255,255,255,0.12);
    --ink-1: #f4f6ff;
    --ink-2: #c5cbe3;
    --ink-3: #8c95b6;
    --ink-4: #5f6889;
    --gold-1: #f59e0b;
    --gold-2: #fbbf24;
    --gold-3: #fcd34d;
    --emerald: #10b981;
    --rose: #f43f5e;
    --indigo: #6366f1;
    --violet: #a855f7;
    --cyan: #06b6d4;
    --shadow-1: 0 4px 20px rgba(0,0,0,.35);
    --shadow-2: 0 12px 40px rgba(0,0,0,.45);
    --r-sm: 10px;
    --r:    16px;
    --r-lg: 22px;
    --r-xl: 28px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg-0); color: var(--ink-1); margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', Segoe UI, sans-serif;
    background: radial-gradient(1200px 600px at 20% -10%, rgba(99,102,241,.20), transparent 60%),
                radial-gradient(1200px 600px at 110% 10%, rgba(245,158,11,.16), transparent 55%),
                radial-gradient(900px 500px at 50% 110%, rgba(168,85,247,.18), transparent 55%),
                linear-gradient(180deg, var(--bg-0), var(--bg-1));
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Glassmorphic surfaces */
.glass {
    background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
    border: 1px solid var(--line-2);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-radius: var(--r-lg);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06), var(--shadow-1);
}
.glass-strong {
    background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
    border: 1px solid var(--line-2);
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    border-radius: var(--r-lg);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08), var(--shadow-2);
}

/* Text helpers */
.gold-text {
    background: linear-gradient(135deg, var(--gold-3), var(--gold-1));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
.gradient-text-1 {
    background: linear-gradient(135deg, #fff 0%, #c5cbe3 60%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 18px; border-radius: 12px;
    font-weight: 600; font-size: 14px; letter-spacing: .2px;
    cursor: pointer; transition: all .2s cubic-bezier(.4,.0,.2,1);
    border: 1px solid transparent; user-select: none;
    min-height: 44px; /* tap target */
}
.btn:active { transform: scale(.97); }
.btn-primary {
    background: linear-gradient(180deg, var(--gold-1) 0%, #d97706 100%);
    color: #1a1304;
    box-shadow: 0 6px 18px rgba(245,158,11,.32), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn-primary:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn-ghost {
    background: rgba(255,255,255,.06);
    color: var(--ink-1);
    border-color: var(--line-2);
}
.btn-ghost:hover { background: rgba(245,158,11,.10); color: var(--gold-2); border-color: rgba(245,158,11,.4); }
.btn-danger {
    background: rgba(244,63,94,.14); color: #fda4af; border-color: rgba(244,63,94,.35);
}
.btn-danger:hover { background: rgba(244,63,94,.22); }
.btn-success {
    background: linear-gradient(180deg, var(--emerald) 0%, #059669 100%);
    color: #fff; box-shadow: 0 6px 18px rgba(16,185,129,.32);
}

/* Inputs */
.field { display: flex; flex-direction: column; gap: 6px; }
.label {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
    color: var(--ink-3);
}
.input, .select, .textarea {
    width: 100%;
    background: rgba(0,0,0,.32);
    border: 1px solid var(--line-2);
    color: var(--ink-1);
    padding: 13px 14px;
    border-radius: 12px;
    font-size: 16px; /* iOS no-zoom */
    font-family: inherit;
    transition: all .15s;
    -webkit-appearance: none; appearance: none;
}
.input:focus, .select:focus, .textarea:focus {
    outline: 0;
    border-color: var(--gold-1);
    box-shadow: 0 0 0 4px rgba(245,158,11,.18);
    background: rgba(0,0,0,.4);
}
.select { background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238c95b6' d='M6 8.5L1.5 4h9z'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 14px center; padding-right: 36px; }

/* Bottom navigation */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 40;
    padding: 8px 12px calc(env(safe-area-inset-bottom, 0) + 8px);
    background: linear-gradient(180deg, rgba(11,16,32,0), rgba(11,16,32,.92) 35%, rgba(11,16,32,1));
}
.bottom-nav-inner {
    background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
    border: 1px solid var(--line-2);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-radius: 22px;
    padding: 6px;
    display: grid; grid-template-columns: repeat(5, 1fr);
    box-shadow: 0 -8px 30px rgba(0,0,0,.4);
}
.bn-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 9px 4px; border-radius: 16px;
    color: var(--ink-3); cursor: pointer;
    transition: all .2s; font-size: 10px; font-weight: 600;
}
.bn-item svg { width: 22px; height: 22px; }
.bn-item.active {
    background: linear-gradient(180deg, rgba(245,158,11,.16), rgba(245,158,11,.06));
    color: var(--gold-2);
    box-shadow: inset 0 0 0 1px rgba(245,158,11,.22), 0 6px 18px rgba(245,158,11,.18);
}
.bn-item:active { transform: scale(.94); }

/* FAB */
.fab {
    position: fixed; bottom: calc(env(safe-area-inset-bottom, 0) + 86px);
    right: 18px; z-index: 39;
    width: 60px; height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-1), #d97706);
    color: #1a1304;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 10px 28px rgba(245,158,11,.45), inset 0 1px 0 rgba(255,255,255,.3);
    cursor: pointer; transition: all .2s;
    border: 0;
}
.fab:active { transform: scale(.94); }
.fab svg { width: 26px; height: 26px; }

/* Chip */
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
    background: rgba(255,255,255,.05); border: 1px solid var(--line-2);
    color: var(--ink-2);
}
.chip-active { background: rgba(245,158,11,.18); color: var(--gold-2); border-color: rgba(245,158,11,.4); }

/* Animated number reveal */
.num-flow { transition: all .4s cubic-bezier(.4,.0,.2,1); }

/* Skeleton */
.skel {
    background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.08), rgba(255,255,255,.04));
    background-size: 200% 100%;
    animation: skel 1.4s linear infinite;
    border-radius: 8px;
}
@keyframes skel { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* Toast */
.toast-stack { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; padding: 0 12px; pointer-events: none; }
.toast {
    pointer-events: auto;
    background: linear-gradient(180deg, rgba(20,28,56,.96), rgba(15,22,46,.96));
    border: 1px solid var(--line-2);
    backdrop-filter: blur(20px);
    padding: 12px 16px;
    border-radius: 14px;
    color: var(--ink-1);
    box-shadow: var(--shadow-2);
    min-width: 260px; max-width: 92vw;
    display: flex; align-items: center; gap: 10px;
    animation: toast-in .3s cubic-bezier(.4,.0,.2,1);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.96); } to { opacity: 1; transform: none; } }
.toast.error { border-color: rgba(244,63,94,.4); }
.toast.success { border-color: rgba(16,185,129,.4); }

/* Modal sheet (bottom sheet on mobile) */
.sheet-backdrop {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(4,6,16,.6);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    animation: fade-in .2s;
}
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }
.sheet {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 51;
    background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
    border-top: 1px solid var(--line-2);
    border-radius: 28px 28px 0 0;
    padding: 8px 18px calc(env(safe-area-inset-bottom, 0) + 24px);
    max-height: 92vh; overflow-y: auto;
    animation: sheet-up .3s cubic-bezier(.4,.0,.2,1);
    box-shadow: 0 -20px 60px rgba(0,0,0,.6);
}
@media (min-width: 768px) {
    .sheet { left: 50%; right: auto; transform: translateX(-50%); bottom: 50%; max-width: 460px; width: calc(100% - 32px); border-radius: 28px; transform: translate(-50%, 50%); }
    @keyframes sheet-up { from { opacity: 0; transform: translate(-50%, calc(50% + 30px)); } to { opacity: 1; transform: translate(-50%, 50%); } }
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { width: 40px; height: 4px; background: var(--line-2); border-radius: 999px; margin: 8px auto 14px; }

/* Hide scrollbars but keep scrollable */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

/* Avatar */
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; font-weight: 700;
    background: linear-gradient(135deg, rgba(255,255,255,.18), rgba(255,255,255,.04));
    border: 1.5px solid var(--line-2);
}

/* Pulse dot */
.dot-pulse {
    width: 8px; height: 8px; border-radius: 50%; background: var(--emerald);
    box-shadow: 0 0 0 0 rgba(16,185,129,.6);
    animation: pulse 2.2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16,185,129,.6); }
    70% { box-shadow: 0 0 0 14px rgba(16,185,129,0); }
    100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* Slide animations for view switch */
.view-enter { animation: viewIn .35s cubic-bezier(.2,.7,.2,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

[x-cloak] { display: none !important; }

/* Custom checkbox */
.fm-check {
    width: 26px; height: 26px;
    border-radius: 9px;
    border: 2px solid var(--line-2);
    background: rgba(0,0,0,.25);
    display: inline-flex; align-items: center; justify-content: center;
    transition: all .15s;
    cursor: pointer;
}
.fm-check.checked {
    background: linear-gradient(135deg, var(--emerald), #047857);
    border-color: var(--emerald);
}
.fm-check.checked svg { animation: pop .25s cubic-bezier(.4,.0,.2,1); }
@keyframes pop { 0% { transform: scale(0); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* PIN dots */
.pin-dot {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid var(--line-2);
    transition: all .2s;
}
.pin-dot.filled { background: var(--gold-1); border-color: var(--gold-1); transform: scale(1.1); }

/* Numpad */
.numpad-btn {
    height: 60px; border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
    border: 1px solid var(--line-2);
    color: var(--ink-1); font-size: 24px; font-weight: 700;
    cursor: pointer; transition: all .15s;
    display: flex; align-items: center; justify-content: center;
}
.numpad-btn:active { transform: scale(.94); background: rgba(245,158,11,.18); border-color: rgba(245,158,11,.4); }
