:root {
    /* --- Base Variables (Light Mode / Her) --- */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --input-bg: #f1f5f9;
    --nav-bg: rgba(255, 255, 255, 0.9);
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    
    /* Theme Specific (Blue default) */
    --primary: #2563eb;
    --primary-soft: #eff6ff;
    --accent: #3b82f6;
    --success-bg: #dcfce7;
    --success-text: #166534;
}

[data-theme="dark"] {
    /* --- Dark Mode Variables (Him) --- */
    --bg-body: #020617;
    --bg-card: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #1e293b;
    --input-bg: #1e293b;
    --nav-bg: rgba(2, 6, 23, 0.9);
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);

    /* Theme Specific (Rose) */
    --primary: #e11d48;
    --primary-soft: rgba(225, 29, 72, 0.15);
    --accent: #f43f5e;
    --success-bg: rgba(34, 197, 94, 0.2);
    --success-text: #4ade80;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    transition: background-color 0.4s ease, color 0.4s ease;
    padding-bottom: 90px;
}

h1, h2, h3, .serif { font-family: 'Playfair Display', serif; }

/* Utilities */
.hidden { display: none !important; }
.screen { opacity: 0; transition: opacity 0.4s ease; position: absolute; width: 100%; top: 0; left: 0; pointer-events: none; z-index: 0; }
.screen.active { opacity: 1; position: relative; pointer-events: auto; z-index: 10; }
.icon { width: 20px; height: 20px; stroke-width: 2; }

/* --- Auth Screen --- */
#auth-screen {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, var(--bg-card), var(--bg-body));
}

.logo-container { margin-bottom: 3rem; text-align: center; }
.logo-main { font-size: 3rem; margin-bottom: 0.5rem; letter-spacing: -1px; }
.logo-sub { font-size: 0.75rem; letter-spacing: 0.3em; color: var(--text-muted); text-transform: uppercase; }

.auth-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; width: 100%; max-width: 340px; padding: 0 1.5rem; }
.user-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 20; /* Ensure clickable */
}
.user-card:active { transform: scale(0.96); }

.user-avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex; align-items: center; justify-content: center;
    background: var(--input-bg);
    color: var(--text-muted);
    transition: all 0.3s;
}
.user-card:hover .user-avatar { background: var(--primary-soft); color: var(--primary); }
.user-name { font-size: 1rem; font-weight: 500; }

/* --- Header --- */
.app-header {
    position: sticky; top: 0; z-index: 40;
    background: var(--nav-bg); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    display: flex; justify-content: space-between; align-items: center;
}
.header-profile { display: flex; align-items: center; gap: 1rem; }
.header-avatar { 
    width: 40px; height: 40px; 
    border-radius: 50%; 
    background: var(--primary); 
    color: #fff; 
    display: flex; align-items: center; justify-content: center; 
}
.date-badge { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); display: block; margin-top: 2px; }
.btn-icon-only { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 0.5rem; }

/* --- Layout Components --- */
main { padding: 1.5rem 1.25rem; max-width: 600px; margin: 0 auto; }

