:root {
    --primary: #1e3a8a; --secondary: #6f42c1; --success: #10b981; 
    --accent: #f97316; --danger: #ef4444; --bg-main: #f8fafc; 
    --surface: #ffffff; --text-main: #0f172a; --text-muted: #64748b;
    --radius-lg: 16px; --radius-md: 10px;
    --shadow-sm: 0 4px 6px -1px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.05);
}

/* बॉक्स-साइजिंग और ओवरफ्लो को फिक्स किया गया है ताकि कंटेंट बाहर न जाए */
*, *::before, *::after {
    box-sizing: border-box;
}

body { 
    font-family: 'Segoe UI', system-ui, sans-serif; 
    background-color: var(--bg-main); 
    margin: 0; 
    padding: 24px; 
    color: var(--text-main); 
    overflow-x: hidden; /* पेज को दाएं-बाएं (Horizontal) खिसकने से रोकेगा */
}

input, textarea, select { 
    width: 100%; 
    padding: 14px 16px; 
    margin-bottom: 16px; 
    border: 1px solid #e2e8f0; 
    border-radius: var(--radius-md); 
    font-size: 15px; 
    background: #fff; 
}
input:focus { 
    border-color: var(--primary); 
    outline: none; 
    box-shadow: 0 0 0 3px rgba(30,58,138,0.1); 
}

.btn { 
    padding: 12px 24px; 
    border: none; 
    border-radius: var(--radius-md); 
    font-weight: 600; 
    font-size: 14px; 
    color: #fff; 
    cursor: pointer; 
    transition: 0.2s; 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    text-align: center; 
    line-height: 1.2; 
}

.btn-pos { 
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%); 
    width: 100%; 
    padding: 16px; 
    border-radius: var(--radius-md); 
    color: #fff; 
    font-weight: 700; 
    font-size: 16px; 
    cursor: pointer; 
    text-align: center; 
    line-height: 1.3; 
}

/* नेविगेशन बार और टॉप बार को रिस्पॉन्सिव बनाया गया है */
.top-bar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-wrap: wrap; /* छोटी स्क्रीन पर चीजें नीचे आ जाएंगी */
    gap: 15px;
    margin-bottom: 24px; 
    background: #fff; 
    padding: 18px 24px; 
    border-radius: var(--radius-lg); 
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); 
}

.nav { 
    display: flex; 
    gap: 8px; 
    overflow-x: auto; 
    padding-bottom: 12px; 
    margin-bottom: 24px; 
    scrollbar-width: thin; /* स्मूथ स्क्रॉलिंग के लिए */
    width: 100%;
}
.nav::-webkit-scrollbar { 
    height: 6px; 
}
.nav::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.nav button { 
    flex-shrink: 0; 
    padding: 10px 16px; 
    border: none; 
    border-radius: var(--radius-md); 
    font-weight: 600; 
    color: #fff; 
    cursor: pointer; 
    line-height: 1.3; 
    text-align: center; 
}

/* टेबल को बाहर निकलने से रोकने के लिए स्क्रॉल-कंटेनर ऐड किया गया */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 16px; 
    min-width: 600px; /* मोबाइल पर टेबल सिकुड़ेगी नहीं, बल्कि स्क्रॉल होगी */
}
th, td { 
    padding: 16px; 
    border-bottom: 1px solid #f1f5f9; 
    text-align: left; 
    font-size: 14px; 
}
th { 
    background: #f8fafc; 
    color: var(--text-muted); 
    font-size: 12px; 
    text-transform: uppercase; 
}

.sec { 
    background: #fff; 
    padding: 30px; 
    border-radius: var(--radius-lg); 
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.05); 
    display: none; 
    width: 100%;
}
.sec.act { 
    display: block; 
}

.grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); 
    gap: 24px; 
    width: 100%;
}
.stat-card { 
    padding: 24px; 
    border-radius: var(--radius-lg); 
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); 
}
.dm-pink-btn { 
    background: #e84393; 
    color: white; 
    padding: 10px 24px; 
    border-radius: 25px; 
    text-decoration: none; 
    font-weight: bold; 
    font-size: 15px; 
    display: inline-block; 
    transition: 0.3s; 
    box-shadow: 0 4px 10px rgba(232,67,147,0.3); 
}
.dm-pink-btn:hover { 
    background: #fd79a8; 
    transform: scale(1.05); 
}

