/* ============================================================
   驿站志愿者管理系统 - 样式表
   ============================================================ */

/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: -apple-system, "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    color: #1e293b;
    background: #f1f5f9;
    line-height: 1.6;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
img { max-width: 100%; }
table { border-collapse: collapse; width: 100%; }

/* ===== Layout ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px;
    background: #1e293b;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    overflow-y: auto;
}
.main-content {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ===== Sidebar ===== */
.sidebar-logo {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #334155;
}
.logo-icon { font-size: 24px; color: #60a5fa; }
.logo-text { font-size: 15px; font-weight: 700; color: #f1f5f9; white-space: nowrap; }

.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-item {
    display: block;
    padding: 10px 24px;
    color: #94a3b8;
    font-size: 14px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}
.nav-item:hover {
    background: #334155;
    color: #f1f5f9;
    text-decoration: none;
}
.nav-item.active {
    background: #334155;
    color: #60a5fa;
    border-left-color: #60a5fa;
    font-weight: 600;
}
.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid #334155;
}
.user-badge { margin-bottom: 10px; }
.user-role {
    display: inline-block;
    background: #334155;
    color: #93c5fd;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 4px;
}
.user-name { display: block; color: #e2e8f0; font-size: 13px; }
.btn-logout {
    display: block;
    color: #94a3b8;
    font-size: 13px;
    padding: 6px 0;
}
.btn-logout:hover { color: #f87171; text-decoration: none; }

/* ===== Top Bar ===== */
.top-bar {
    background: #fff;
    padding: 16px 28px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.page-title { font-size: 20px; font-weight: 700; color: #0f172a; }

/* Mobile menu toggle button - hidden on desktop */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.menu-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: #1e293b;
    border-radius: 2px;
    transition: all 0.2s;
}

/* Sidebar overlay - hidden on desktop */
.sidebar-overlay {
    display: none;
}

/* ===== Page Body ===== */
.page-body { padding: 24px 28px; flex: 1; }

/* ===== Card ===== */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h2 { font-size: 16px; font-weight: 600; }
.card-body { padding: 20px; }

/* ===== Stat Cards ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-left: 4px solid #2563eb;
}
.stat-card.green { border-left-color: #16a34a; }
.stat-card.orange { border-left-color: #f59e0b; }
.stat-card.purple { border-left-color: #8b5cf6; }
.stat-card.red { border-left-color: #dc2626; }
.stat-label { font-size: 13px; color: #64748b; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; color: #0f172a; }
.stat-unit { font-size: 14px; color: #64748b; margin-left: 4px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #374151;
    font-size: 13px;
}
.form-group label .required { color: #dc2626; }
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.15s;
    background: #fff;
    color: #1e293b;
}
.form-control:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-control:disabled { background: #f9fafb; color: #9ca3af; }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}
.form-row-4 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 16px;
}
.form-hint { font-size: 12px; color: #9ca3af; margin-top: 4px; }
.form-actions { margin-top: 20px; display: flex; gap: 10px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-info { background: #0891b2; color: #fff; }
.btn-info:hover { background: #0e7490; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-secondary:hover { background: #d1d5db; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
table.data-table {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}
table.data-table th {
    background: #f8fafc;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}
table.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}
table.data-table tr:hover td { background: #f8fafc; }
table.data-table tr:last-child td { border-bottom: none; }
.table-empty { text-align: center; color: #9ca3af; padding: 32px 0; }

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
}
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-danger  { background: #fee2e2; color: #dc2626; }
.badge-info    { background: #dbeafe; color: #2563eb; }
.badge-gray    { background: #f1f5f9; color: #64748b; }
.badge-purple  { background: #ede9fe; color: #7c3aed; }

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.alert-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ===== Auth Pages ===== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    padding: 20px;
}
.auth-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 560px;
    overflow: hidden;
}
.auth-header {
    background: #1e293b;
    color: #fff;
    padding: 28px 32px;
    text-align: center;
}
.auth-header h1 { font-size: 22px; margin-bottom: 4px; }
.auth-header p { font-size: 13px; color: #94a3b8; }
.auth-body { padding: 28px 32px; }
.auth-footer { padding: 16px 32px 28px; text-align: center; font-size: 13px; color: #9ca3af; }

/* ===== Filter Bar ===== */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 20px;
    flex-wrap: wrap;
    background: #fff;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.filter-bar .form-group { margin-bottom: 0; min-width: 140px; }

/* ===== Progress Bar ===== */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: #2563eb;
    border-radius: 4px;
    transition: width 0.3s;
}
.progress-bar-fill.full { background: #16a34a; }
.progress-bar-fill.warning { background: #f59e0b; }
.progress-bar-fill.danger { background: #dc2626; }

/* ===== Misc ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #9ca3af; }
.text-success { color: #16a34a; }
.text-danger { color: #dc2626; }
.text-warning { color: #d97706; }
.text-info { color: #2563eb; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #9ca3af;
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 15px; }

/* ===== Certificate (A4) ===== */
.certificate {
    width: 794px;
    min-height: 1123px;
    margin: 0 auto;
    background: #fff;
    border: 3px double #2563eb;
    padding: 40px 50px;
    position: relative;
}
.certificate-inner {
    border: 1px solid #bfdbfe;
    padding: 50px 40px;
    text-align: center;
    min-height: 1040px;
}
.certificate-title {
    font-size: 36px;
    font-weight: 700;
    color: #1e3a5f;
    letter-spacing: 6px;
    margin-bottom: 8px;
}
.certificate-subtitle {
    font-size: 14px;
    color: #64748b;
    letter-spacing: 3px;
    margin-bottom: 30px;
}
.certificate-body {
    font-size: 16px;
    line-height: 2;
    color: #334155;
    text-align: left;
    text-indent: 2em;
    margin-bottom: 24px;
}
.certificate-name {
    font-size: 22px;
    font-weight: 700;
    color: #dc2626;
    border-bottom: 1px solid #dc2626;
    display: inline-block;
    padding: 0 16px 4px;
    margin: 0 6px;
}
.certificate-hours {
    font-size: 24px;
    font-weight: 700;
    color: #dc2626;
}
.certificate-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}
.certificate-org { font-size: 14px; color: #475569; }
.certificate-date { font-size: 14px; color: #475569; }
.certificate-no { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.certificate-seal {
    width: 90px;
    height: 90px;
    border: 3px solid #dc2626;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #dc2626;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    line-height: 1.3;
    transform: rotate(-15deg);
    margin: 20px auto 0;
    opacity: 0.8;
}

/* ===== Print ===== */
@media print {
    @page { size: A4; margin: 0; }
    .sidebar, .top-bar, .filter-bar, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-body { padding: 0 !important; }
    body { background: #fff; }

    /* 证书打印 - 保持与显示相同的A4尺寸 */
    .certificate {
        border: 3px double #2563eb;
        width: 794px;
        min-height: 1123px;
        margin: 0 auto;
        padding: 40px 50px;
    }
    .certificate-inner { min-height: 1040px; padding: 50px 40px; }

    /* 志愿者证打印 - 强制保留背景颜色 */
    .volunteer-card {
        box-shadow: none !important;
        margin: 0 auto !important;
        width: 540px !important;
        max-width: 100% !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .volunteer-card * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* ===== Certificate Photo ===== */
.certificate-photo-area {
    text-align: center;
    margin-bottom: 16px;
}
.certificate-photo {
    width: 150px;
    height: 200px;
    object-fit: cover;
    border: 1px solid #bfdbfe;
    border-radius: 3px;
}

/* ===== Volunteer Card (电子志愿者证) ===== */
.volunteer-card {
    width: 540px;
    max-width: 100%;
    margin: 0 auto 30px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    border-radius: 16px;
    color: #fff;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(30,58,95,0.3);
}
.vc-header {
    text-align: center;
    padding: 28px 30px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}
.vc-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 3px;
}
.vc-subtitle {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
    margin-top: 6px;
    letter-spacing: 2px;
}
.vc-body {
    display: flex;
    gap: 24px;
    padding: 28px 30px;
    align-items: flex-start;
}
.vc-photo-area {
    flex-shrink: 0;
}
.vc-photo {
    width: 100px;
    height: 130px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.3);
    display: block;
}
.vc-photo-placeholder {
    width: 100px;
    height: 130px;
    border-radius: 8px;
    border: 2px dashed rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    text-align: center;
}
.vc-info {
    flex: 1;
    min-width: 0;
}
.vc-info-row, .vc-name-row {
    display: flex;
    align-items: baseline;
    margin-bottom: 10px;
}
.vc-label {
    width: 90px;
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    flex-shrink: 0;
}
.vc-value {
    font-size: 15px;
    color: #fff;
    word-break: break-all;
}
.vc-name {
    font-size: 22px;
    font-weight: 700;
}
.vc-section {
    padding: 18px 30px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.vc-section-title {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 10px;
}
.vc-station-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.vc-station-tag {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: #fff;
}
.vc-upcoming {
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 14px 16px;
}
.vc-upcoming-station {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}
.vc-upcoming-time {
    font-size: 14px;
    color: rgba(255,255,255,0.8);
}
.vc-upcoming-addr {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    margin-top: 4px;
}
.vc-empty {
    font-size: 13px;
    color: rgba(255,255,255,0.4);
}
.vc-footer {
    display: flex;
    justify-content: space-between;
    padding: 16px 30px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}
.modal-box {
    background: #fff;
    border-radius: 8px;
    max-height: 90vh;
    overflow-y: auto;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
    border-radius: 8px 8px 0 0;
}
.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #1e293b;
}
.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
}
.modal-close:hover {
    color: #1e293b;
}
.modal-body {
    padding: 20px;
}

/* ===== Volunteer Detail in Modal ===== */
.volunteer-detail {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    align-items: flex-start;
}
.volunteer-detail-photo {
    width: 80px;
    height: 100px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    flex-shrink: 0;
}
.volunteer-detail-photo-placeholder {
    width: 80px;
    height: 100px;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
    flex-shrink: 0;
    background: #f8fafc;
}
.volunteer-detail-info {
    flex: 1;
    min-width: 0;
}
.volunteer-detail-info h4 {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 6px;
}
.volunteer-detail-info .vdi-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
}
.volunteer-detail-info .vdi-summary {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}
.volunteer-detail-stats {
    margin-bottom: 16px;
    background: #f8fafc;
    border-radius: 8px;
    padding: 14px 16px;
}
.vds-title {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 10px;
}
.vds-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}
.vds-item {
    text-align: center;
    background: #fff;
    border-radius: 6px;
    padding: 10px 4px;
}
.vds-num {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}
.vds-num.vds-green { color: #16a34a; }
.vds-num.vds-orange { color: #f59e0b; }
.vds-num.vds-red { color: #dc2626; }
.vds-label {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}
.vds-wide { grid-column: span 1; }
.volunteer-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}
.volunteer-detail-grid .vdg-item {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
}
.volunteer-detail-grid .vdg-item:nth-child(2n) {
    border-right: none;
}
.volunteer-detail-grid .vdg-item:nth-last-child(-n+2) {
    border-bottom: none;
}
.volunteer-detail-grid .vdg-label {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 2px;
}
.volunteer-detail-grid .vdg-value {
    font-size: 14px;
    color: #1e293b;
    font-weight: 500;
    word-break: break-all;
}

/* ===== Mobile Card Lists (hide on desktop) ===== */
.mobile-only { display: none; }
.desktop-only { display: block; }

.mobile-card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mobile-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
}
.mobile-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.4;
}
.mobile-card-row:last-child { margin-bottom: 0; }
.mobile-card-row.wrap { flex-wrap: wrap; }
.mobile-card-title {
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
}
.mobile-card-label {
    color: #64748b;
    font-size: 12px;
    flex-shrink: 0;
}
.mobile-card-value {
    color: #1e293b;
    font-size: 13px;
    text-align: right;
    word-break: break-all;
}
.mobile-card-value.left { text-align: left; }
.mobile-card-full {
    width: 100%;
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
    margin-top: 4px;
}
.mobile-card-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}
.mobile-card-actions .btn,
.mobile-card-actions form,
.mobile-card-actions button {
    flex: 1;
    width: 100%;
}
.mobile-card-actions .btn-sm { padding: 8px 14px; font-size: 13px; }
.mobile-card-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.mobile-card-progress .progress-bar { flex: 1; height: 6px; }
.mobile-card-progress .progress-text {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
}

/* ===== Responsive ===== */

/* Tablet (<= 1024px) */
@media (max-width: 1024px) {
    .page-body { padding: 20px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row-3, .form-row-4 { grid-template-columns: 1fr 1fr; }
    .certificate { width: 100%; padding: 24px 20px; }
    .certificate-inner { padding: 30px 20px; }
}

/* Mobile (<= 768px) */
@media (max-width: 768px) {
    .mobile-only { display: block; }
    .desktop-only { display: none; }

    /* Layout */
    .sidebar {
        position: fixed;
        top: 0; bottom: 0; left: 0;
        width: 260px;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 10001;
    }
    .sidebar.sidebar-open {
        transform: translateX(0);
    }
    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 10000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .sidebar-overlay.sidebar-overlay-active {
        opacity: 1;
        pointer-events: auto;
    }
    .main-content {
        margin-left: 0;
    }

    /* Top bar */
    .top-bar { padding: 12px 16px; }
    .menu-toggle { display: flex; }
    .page-title { font-size: 17px; }

    /* Page body */
    .page-body { padding: 14px; }

    /* Stat cards - 2 columns on mobile */
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 16px;
    }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 22px; }
    .stat-label { font-size: 12px; }
    .stat-unit { font-size: 12px; }

    /* Cards */
    .card { border-radius: 6px; margin-bottom: 14px; }
    .card-header { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
    .card-header h2 { font-size: 15px; }
    .card-body { padding: 14px; }

    /* Forms */
    .form-row, .form-row-3, .form-row-4 {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .form-group { margin-bottom: 12px; }
    .form-group label { font-size: 13px; }
    .form-control { font-size: 15px; padding: 9px 12px; }
    .form-actions { flex-wrap: wrap; }

    /* Buttons */
    .btn { padding: 8px 14px; font-size: 13px; }
    .btn-sm { padding: 5px 10px; font-size: 12px; }
    .btn-lg { padding: 10px 20px; font-size: 14px; }

    /* Filter bar */
    .filter-bar {
        padding: 12px 14px;
        gap: 8px;
        flex-direction: column;
        align-items: stretch;
    }
    .filter-bar .form-group { min-width: 0 !important; width: 100%; }
    .filter-bar .d-flex { flex-direction: column; }
    .filter-bar .d-flex .form-group { width: 100%; }

    /* Tables */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table.data-table { min-width: 500px; }
    table.data-table th, table.data-table td {
        padding: 8px 10px;
        font-size: 13px;
        white-space: nowrap;
    }
    table.data-table th { font-size: 12px; }

    /* Flex utilities */
    .d-flex.gap-3 { gap: 8px; }
    .d-flex.flex-wrap { gap: 6px; }

    /* Badges */
    .badge { font-size: 11px; padding: 2px 8px; }

    /* Alerts */
    .alert { padding: 10px 14px; font-size: 13px; }

    /* Auth pages */
    .auth-card { max-width: 100%; border-radius: 8px; }
    .auth-header { padding: 20px 20px; }
    .auth-header h1 { font-size: 18px; }
    .auth-body { padding: 20px; }
    .auth-footer { padding: 12px 20px 20px; }

    /* Certificate */
    .certificate {
        width: 100%;
        min-height: auto;
        padding: 16px 12px;
    }
    .certificate-inner {
        min-height: auto;
        padding: 20px 12px;
    }
    .certificate-title { font-size: 24px; letter-spacing: 3px; }
    .certificate-subtitle { font-size: 12px; letter-spacing: 2px; margin-bottom: 20px; }
    .certificate-body { font-size: 14px; line-height: 1.8; margin-bottom: 16px; }
    .certificate-name { font-size: 18px; }
    .certificate-hours { font-size: 20px; }
    .certificate-footer { margin-top: 24px; flex-direction: column; gap: 8px; }
    .certificate-seal { width: 70px; height: 70px; font-size: 11px; }
    .certificate-photo { width: 80px; height: 110px; }

    /* Volunteer card */
    .volunteer-card { width: 100%; border-radius: 12px; }
    .vc-header { padding: 20px 20px 14px; }
    .vc-title { font-size: 18px; letter-spacing: 2px; }
    .vc-subtitle { font-size: 12px; }
    .vc-body { flex-direction: column; align-items: center; padding: 20px; gap: 16px; text-align: center; }
    .vc-section { padding: 14px 20px; }
    .vc-name { font-size: 20px; }
    .vc-footer { padding: 12px 20px; flex-direction: column; gap: 4px; text-align: center; }

    /* Modal */
    .modal-overlay { padding: 0; }
    .modal-box {
        max-width: 100% !important;
        max-height: 100vh;
        border-radius: 0;
        min-height: 100vh;
    }
    .modal-header { padding: 12px 16px; }
    .modal-header h3 { font-size: 16px; }
    .modal-body { padding: 16px; }

    /* Volunteer detail in modal */
    .volunteer-detail { flex-direction: column; align-items: center; text-align: center; gap: 12px; }
    .volunteer-detail-grid { grid-template-columns: 1fr; }
    .volunteer-detail-grid .vdg-item { border-right: none; }
    .volunteer-detail-grid .vdg-item:nth-last-child(-n+2) { border-bottom: 1px solid #f1f5f9; }
    .volunteer-detail-grid .vdg-item:last-child { border-bottom: none; }
    .vds-grid { grid-template-columns: repeat(3, 1fr); }
    .vds-num { font-size: 17px; }

    /* Progress bar */
    .progress-bar { width: 100%; }
}

/* Small mobile (<= 480px) */
@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { padding: 10px; }
    .stat-value { font-size: 18px; }
    .stat-label { font-size: 11px; }
    .vds-grid { grid-template-columns: repeat(2, 1fr); }
    .page-title { font-size: 15px; }
    .top-bar { padding: 10px 12px; }
    .page-body { padding: 10px; }
}
