/* ── Local Google Fonts Staging (Inter, Noto Sans Sinhala, Outfit, Cinzel) ── */

/* Cinzel */
@font-face {
    font-family: 'Cinzel';
    src: url("../fonts/Cinzel-Variable.1508f55ab758.ttf") format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* Inter */
@font-face {
    font-family: 'Inter';
    src: url("../fonts/Inter-Regular.46a1550a4bba.woff2") format('woff2'),
         url("../fonts/Inter-Regular.fdb50e0d48cd.ttf") format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url("../fonts/Inter-Medium.60824932303e.woff2") format('woff2'),
         url("../fonts/Inter-Medium.a473e623af12.ttf") format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url("../fonts/Inter-SemiBold.01fdc3828f4e.woff2") format('woff2'),
         url("../fonts/Inter-SemiBold.4d24f378e7f8.ttf") format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url("../fonts/Inter-Bold.279e5a640385.woff2") format('woff2'),
         url("../fonts/Inter-Bold.8f2869a84ad7.ttf") format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* Noto Sans Sinhala */
@font-face {
    font-family: 'Noto Sans Sinhala';
    src: url("../fonts/NotoSansSinhala-Regular.b21333ab7240.ttf") format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Noto Sans Sinhala';
    src: url("../fonts/NotoSansSinhala-Medium.bc171727be74.ttf") format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Noto Sans Sinhala';
    src: url("../fonts/NotoSansSinhala-SemiBold.b453842d6701.ttf") format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Noto Sans Sinhala';
    src: url("../fonts/NotoSansSinhala-Bold.15b7373cb0f1.ttf") format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* Outfit */
@font-face {
    font-family: 'Outfit';
    src: url("../fonts/Outfit-Variable.e31a3aa5fce3.ttf") format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Outfit';
    src: url("../fonts/Outfit-Light.dadf500df5f0.ttf") format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Outfit';
    src: url("../fonts/Outfit-Regular.7f58c2ecd9ff.ttf") format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Outfit';
    src: url("../fonts/Outfit-Medium.30f6f007007e.ttf") format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Outfit';
    src: url("../fonts/Outfit-SemiBold.d55f5efbe847.ttf") format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Outfit';
    src: url("../fonts/Outfit-Bold.a2859253181a.ttf") format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ── Sinhala Fonts (UN Unicode Fonts) ── */

@font-face {
    font-family: 'UN-Abhaya';
    src: url("../fonts/UN-Abhaya-6-110-kern.42e088827019.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Abhaya';
    src: url("../fonts/UN-Abhaya-bold-2019-4-110.8a49967859fb.ttf") format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Alakamanda';
    src: url("../fonts/UN-Alakamanda-4-95.f5540f280e38.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Arundathee';
    src: url("../fonts/UN-Arundathee.b2d8a0b1884c.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Basuru';
    src: url("../fonts/UN-Basuru.e1498b7ed211.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Bindumathi';
    src: url("../fonts/UN-Bindumathi.5e86ef3c3109.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Davasa';
    src: url("../fonts/UN-Davasa.b6f400da474c.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Derana';
    src: url("../fonts/UN-Derana.3c1038c49b30.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Dharanee';
    src: url("../fonts/UN-Dharanee.345d3abdc8da.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Disapamok';
    src: url("../fonts/UN-Disapamok.9f4f02c0e443.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Ganganee';
    src: url("../fonts/UN-Ganganee.26d63824919b.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Gemunu';
    src: url("../fonts/UN-Gemunu.18768ca0cdc3.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Gurulugomi';
    src: url("../fonts/UN-Gurulugomi.8585c51f2431.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Imanee';
    src: url("../fonts/UN-Imanee.6a4ad82fa404.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Indeewaree';
    src: url("../fonts/UN-Indeewaree.9903f64a0a8d.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Isiwara';
    src: url("../fonts/UN-Isiwara.1b956a06b19b.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Malithi';
    src: url("../fonts/UN-Malithi-4.7d44475ea469.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Rajantha';
    src: url("../fonts/UN-Rajantha.39fa390555aa.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Rashmi';
    src: url("../fonts/UN-Rashmi.7aa8c3c3f917.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Samantha';
    src: url("../fonts/UN-Samantha.e054f14e3fd5.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'UN-Sandhyanee';
    src: url("../fonts/UN-Sandhyanee.01c9b89c39f9.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Primary Sinhala font stack — Noto Sans Sinhala is the primary Unicode Sinhala font */
:root {
    --sinhala-font: 'Noto Sans Sinhala', 'UN-Abhaya', 'UN-Alakamanda', 'UN-Isiwara', 'UN-Arundathee',
                    'Iskoola Pota', sans-serif;
}

/* Apply Sinhala font to all text inputs and textareas so Sinhala characters
   typed via Helakuru or any other IME render correctly */
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="date"]):not([type="number"]):not([type="email"]),
textarea {
    font-family: var(--sinhala-font);
}

/* Helper class for inline Sinhala text in labels / spans */
.sinhala-text {
    font-family: var(--sinhala-font);
}

/* ── Login Gate ── */
#login-gate {
    position: fixed;
    inset: 0;
    background: linear-gradient(160deg, #3a0000 0%, #6b0000 50%, #8b0000 100%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
#login-gate.hide {
    opacity: 0;
    visibility: hidden;
}
.lg-box {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 40px 44px;
    width: 100%;
    max-width: 400px;
    backdrop-filter: blur(12px);
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
    animation: lgBoxIn 0.6s cubic-bezier(.22,1,.36,1) both;
}
@keyframes lgBoxIn {
    from { opacity:0; transform:translateY(24px) scale(0.97); }
    to   { opacity:1; transform:translateY(0) scale(1); }
}
.lg-logo-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}
.lg-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
    flex-shrink: 0;
}
.lg-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}
.lg-subtitle {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
    letter-spacing: 0.5px;
}
.lg-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin-bottom: 20px;
}
.lg-hint {
    margin: 0 0 18px;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.45);
    text-align: center;
    letter-spacing: 0.3px;
}
.lg-error {
    background: rgba(255,80,80,0.12);
    border: 1px solid rgba(255,100,100,0.3);
    border-radius: 8px;
    color: #ff9999;
    font-size: 0.82rem;
    padding: 9px 14px;
    margin-bottom: 16px;
    text-align: center;
}
.lg-field {
    margin-bottom: 14px;
}
.lg-field label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
}
.lg-field input {
    width: 100%;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 9px;
    padding: 11px 14px;
    font-size: 0.93rem;
    color: #fff;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    box-sizing: border-box;
}
.lg-field input::placeholder { color: rgba(255,255,255,0.25); }
.lg-field input:focus {
    border-color: rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.1);
}
#lg-btn {
    width: 100%;
    margin-top: 22px;
    padding: 12px;
    background: #fff;
    color: #8b0000;
    font-size: 0.95rem;
    font-weight: 700;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: background 0.2s, transform 0.1s;
}
#lg-btn:hover  { background: #f0e0e0; }
#lg-btn:active { transform: scale(0.98); }
#lg-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Loading Screen ── */

body, html {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f4f9;
}

/* Loading Screen Styles */
#loading-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(160deg, #5a0000 0%, #8b0000 45%, #6b0000 100%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.6s cubic-bezier(.4,0,.2,1), visibility 0.6s;
    overflow: hidden;
}

#loading-screen::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    pointer-events: none;
}

#loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* Hide loading screen immediately if already visited */
html.visited #loading-screen {
    display: none !important;
}

html.visited #main-content {
    display: block;
}

/* Logo pulse ring */
.loader-logo-wrap {
    position: relative;
    width: 110px;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32px;
}

.loader-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.15);
    animation: ringPulse 2s ease-in-out infinite;
}

.loader-ring:nth-child(2) {
    inset: -14px;
    border-color: rgba(255,255,255,0.07);
    animation-delay: 0.4s;
}

.loader-ring:nth-child(3) {
    inset: -28px;
    border-color: rgba(255,255,255,0.04);
    animation-delay: 0.8s;
}

@keyframes ringPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.06); opacity: 0.5; }
}

.loader-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 4px 24px rgba(0,0,0,0.5));
    animation: logoFadeIn 0.8s ease both;
}

@keyframes logoFadeIn {
    from { opacity: 0; transform: scale(0.85) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Ministry name */
.loader-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.6px;
    margin: 0 0 4px;
    text-align: center;
    animation: logoFadeIn 0.9s 0.2s ease both;
}

.loader-subtitle {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
    letter-spacing: 1.2px;
    text-transform: uppercase;
    text-align: center;
    margin: 0 0 48px;
    animation: logoFadeIn 0.9s 0.35s ease both;
}

/* Progress bar */
.loader-bar-track {
    width: 260px;
    height: 3px;
    background: rgba(255,255,255,0.12);
    border-radius: 2px;
    overflow: hidden;
    animation: logoFadeIn 0.8s 0.5s ease both;
}

.loader-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0.3), #fff, rgba(255,255,255,0.3));
    background-size: 200% 100%;
    border-radius: 2px;
    animation: shimmer 1.6s infinite linear, barGrow 1.8s 0.5s ease forwards;
    width: 0%;
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

@keyframes barGrow {
    0%   { width: 0%; }
    60%  { width: 70%; }
    85%  { width: 88%; }
    100% { width: 100%; }
}

.loader-status {
    margin-top: 16px;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.4);
    letter-spacing: 1px;
    text-transform: uppercase;
    animation: logoFadeIn 0.8s 0.6s ease both;
}


/* Main Content Styles - Professional Dashboard */
#main-content {
    display: none; /* Hidden until loaded */
    color: #333;
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: #8b0000;
    color: #ffffff;
    padding: 12px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    filter: drop-shadow(0px 2px 4px rgba(0,0,0,0.2));
}

a.nav-brand {
    color: #fff;
    text-decoration: none;
    transition: opacity 0.2s;
}

a.nav-brand:hover {
    opacity: 0.9;
    transform: none;
    color: #fff;
}

.nav-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-links > a {
    color: #f4f4f9;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s, transform 0.2s;
}

.nav-links > a:hover {
    color: #ffffff;
    transform: scale(1.05);
}

.btn-logout {
    background-color: rgba(255,255,255,0.15);
    padding: 8px 18px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.3);
}

.btn-logout:hover {
    background-color: rgba(255,255,255,0.25);
}

/* Dashboard Layout */
.dashboard-container {
    padding: 50px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-header {
    margin-bottom: 45px;
}

.dashboard-header h1 {
    color: #2c3e50;
    margin: 0 0 8px 0;
    font-size: 2.4rem;
    font-weight: 700;
}

.dashboard-header p {
    color: #7f8c8d;
    font-size: 1.15rem;
    margin: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.stat-card {
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
    border-left: 6px solid #8b0000;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

.stat-card h3 {
    margin: 0 0 10px 0;
    color: #95a5a6;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 2.8rem;
    font-weight: 800;
    color: #2c3e50;
}

/* Actions */
.recent-activity h2 {
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 1.6rem;
}

.action-buttons {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: #8b0000;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #6a0000;
    box-shadow: 0 6px 15px rgba(106,0,0,0.2);
}

.btn-secondary {
    background-color: #ffffff;
    color: #2c3e50;
    border: 1px solid #dcdde1;
}

.btn-secondary:hover {
    background-color: #f5f6fa;
    border-color: #b2bec3;
}

/* Form Styles */
.form-card {
    padding: 35px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.form-section {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    background: #fff;
}

.form-section legend {
    font-size: 1.2rem;
    font-weight: 600;
    color: #8b0000;
    padding: 0 10px;
    background: #fff;
}

.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 250px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: #8b0000;
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.1);
}

.form-control.is-invalid {
    border-color: #e74c3c;
    background-color: #fdf0ed;
}

/* Autocomplete */
.autocomplete-container {
    position: relative;
}

.suggestions-box {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ced4da;
    border-top: none;
    border-radius: 0 0 4px 4px;
    z-index: 1000;
    max-height: 240px;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: none;
    scroll-behavior: smooth;
}
.suggestions-box::-webkit-scrollbar { width: 5px; }
.suggestions-box::-webkit-scrollbar-track { background: #f8f8f8; }
.suggestions-box::-webkit-scrollbar-thumb { background: #ced4da; border-radius: 4px; }
.suggestions-box::-webkit-scrollbar-thumb:hover { background: #8b0000; }

.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f1f2f6;
    text-align: left;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: #f8f9fa;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
}

.verification-summary p {
    margin: 8px 0;
    padding-bottom: 8px;
    border-bottom: 1px dashed #eee;
}

.verification-summary strong {
    display: inline-block;
    width: 150px;
    color: #2c3e50;
}

/* Add Center Panel Animation */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

#add-center-block > div {
    animation: slideDown 0.25s ease forwards;
}

/* ── Responsive / Mobile ───────────────────────────────────────── */

/* Scrollable table wrapper */
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Touch-friendly tap targets */
@media (max-width: 900px) {
    .btn, .btn-primary, .btn-secondary, .btn-sm, .btn-refresh {
        min-height: 40px;
    }
    /* Modals: full-width on mobile */
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 16px 16px 0 0 !important;
        margin: auto 0 0 !important;
        max-height: 92vh !important;
    }
    .modal-overlay { align-items: flex-end !important; }
    /* Form rows stack vertically */
    .form-row { flex-direction: column !important; gap: 0 !important; }
    .form-row .form-group { min-width: 0 !important; }
    /* Dashboard container padding */
    .dashboard-container { padding: 20px 14px !important; }
    /* Stats grid single column */
    .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 14px !important; }
}

@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr !important; }
    .modal-content { border-radius: 0 !important; max-height: 100vh !important; }
    .modal-overlay { align-items: stretch !important; }
    .form-control, select.form-control, input.form-control {
        font-size: 16px !important; /* prevent iOS auto-zoom */
    }
}

#center-search:focus {
    border-color: #8b0000 !important;
    box-shadow: 0 0 0 3px rgba(139,0,0,0.12) !important;
}