:root {
    --primary-color: #ef4444; /* Orange/Red */
    --hover-color: #dc2626;
    --bg-color: #fff7ed; /* Light orange tint bg */
    --text-main: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --warning-bg: #fef9c3;
    --warning-text: #854d0e;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --shadow-sm: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background-color: var(--bg-color); color: var(--text-main); }

/* Login Page Styles */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-container { background: #fff; padding: 2.5rem; border-radius: var(--radius-md); box-shadow: var(--shadow-md); width: 100%; max-width: 400px; border: 1px solid #fed7aa; }
.login-header { text-align: center; margin-bottom: 2rem; }
.login-logo { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; margin-bottom: 1rem; border: 2px solid var(--primary-color); }
.login-title { font-size: 1.5rem; font-weight: 700; color: var(--text-main); margin-bottom: 0.25rem; }
.login-subtitle { font-size: 0.875rem; color: var(--text-secondary); }

/* Forms & Buttons */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.5rem; color: var(--text-main); }
.form-control { width: 100%; padding: 0.75rem 1rem; font-size: 0.875rem; font-family: inherit; border: 1px solid var(--border-color); border-radius: var(--radius-sm); transition: border-color 0.2s, box-shadow 0.2s; background: #f8fafc; }
.form-control:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1); background: #fff; }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.75rem 1.5rem; border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: all 0.2s; border: none; font-family: inherit; text-decoration: none; }
.btn-primary { background: var(--primary-color); color: white; }
.btn-primary:hover { background: var(--hover-color); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); }
.btn-outline:hover { background: #f1f5f9; }

/* Alerts */
.alert { padding: 1rem; border-radius: var(--radius-sm); font-size: 0.875rem; margin-bottom: 1.5rem; }
.alert-info { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }
.alert-danger { background: var(--danger-bg); color: var(--danger-text); border: 1px solid #fecaca; }
.alert-success { background: var(--success-bg); color: var(--success-text); border: 1px solid #bbf7d0; }

/* Dashboard Layout */
.dashboard-nav { background: #fff; padding: 1rem 2rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 0.75rem; font-weight: 700; font-size: 1.25rem; color: var(--text-main); text-decoration: none; }
.brand img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.user-profile { display: flex; align-items: center; gap: 1rem; }
.user-info { text-align: right; }
.user-name { font-weight: 600; font-size: 0.875rem; }
.user-code { font-size: 0.75rem; color: var(--primary-color); font-weight: 500; }

.dashboard-container { max-width: 1200px; margin: 0 auto; padding: 2rem; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 2rem; }
.page-title { font-size: 1.75rem; font-weight: 700; }

/* Cards & Grid */
.card { background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); border: 1px solid #ffedd5; overflow: hidden; }
.card-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-color); background: #fafafa; }
.card-title { font-size: 1rem; font-weight: 600; margin: 0; }
.card-body { padding: 1.5rem; }

.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; }
@media (max-width: 900px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 0.25rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-reported { background: var(--danger-bg); color: var(--danger-text); }
.badge-dispatched, .badge-inprogress { background: var(--warning-bg); color: var(--warning-text); }
.badge-resolved { background: var(--success-bg); color: var(--success-text); }

/* Table */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 1rem 1.5rem; text-align: left; border-bottom: 1px solid var(--border-color); font-size: 0.875rem; }
th { background: #f8fafc; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; }
tr:last-child td { border-bottom: none; }

/* ID Card Component */
.id-card-wrap { display: flex; justify-content: center; margin-bottom: 2rem; }
.id-card { width: 320px; background: white; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.15); overflow: hidden; position: relative; border: 1px solid #e2e8f0; }
.id-card-header { background: var(--primary-color); color: white; padding: 1.25rem; text-align: center; position: relative; }
.id-card-header::after { content: ''; position: absolute; bottom: -15px; left: 0; width: 100%; height: 30px; background: white; border-radius: 50% 50% 0 0; }
.id-card-logo-wrap { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.id-card-logo { width: 30px; height: 30px; border-radius: 50%; border: 2px solid white; }
.id-card-title { font-size: 1rem; font-weight: 700; letter-spacing: 0.5px; }
.id-card-subtitle { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1px; opacity: 0.9; }

.id-card-body { padding: 1.5rem; text-align: center; background: white; }
.id-card-photo { width: 110px; height: 110px; border-radius: 12px; object-fit: cover; border: 3px solid #f8fafc; box-shadow: 0 4px 6px rgba(0,0,0,0.1); margin: 0 auto 1rem; display: block; }
.id-card-name { font-size: 1.25rem; font-weight: 700; color: #1e293b; margin-bottom: 0.25rem; }
.id-card-role { font-size: 0.875rem; color: #ef4444; font-weight: 600; text-transform: uppercase; margin-bottom: 1.5rem; }

.id-card-details { text-align: left; margin-bottom: 1.5rem; background: #f8fafc; border-radius: 8px; padding: 1rem; border: 1px solid #e2e8f0; }
.id-detail-row { display: flex; justify-content: space-between; margin-bottom: 0.5rem; font-size: 0.75rem; border-bottom: 1px dashed #cbd5e1; padding-bottom: 0.5rem; }
.id-detail-row:last-child { margin-bottom: 0; border-bottom: none; padding-bottom: 0; }
.id-detail-label { color: #64748b; font-weight: 500; }
.id-detail-value { font-weight: 700; color: #0f172a; text-align: right; }

.id-card-footer { background: #f8fafc; padding: 0.75rem; text-align: center; border-top: 1px solid #e2e8f0; font-size: 0.65rem; color: #64748b; font-weight: 500; }
.id-card-qrcode { width: 50px; height: 50px; margin: 0 auto 0.5rem; background: #fff; padding: 2px; border: 1px solid #cbd5e1; border-radius: 4px; display: flex; align-items:center; justify-content:center;}

/* Responsive Media Queries for Mobile/Tablet */
@media (max-width: 768px) {
    .dashboard-nav { padding: 1rem; flex-direction: column; gap: 1rem; }
    .user-profile { width: 100%; justify-content: space-between; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .btn { padding: 0.5rem 1rem; font-size: 0.8125rem; }
    
    /* Stacking mission cards */
    div[style*="grid-template-columns:2fr 1.5fr"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Stacking lat/long grids */
    div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Tables */
    .table-responsive { overflow-x: auto; }
    th, td { padding: 0.75rem 1rem; }
    
    .id-card { width: 100%; max-width: 320px; }

    /* Sidebar: on mobile, show Nearby Help first, then ID card last */
    .sidebar-column { display: flex; flex-direction: column; }
    .sidebar-column .id-card-wrap { order: 2; margin-top: 1.5rem; }
    .sidebar-column .card { order: 1; margin-top: 0 !important; }
}

/* Sidebar column default */
.sidebar-column .id-card-wrap { margin-bottom: 0; }
.sidebar-column .card { margin-top: 1.5rem; }
