* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    font-family: Arial, sans-serif;
    background: #f4f7fb;
    color: #0f172a;
}

body {
    overflow-x: hidden;
}

a {
    text-decoration: none;
}

/* AUTH PAGES */
.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, #38bdf8, transparent 35%),
        linear-gradient(135deg, #07111f, #123c88, #0ea5e9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.auth-card {
    width: 100%;
    max-width: 430px;
    background: rgba(255,255,255,0.97);
    border-radius: 34px;
    padding: 30px 24px;
    box-shadow: 0 30px 90px rgba(0,0,0,0.35);
}

.auth-card.wide {
    max-width: 760px;
}

.brand-logo {
    width: 78px;
    height: 78px;
    margin: 0 auto 18px;
    border-radius: 28px;
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    color: white;
    display: grid;
    place-items: center;
    font-size: 38px;
    box-shadow: 0 12px 35px rgba(37,99,235,0.35);
}

.auth-card h2 {
    margin: 0;
    text-align: center;
    font-size: 27px;
}

.muted {
    text-align: center;
    color: #64748b;
    margin: 8px 0 24px;
    font-size: 14px;
}

label {
    display: block;
    margin: 14px 0 8px;
    color: #334155;
    font-size: 14px;
    font-weight: 700;
}

input, select, textarea {
    width: 100%;
    min-height: 54px;
    border: 1px solid #dbeafe;
    border-radius: 18px;
    padding: 0 16px;
    font-size: 15px;
    outline: none;
    background: #f8fafc;
    color: #0f172a;
}

textarea {
    min-height: 95px;
    padding-top: 14px;
    resize: vertical;
}

input[type="file"] {
    padding: 14px;
    height: auto;
    background: #fff;
}

input:focus, select:focus, textarea:focus {
    border-color: #2563eb;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(37,99,235,0.12);
}

.btn-primary {
    width: 100%;
    min-height: 56px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    color: white;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 14px 30px rgba(37,99,235,0.35);
}

.btn-primary:active {
    transform: scale(0.98);
}

.center-text {
    text-align: center;
    margin-top: 22px;
    color: #64748b;
    font-size: 14px;
}

.center-text a {
    color: #2563eb;
    font-weight: 800;
}

.alert {
    padding: 13px 15px;
    border-radius: 16px;
    margin: 15px 0;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    line-height: 1.4;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
}

.alert.success {
    background: #dcfce7;
    color: #166534;
}

/* APP LAYOUT */
.app-shell {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    min-height: 100vh;
    background: #f8fafc;
    padding-bottom: 92px;
}

.top-header {
    background: linear-gradient(135deg, #0f172a, #1d4ed8);
    color: white;
    padding: 22px 18px 28px;
    border-bottom-left-radius: 28px;
    border-bottom-right-radius: 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-header h3 {
    margin: 0;
    font-size: 24px;
}

.top-header p {
    margin: 5px 0 0;
    color: #dbeafe;
}

.avatar {
    width: 48px;
    height: 48px;
    background: white;
    color: #1d4ed8;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-weight: 900;
}

.content {
    padding: 16px;
}

.welcome-card,
.section-card,
.visitor-card,
.request-card,
.profile-card,
.list-card {
    background: white;
    border-radius: 24px;
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 10px 30px rgba(15,23,42,0.08);
}

.welcome-card {
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    color: white;
}

.welcome-card h2 {
    margin: 0 0 8px;
}

.welcome-card p {
    margin: 0;
    color: #e0f2fe;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

.stat-card {
    padding: 18px;
    border-radius: 22px;
    color: white;
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

.stat-card span {
    font-size: 13px;
}

.stat-card h2 {
    margin: 10px 0 0;
    font-size: 32px;
}

.blue { background: linear-gradient(135deg, #2563eb, #38bdf8); }
.green { background: linear-gradient(135deg, #16a34a, #86efac); }
.orange { background: linear-gradient(135deg, #f97316, #facc15); }
.red { background: linear-gradient(135deg, #dc2626, #fb7185); }

.quick-actions {
    display: grid;
    gap: 12px;
}

.quick-actions a {
    background: #f1f5f9;
    color: #0f172a;
    padding: 16px;
    border-radius: 18px;
    font-weight: 800;
}

/* BOTTOM NAV */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 520px;
    width: 100%;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 10px 6px 12px;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.08);
    z-index: 999;
}

.bottom-nav a {
    color: #64748b;
    text-align: center;
    font-size: 20px;
}

.bottom-nav span {
    display: block;
    font-size: 11px;
    margin-top: 3px;
    font-weight: 700;
}

.search-box {
    display: flex;
    gap: 10px;
}

.search-box input {
    flex: 1;
}

.search-box .btn-primary {
    width: auto;
    margin: 0;
    padding: 0 18px;
}

.visitor-img {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    border-radius: 20px;
    margin-bottom: 12px;
}

.action-row {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.action-row form,
.action-row a {
    flex: 1;
    text-align: center;
}

.btn-green,
.btn-warning {
    display: block;
    border: 0;
    color: white;
    padding: 13px 14px;
    border-radius: 14px;
    font-weight: 800;
    width: 100%;
}

.btn-green { background: #16a34a; }
.btn-warning { background: #f59e0b; }

.list-card {
    display: flex;
    gap: 14px;
    align-items: center;
}

.list-card img,
.mini-avatar {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    object-fit: cover;
    background: #e0f2fe;
    display: grid;
    place-items: center;
}

.empty-state {
    background: white;
    border-radius: 22px;
    padding: 30px;
    text-align: center;
    color: #64748b;
    box-shadow: 0 10px 30px rgba(15,23,42,0.08);
}

.status-pill {
    display: inline-block;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 12px;
    background: #e2e8f0;
    color: #334155;
}

.status-pill.pending {
    background: #fef3c7;
    color: #92400e;
}

.status-pill.approved_by_village {
    background: #dcfce7;
    color: #166534;
}

.status-pill.rejected_by_village {
    background: #fee2e2;
    color: #991b1b;
}

.profile-card {
    text-align: center;
}

.profile-avatar {
    width: 90px;
    height: 90px;
    border-radius: 32px;
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    color: white;
    display: grid;
    place-items: center;
    font-size: 42px;
    font-weight: 900;
    margin: 0 auto 14px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 14px 0;
    border-bottom: 1px solid #e5e7eb;
}

.info-row span {
    color: #64748b;
}

.logout-btn {
    display: block;
    text-align: center;
    margin-top: 18px;
    padding: 15px;
    border-radius: 18px;
    background: #ef4444;
    color: white;
    font-weight: 900;
}

/* MOBILE FIX */
@media (max-width: 480px) {
    .auth-body {
        display: block;
        min-height: 100vh;
        padding: 18px;
        overflow-y: auto;
    }

    .auth-card {
        max-width: 100%;
        margin-top: 28px;
        border-radius: 28px;
    }

    .auth-card.wide {
        max-width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .search-box {
        flex-direction: column;
    }

    .search-box .btn-primary {
        width: 100%;
        min-height: 54px;
    }
}

@media (min-width: 800px) {
    .app-shell {
        border-left: 1px solid #e5e7eb;
        border-right: 1px solid #e5e7eb;
    }
}