.card {
    background: var(--bg-card);
    border-radius: 1.25rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.section-title { font-size: 1.75rem; margin-bottom: 1.5rem; color: var(--text-main); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.card-title { font-size: 1rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); display: flex; align-items: center; gap: 0.5rem; }

/* List Styles */
.list-row { display: flex; align-items: start; gap: 0.75rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.bullet { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); margin-top: 8px; flex-shrink: 0; }
.list-text { font-size: 0.95rem; line-height: 1.5; flex: 1; }
.btn-delete { color: var(--text-muted); opacity: 0.5; background: none; border: none; padding: 0 0.5rem; }

/* Inputs & Forms */
.input-row { display: flex; gap: 0.5rem; margin-top: 1rem; }
.input-std { flex: 1; background: var(--input-bg); border: none; padding: 0.85rem 1rem; border-radius: 0.75rem; color: var(--text-main); font-family: inherit; font-size: 0.9rem; }
.input-std:focus { outline: 2px solid var(--primary); }
.btn-submit { background: var(--primary); color: #fff; border: none; width: 44px; border-radius: 0.75rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* File Upload & Preview */
.file-upload-wrapper { margin-top: 1rem; }
.file-label { display: flex; align-items: center; gap: 0.5rem; padding: 1rem; background: var(--input-bg); border-radius: 0.75rem; color: var(--text-muted); cursor: pointer; border: 1px dashed var(--border); justify-content: center; }
.file-label:active { background: var(--border); }
.preview-container { margin-top: 0.5rem; position: relative; }
.preview-container img { width: 100%; border-radius: 0.75rem; border: 1px solid var(--border); max-height: 200px; object-fit: cover; }
.btn-remove-img { position: absolute; top: 0.5rem; right: 0.5rem; background: rgba(0,0,0,0.6); color: #fff; border: none; padding: 0.25rem 0.5rem; border-radius: 0.25rem; font-size: 0.75rem; cursor: pointer; }

/* Complex Components */
.event-item { display: flex; align-items: center; gap: 1rem; padding: 1rem; background: var(--bg-body); border-radius: 1rem; margin-bottom: 0.75rem; }
.event-icon-box { width: 44px; height: 44px; background: var(--bg-card); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--primary); border: 1px solid var(--border); }
.days-tag { font-size: 0.7rem; background: var(--primary); color: #fff; padding: 2px 8px; border-radius: 12px; margin-left: auto; }

.moment-card { padding-left: 1.5rem; border-left: 2px solid var(--border); margin-bottom: 2rem; position: relative; }
.moment-card::after { content:''; position: absolute; left: -5px; top: 0; width: 8px; height: 8px; background: var(--primary); border-radius: 50%; }
.moment-date { font-size: 0.75rem; color: var(--primary); font-weight: 700; text-transform: uppercase; margin-bottom: 0.5rem; display: block; }
.moment-body { background: var(--bg-card); padding: 1.25rem; border-radius: 1rem; border: 1px solid var(--border); }
.moment-img { width: 100%; border-radius: 0.5rem; margin-top: 0.75rem; }

.ticket { background: var(--bg-card); border: 1px solid var(--border); border-radius: 1rem; padding: 1.25rem; margin-bottom: 1rem; }
.ticket-top { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.status-badge { background: var(--input-bg); padding: 2px 8px; border-radius: 4px; }
.status-Resolved { background: var(--success-bg); color: var(--success-text); }
.defense-box { background: var(--input-bg); padding: 1rem; border-radius: 0.75rem; margin-top: 1rem; font-size: 0.9rem; border-left: 3px solid var(--primary); }

/* Footer & Nav */
.app-footer { text-align: center; padding: 2rem; border-top: 1px solid var(--border); margin-top: 2rem; }
.app-footer a { color: var(--text-main); text-decoration: none; font-family: 'Playfair Display', serif; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.app-footer p { font-size: 0.65rem; color: var(--text-muted); letter-spacing: 0.2em; margin-bottom: 0.5rem; }

.bottom-nav {
    position: fixed; bottom: 0; width: 100%;
    background: var(--nav-bg); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    display: flex; justify-content: space-around;
    padding: 0.75rem 0 1.5rem;
    z-index: 50;
}
.nav-item { background: none; border: none; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-muted); cursor: pointer; }
.nav-item span { font-size: 0.65rem; font-weight: 500; }
.nav-item.active { color: var(--primary); }

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(5px); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.modal-box { background: var(--bg-card); width: 100%; max-width: 320px; padding: 2rem; border-radius: 1.5rem; text-align: center; position: relative; border: 1px solid var(--border); }
.pin-display { font-size: 2.5rem; letter-spacing: 0.5em; border: none; border-bottom: 2px solid var(--border); background: transparent; color: var(--text-main); width: 100%; text-align: center; padding: 0.5rem; margin: 1.5rem 0; font-family: 'Playfair Display', serif; }
.pin-display:focus { outline: none; border-color: var(--primary); }
.btn-close-modal { position:absolute; top:1rem; right:1rem; background:none; border:none; font-size:1.5rem; color:var(--text-muted); cursor:pointer; }
.btn-close-modal:active { transform: scale(0.9); }

/* Floating Action Button */
.fab { position: fixed; bottom: 100px; right: 20px; width: 56px; height: 56px; background: var(--primary); color: #fff; border-radius: 50%; border: none; box-shadow: 0 4px 12px rgba(0,0,0,0.2); z-index: 45; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform 0.2s; }
.fab:active { transform: scale(0.9); }