.review-scroll { 
    display: flex; 
    gap: 15px; 
    overflow-x: auto; 
    padding: 10px 0; 
    scrollbar-width: thin; 
}
.review-scroll::-webkit-scrollbar { height: 6px; }
.review-card { 
    background: #fff; 
    padding: 15px; 
    border-radius: 12px; 
    min-width: 250px; 
    border: 1px solid #eee; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.03); 
}
.review-card p { font-size: 13px; font-style: italic; margin-bottom: 5px; color:#555; }
.review-card b { font-size: 14px; color: var(--primary); }

.mod { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.6); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    z-index: 9999; 
    padding: 15px; /* मोबाइल पर पॉप-अप स्क्रीन से बाहर न जाए */
}
.mod-c { 
    background: #fff; 
    padding: 30px; 
    border-radius: 16px; 
    width: 100%; 
    max-width: 450px; 
    max-height: 90vh; /* पॉप-अप बहुत लंबा होने पर स्क्रॉल हो जाएगा */
    overflow-y: auto; 
}

.ai-box { 
    background: #fff9e6; 
    border: 2px dashed #f39c12; 
    padding: 15px; 
    border-radius: 10px; 
    margin-top: 20px; 
}

.pos-container { 
    display: flex; 
    gap: 24px; 
    align-items: flex-start; 
    flex-wrap: wrap; /* स्क्रीन छोटी होने पर राइट वाला हिस्सा नीचे आ जाएगा */
}
.pos-left { 
    flex: 1 1 65%; /* नया फ्लेक्स अलाइनमेंट */
    background: #fff; 
    padding: 24px; 
    border-radius: var(--radius-lg); 
    border: 1px solid #e2e8f0; 
    min-width: 300px;
}
.pos-right { 
    flex: 1 1 30%; /* नया फ्लेक्स अलाइनमेंट */
    background: #fff; 
    padding: 24px; 
    border-radius: var(--radius-lg); 
    border: 1px solid #e2e8f0; 
    position: sticky; 
    top: 24px; 
    min-width: 300px;
}
.pos-dark-tot { 
    background: var(--text-main); 
    color: #ffffff; 
    padding: 20px 24px; 
    border-bottom-left-radius: var(--radius-md); 
    border-bottom-right-radius: var(--radius-md); 
    margin-top: -1px; 
}

.sugg { 
    background: var(--surface); 
    border: 1px solid #e2e8f0; 
    max-height: 180px; 
    overflow-y: auto; 
    display: none; 
    position: absolute; 
    z-index: 100; 
    width: 100%; 
    border-radius: var(--radius-md); 
    box-shadow: var(--shadow-md); 
}
.lang-sub { 
    display: block; 
    font-size: 11px; 
    opacity: 0.8; 
    font-weight: normal; 
    margin-top: 2px; 
}

/* मोबाइल और टैबलेट के लिए सटीक मीडिया क्वेरी */
@media(max-width: 768px) { 
    .grid { grid-template-columns: repeat(2, 1fr); } 
    .top-bar { flex-direction: column; align-items: stretch; gap: 10px; } 
    .pos-container { flex-direction: column; } 
    .pos-left, .pos-right { width: 100%; flex: 1 1 100%; } 
    .pos-right { position: static; } /* मोबाइल पर स्टिकी हटा दिया ताकि फँसे नहीं */
    .sec { padding: 15px; } /* मोबाइल पर गैप कम किया गया */
}

@media(max-width: 480px) {
    .grid { grid-template-columns: 1fr; } /* बहुत छोटी स्क्रीन पर सिंगल कॉलम */
    body { padding: 10px; }
}

@media print { 
    body * { visibility: hidden; } 
    #invM, #invM * { visibility: visible; } 
    #invM { position: absolute; left: 0; top: 0; width: 100%; display: block !important; } 
    .mod-c { width: 80mm !important; margin: 0; padding: 4mm; box-shadow: none; border-radius: 0; font-family: monospace; color: #000; } 
    .mod-c h2 { font-size: 18px !important; border-bottom: 1px dashed #000; padding-bottom: 6px; } 
    .mod-c #i-dtl { font-size: 11px !important; } 
    .mod-c .btn, #upi-qr, .mod-c p { display: none !important; } 
}