/* ===================================================================
   MANGKORN SYSTEM - UNIFIED RESPONSIVE CSS
   Single source of truth for all styles
   Optimized for mobile, tablet, and desktop
   Font scale: +60% from original base sizes
   =================================================================== */

/* ===== GLOBAL RESET & BASE ===== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 26px;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== CONTAINER SYSTEM ===== */

.container,
.body-content,
#MainContent {
    width: 95%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 25px;
    background-color: transparent;
}

@media screen and (max-width: 768px) {
    .container,
    .body-content,
    #MainContent {
        width: 100%;
        padding: 18px;
    }
}

/* ===== TYPOGRAPHY ===== */

h1, h2, h3, h4, h5, h6 {
    color: #2c3e50;
    font-weight: 500;
    margin-bottom: 18px;
    line-height: 1.3;
}

h1 { font-size: 51px; }
h2 { font-size: 45px; }
h3 { font-size: 38px; }
h4 { font-size: 32px; }
h5 { font-size: 29px; }
h6 { font-size: 26px; }

@media screen and (max-width: 768px) {
    h1 { font-size: 42px; }
    h2 { font-size: 35px; }
    h3 { font-size: 32px; }
    h4 { font-size: 29px; }
    h5 { font-size: 26px; }
    h6 { font-size: 22px; }
}

/* ===== FORM ELEMENTS ===== */

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
.form-control,
.rounded-textbox {
    width: 100%;
    padding: 16px 20px;
    font-size: 26px;
    font-family: inherit;
    border: 1px solid #ccc;
    border-radius: 8px;
    background-color: #fff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    min-height: 64px;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
textarea:focus,
.form-control:focus,
.rounded-textbox:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* ===== DROPDOWN SELECT - OPTIMIZED FOR THAI TEXT ===== */

select,
select.form-control,
select[class*="form-"],
.form-control select,
asp\:DropDownList select,
select:not([multiple]):not([size]),
*[id*="DropDownList"],
*[id*="ddl"],
select[name*="ctl00"] {
    /* Size */
    width: 100% !important;
    min-height: 64px !important;
    height: auto !important;

    /* Padding */
    padding: 16px 50px 16px 20px !important;

    /* Text rendering */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    font-size: 26px !important;
    line-height: 1.8 !important;

    /* Border and background */
    border: 1px solid #ccc !important;
    border-radius: 8px !important;
    background-color: #fff !important;

    /* Dropdown arrow */
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23333" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>') !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 24px !important;

    /* Appearance */
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;

    /* Layout */
    display: block !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    vertical-align: middle !important;

    /* Transition */
    transition: border-color 0.3s ease, box-shadow 0.3s ease !important;
}

select:focus,
select.form-control:focus,
select:not([multiple]):not([size]):focus {
    border-color: #667eea !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15) !important;
}

select option,
select.form-control option {
    padding: 14px 16px !important;
    font-size: 26px !important;
    line-height: 1.6 !important;
}

/* ===== BUTTONS ===== */

button,
input[type="button"],
input[type="submit"],
input[type="reset"],
.btn,
.button {
    display: inline-block;
    padding: 16px 38px;
    font-size: 26px;
    font-family: inherit;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    background-color: #3498db;
    color: white;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    min-height: 64px;
    line-height: 1.4;
}

button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
.btn:hover,
.button:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

button:active,
input[type="button"]:active,
input[type="submit"]:active,
.btn:active {
    transform: translateY(0);
}

/* Button Variants */
.btn-primary,
.button-primary {
    background-color: #3498db;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-success,
.success-button {
    background-color: #2ecc71;
}

.btn-success:hover,
.success-button:hover {
    background-color: #27ae60;
}

.btn-danger,
.delete-button {
    background-color: #e74c3c;
}

.btn-danger:hover,
.delete-button:hover {
    background-color: #c0392b;
}

.btn-warning {
    background-color: #f39c12;
    color: #fff;
}

.btn-warning:hover {
    background-color: #e67e22;
}

.btn-info {
    background-color: #3498db;
}

.btn-info:hover {
    background-color: #2980b9;
}

@media screen and (max-width: 768px) {
    button,
    input[type="button"],
    input[type="submit"],
    .btn,
    .button {
        width: 100%;
        padding: 18px 32px;
        font-size: 26px;
        margin-bottom: 12px;
        min-height: 70px;
    }

    .btn-inline {
        width: auto;
        display: inline-block;
        margin-right: 8px;
    }
}

/* ===== TABLES ===== */

table {
    width: 100%;
    border-collapse: collapse;
    margin: 18px 0;
    background-color: #fff;
}

th, td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    font-size: 22px;
}

th {
    background-color: #2c3e50;
    color: white;
    font-weight: 500;
    font-size: 22px;
}

tr:nth-child(even) {
    background-color: #f8f9fa;
}

tr:hover {
    background-color: #f1f5fd;
}

/* GridView Specific */
.gridview,
table[id*="GridView"] {
    width: 100%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

.gridview th,
table[id*="GridView"] th {
    background-color: #2c3e50;
    color: #ffffff;
    padding: 16px 20px;
    border-bottom: 2px solid #1a252f;
    font-size: 22px;
}

.gridview td,
table[id*="GridView"] td {
    padding: 14px 20px;
    vertical-align: middle;
    font-size: 22px;
}

/* Table Responsive */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 18px;
}

@media screen and (max-width: 768px) {
    table {
        font-size: 22px;
    }

    th, td {
        padding: 13px 16px;
        font-size: 21px;
    }

    /* Keep GridView tables horizontally scrollable */
    .table-responsive,
    .gridview-wrapper {
        display: block;
        width: 100%;
        overflow-x: auto;
    }

    table.gridview,
    table[id*="GridView"] {
        min-width: 600px;
    }
}

/* ===== PANELS & CARDS ===== */

.panel,
.card {
    background-color: white;
    border-radius: 10px;
    padding: 25px;
    margin: 18px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.panel-heading,
.card-header {
    margin: -25px -25px 25px -25px;
    padding: 18px 25px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 10px 10px 0 0;
    font-size: 26px;
}

.panel-body,
.card-body {
    padding: 0;
    font-size: 26px;
}

@media screen and (max-width: 768px) {
    .panel,
    .card {
        padding: 18px;
        margin: 12px 0;
    }

    .panel-heading,
    .card-header {
        margin: -18px -18px 18px -18px;
        padding: 14px 18px;
        font-size: 24px;
    }
}

/* ===== UTILITIES ===== */

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Headers */
.header-center { text-align: center; }
.header-right { text-align: right; }

/* Spacing */
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.p-1 { padding: 10px; }
.p-2 { padding: 20px; }
.p-3 { padding: 30px; }

/* Display */
.hide-mobile { display: block; }
.show-mobile { display: none; }

@media screen and (max-width: 768px) {
    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }
}

/* ===== ALERTS ===== */

.alert {
    padding: 22px 30px;
    margin-bottom: 24px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 24px;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: #ffeeba;
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

/* ===== MODALS ===== */

.modal-dialog {
    width: 90%;
    max-width: 750px;
    margin: 30px auto;
}

@media screen and (max-width: 768px) {
    .modal-dialog {
        width: 95%;
        margin: 10px auto;
    }
}

/* ===== SPECIAL ELEMENTS ===== */

/* File Upload */
input[type="file"] {
    width: 100%;
    padding: 14px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 24px;
}

/* Checkbox & Radio */
.mycheckbox input[type="checkbox"],
.radioBL input[type="radio"] {
    margin-right: 10px;
    width: 22px;
    height: 22px;
}

input[type="checkbox"],
input[type="radio"] {
    width: 22px;
    height: 22px;
    vertical-align: middle;
}

/* Labels for checkboxes/radio */
label {
    font-size: 24px;
    vertical-align: middle;
}

/* Links */
a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
}

/* Small text */
small {
    font-size: 22px;
}

/* ===== GLOBAL OVERRIDES FOR COMMON PAGE-SPECIFIC CLASSES ===== */
/* These override inline <style> blocks across 45+ pages */

.page-title {
    font-size: 45px !important;
}

.page-subtitle {
    font-size: 24px !important;
}

.card-title,
.section-title,
.content-header {
    font-size: 32px !important;
}

.form-label {
    font-size: 22px !important;
}

.form-input,
.form-select {
    font-size: 24px !important;
    min-height: 64px !important;
    padding: 16px !important;
}

.badge {
    font-size: 21px !important;
    padding: 6px 16px !important;
}

.tab-btn,
.tab-button {
    font-size: 24px !important;
}

.gridview-pager {
    font-size: 22px !important;
}

.gridview-pager a,
.gridview-pager span {
    font-size: 22px !important;
    padding: 14px 22px !important;
    min-width: 56px !important;
    min-height: 56px !important;
}

.modal-title {
    font-size: 32px !important;
}

.modal-box {
    padding: 40px !important;
}

.modal-box label,
.modal-box .form-label {
    font-size: 22px !important;
}

.modal-box small {
    font-size: 20px !important;
}

.grid-wrap th {
    font-size: 22px !important;
    padding: 20px !important;
}

.grid-wrap td {
    font-size: 22px !important;
    padding: 18px 20px !important;
}

.grid-wrap small {
    font-size: 20px !important;
}

/* Override common inline font-size on buttons inside tables/grids */
.grid-wrap .btn,
.gridview .btn,
table .btn,
table .btn-warning,
table .btn-danger,
table .btn-success,
table .btn-info,
table .btn-primary {
    font-size: 21px !important;
    padding: 10px 20px !important;
    min-height: 48px !important;
}

/* ===== ADDITIONAL GLOBAL OVERRIDES - BOOTSTRAP & COMMON PATTERNS ===== */

/* Bootstrap form controls */
.form-control {
    font-size: 24px !important;
    min-height: 56px !important;
    padding: 12px 16px !important;
}

.form-group label,
.control-label {
    font-size: 22px !important;
}

/* Bootstrap nav tabs */
.nav-tabs > li > a,
.nav-tabs .nav-link,
.tmpl-tabs a,
.tmpl-tabs li {
    font-size: 22px !important;
    padding: 14px 20px !important;
}

/* Bootstrap alerts */
.alert {
    font-size: 24px !important;
    padding: 18px 24px !important;
}

/* Bootstrap small buttons */
.btn-sm,
.btn-xs,
.btn-small,
.button-small {
    font-size: 21px !important;
    padding: 8px 16px !important;
    min-height: 44px !important;
}

/* Bootstrap panels */
.panel-title,
.panel-heading {
    font-size: 26px !important;
}

.panel-body {
    font-size: 22px !important;
}

/* Bootstrap table overrides */
.table > thead > tr > th,
.table > tbody > tr > td,
.table > tfoot > tr > td,
.table th,
.table td {
    font-size: 22px !important;
    padding: 14px 16px !important;
}

.table .btn,
.table .btn-sm,
.table .btn-xs {
    font-size: 21px !important;
}

/* Bootstrap modals */
.modal-title {
    font-size: 32px !important;
}

.modal-body {
    font-size: 22px !important;
}

.modal-body label {
    font-size: 22px !important;
}

.modal-body .form-control {
    font-size: 24px !important;
}

/* Stat / KPI cards used across pages */
.stat-label,
.stat-value,
.stat-number,
.kpi-label,
.kpi-value,
.mini-stat-label {
    font-size: 22px !important;
}

/* Filter controls on dashboards */
.filter-label,
.filter-dropdown,
.filter-select {
    font-size: 22px !important;
}

/* Status badges and tags */
.status-badge,
.status-label,
.relation-tag,
.contact-badge,
.date-badge,
.customer-type-badge {
    font-size: 21px !important;
}

/* Info rows (Supplier, Quotation, etc.) */
.info-label,
.info-value,
.info-row,
.contact-details,
.contact-title,
.contact-info {
    font-size: 22px !important;
}

/* Autocomplete dropdown items */
.autocomplete-item,
.autocomplete-items div {
    font-size: 24px !important;
    padding: 14px 16px !important;
    min-height: 56px !important;
}

/* Page header / subtitle patterns */
.page-header,
.page-header h2 {
    font-size: 38px !important;
}

.page-header small,
.section-subtitle {
    font-size: 22px !important;
}

/* Timeline elements (AssetBorrow, etc.) */
.timeline-body,
.timeline-date,
.timeline-item {
    font-size: 22px !important;
}

/* Cost/Progress overlays */
.cost-percentage,
.progress-bar-text {
    font-size: 18px !important;
}

/* Score/Rating/Comment elements (Evaluation) */
.score-label,
.comment-header,
.rating-label,
.assignment-info {
    font-size: 22px !important;
}

.rating-option label {
    font-size: 21px !important;
}

/* Document/PO elements (Procurement) */
.doc-list,
.po-meta,
.qty-badge {
    font-size: 22px !important;
}

/* Grid/Detail views (Template, Procurement User) */
.gen-grid td,
.detail-grid td,
.link-grid td,
.user-grid td,
.gen-grid th,
.detail-grid th,
.link-grid th,
.user-grid th {
    font-size: 22px !important;
}

/* Tree items (Template Management) */
.tree-sub-item,
.tree-detail-link-item {
    font-size: 22px !important;
}

/* Back/navigation links */
.back-link {
    font-size: 22px !important;
}

/* Generated password label */
.generated-pw-label {
    font-size: 22px !important;
}

/* Calendar elements */
.day-events,
.event-item {
    font-size: 22px !important;
}

.legend-item {
    font-size: 21px !important;
}

/* Leave/HR elements */
.leave-type-name,
.leave-status {
    font-size: 22px !important;
}

/* Work description / section text */
.work-description,
.section-text {
    font-size: 22px !important;
}

/* Reminder table */
.reminder-table td,
.reminder-table th {
    font-size: 22px !important;
}

/* Period dates (EvaluationConfig) */
.period-dates {
    font-size: 22px !important;
}

/* Button action (ProcurementUserManagement) */
.btn-action {
    font-size: 21px !important;
}

/* Update card elements */
.update-card-time {
    font-size: 22px !important;
}

/* Project header meta */
.project-header-meta {
    font-size: 22px !important;
}

/* No data/empty messages */
.no-person,
.no-data,
.empty-message {
    font-size: 22px !important;
}

/* Edit inputs inline */
.edit-input {
    font-size: 22px !important;
    min-height: 48px !important;
}

/* Supplier tax info */
.supplier-tax {
    font-size: 22px !important;
}

/* Badge links */
.badge-link {
    font-size: 21px !important;
}

/* Password instruction/requirements */
.password-instruction,
.password-requirements {
    font-size: 22px !important;
}

/* Separator text (Login) */
.separator-text {
    font-size: 22px !important;
}

/* Generic small text override */
small,
.small,
.text-muted,
.text-small,
.help-block {
    font-size: 21px !important;
}

/* Ensure all span/div/p inside common containers have minimum font size */
.card-body,
.panel-body,
.well,
.jumbotron {
    font-size: 22px !important;
}

.card-body p,
.panel-body p,
.card-body span,
.panel-body span {
    font-size: 22px !important;
}

/* ===== LEGACY AUTO-STYLES (Keep for compatibility) ===== */

.auto-style1 { height: 33px; }
.auto-style2 { text-align: left; height: 33px; }
.auto-style3 { text-align: left; height: 20px; width: 35%; }
.auto-style4 { text-align: left; height: 33px; }
.auto-style5 { text-align: left; }
.auto-style6 { height: 20px; width: 15%; }
.auto-style7 { height: 33px; width: 15%; }
.auto-style9 { height: 30px; }
.auto-style10 { text-align: left; width: 35%; height: 30px; }
.auto-style11 { width: 15%; height: 30px; }
.auto-style12 { text-align: left; height: 30px; }
.auto-style13 { color: #e74c3c; font-weight: bold; }
.auto-style14 { text-align: left; width: 35%; height: 33px; }
.auto-style15 { height: 76px; }
.auto-style16 { text-align: left; width: 35%; height: 76px; }
.auto-style17 { width: 15%; height: 76px; }
.auto-style18 { text-align: left; height: 33px; color: #FF0000; font-size: medium; }

/* ===== PRINT STYLES ===== */

@media print {
    .no-print { display: none !important; }
    body { font-size: 14pt; color: #000; background: #fff; }
    a { text-decoration: underline; }
    table { page-break-inside: auto; }
    tr { page-break-inside: avoid; page-break-after: auto; }
}

/* ===== GLOBAL AUTOCOMPLETE - MOBILE FRIENDLY ===== */

.autocomplete {
    position: relative;
    display: inline-block;
    width: 100%;
}

.autocomplete-items {
    position: absolute;
    border: 2px solid #667eea;
    border-top: none;
    z-index: 9999;
    top: 100%;
    left: 0;
    right: 0;
    background-color: white;
    max-height: 50vh;
    min-height: 100px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    overscroll-behavior: contain;
    /* Enable touch scrolling on mobile */
    touch-action: pan-y;
}

.autocomplete-items .autocomplete-item {
    padding: 18px 22px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 24px;
    line-height: 1.4;
    min-height: 64px;
    display: flex;
    align-items: center;
    transition: background-color 0.15s ease;
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
    /* Allow scrolling on touch */
    touch-action: pan-y;
}

/* Touch feedback */
.autocomplete-items .autocomplete-item.touching {
    background-color: #f0f4ff;
}

.autocomplete-items .autocomplete-item:last-child {
    border-bottom: none;
    border-radius: 0 0 10px 10px;
}

.autocomplete-items .autocomplete-item:hover,
.autocomplete-items .autocomplete-item:active {
    background-color: #f0f4ff;
}

.autocomplete-items .autocomplete-item strong {
    color: #667eea;
    font-weight: 700;
}

.autocomplete-active {
    background-color: #667eea !important;
    color: white;
}

.autocomplete-active strong {
    color: white !important;
}

.autocomplete-no-result {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
    font-size: 24px;
}

/* Autocomplete scrollbar - Desktop */
.autocomplete-items::-webkit-scrollbar {
    width: 14px;
}

.autocomplete-items::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 7px;
}

.autocomplete-items::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea 0%, #5a6fd6 100%);
    border-radius: 7px;
    border: 2px solid #f1f1f1;
}

.autocomplete-items::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #5a6fd6 0%, #4a5fc6 100%);
}

/* ===== MOBILE TOUCH SCROLL ZONE ===== */

/* Visible scroll zone on right side - for touch scrolling */
.autocomplete-scroll-zone {
    display: none;
}

/* ===== MOBILE TOUCH ENHANCEMENTS ===== */

@media screen and (max-width: 768px) {
    /* Show scroll zone on mobile */
    .autocomplete-scroll-zone {
        display: block;
        position: sticky;
        top: 0;
        right: 0;
        width: 100%;
        height: 0;
        pointer-events: none;
    }

    /* Add hint text at top when scrollable */
    .autocomplete-items::before {
        content: '↓ ปัดลงเพื่อดูเพิ่ม';
        display: block;
        position: sticky;
        top: 0;
        background: linear-gradient(180deg, #667eea 0%, #5a6fd6 100%);
        color: white;
        text-align: center;
        font-size: 19px;
        padding: 8px;
        z-index: 10;
        border-radius: 8px 8px 0 0;
        margin: 0 0 4px 0;
    }

    /* Larger touch targets */
    .autocomplete-items .autocomplete-item {
        padding: 22px 50px 22px 22px; /* More padding on right for scroll area */
        font-size: 26px;
        min-height: 70px;
        position: relative;
    }

    /* Add touch scroll indicator on right */
    .autocomplete-items .autocomplete-item::after {
        content: '≡';
        position: absolute;
        right: 14px;
        top: 50%;
        transform: translateY(-50%);
        color: #ccc;
        font-size: 28px;
        font-weight: bold;
        pointer-events: none;
    }

    .autocomplete-items {
        max-height: 45vh;
        padding-right: 0;
    }

    /* WIDER SCROLLBAR FOR MOBILE TOUCH */
    .autocomplete-items::-webkit-scrollbar {
        width: 36px !important;
    }

    .autocomplete-items::-webkit-scrollbar-track {
        background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 100%);
        border-radius: 18px;
        margin: 4px 0;
        border: 2px solid #fff;
    }

    .autocomplete-items::-webkit-scrollbar-thumb {
        background: linear-gradient(180deg, #667eea 0%, #5a6fd6 100%);
        border-radius: 18px;
        border: 6px solid #e8e8e8;
        min-height: 90px;
        box-shadow: inset 0 0 6px rgba(255,255,255,0.5);
    }

    .autocomplete-items::-webkit-scrollbar-thumb:active {
        background: linear-gradient(180deg, #5a6fd6 0%, #4a5fc6 100%);
        border-color: #d0d0d0;
    }

    /* Touch feedback improvement */
    .autocomplete-items .autocomplete-item.touching {
        background-color: #e8f0ff !important;
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    /* Better select dropdowns on mobile */
    select,
    select.form-control {
        font-size: 26px !important; /* Prevents iOS zoom */
        min-height: 64px !important;
    }

    /* Touch-friendly input fields */
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="tel"],
    input[type="date"],
    input[type="time"],
    input[type="search"],
    textarea {
        font-size: 26px !important; /* Prevents iOS zoom */
        min-height: 64px;
    }

    /* Better tap feedback */
    button,
    input[type="submit"],
    input[type="button"],
    .btn,
    a.btn {
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.3);
    }

    /* Prevent text selection on touch */
    .no-select {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }

    /* Modal/popup improvements for mobile */
    .modal-dialog,
    .popup-content {
        margin: 10px;
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Fixed header support */
    .sticky-header {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: white;
    }

    /* Pull-to-refresh prevention for custom scrollers */
    .custom-scroll {
        overscroll-behavior: contain;
    }

    /* Mobile global class overrides */
    .page-title {
        font-size: 35px !important;
    }

    .page-subtitle {
        font-size: 20px !important;
    }

    .card-title,
    .section-title {
        font-size: 28px !important;
    }

    .form-label {
        font-size: 20px !important;
    }

    .badge {
        font-size: 19px !important;
    }

    .grid-wrap .btn,
    .gridview .btn,
    table .btn {
        font-size: 19px !important;
        padding: 8px 16px !important;
        min-height: 44px !important;
    }

    /* Mobile overrides for additional classes */
    .form-control {
        font-size: 22px !important;
        min-height: 50px !important;
    }

    .nav-tabs > li > a,
    .nav-tabs .nav-link,
    .tmpl-tabs a {
        font-size: 20px !important;
        padding: 10px 14px !important;
    }

    .alert {
        font-size: 21px !important;
    }

    .stat-label,
    .stat-value,
    .kpi-label,
    .kpi-value,
    .filter-label,
    .info-label,
    .info-value,
    .contact-details,
    .contact-title {
        font-size: 20px !important;
    }

    .status-badge,
    .relation-tag,
    .contact-badge,
    .date-badge {
        font-size: 19px !important;
    }

    .table > thead > tr > th,
    .table > tbody > tr > td,
    .table th,
    .table td {
        font-size: 20px !important;
        padding: 10px 12px !important;
    }

    .autocomplete-item,
    .autocomplete-items div {
        font-size: 22px !important;
        min-height: 50px !important;
    }

    .timeline-body,
    .timeline-date {
        font-size: 20px !important;
    }

    .tree-sub-item,
    .tree-detail-link-item,
    .gen-grid td,
    .detail-grid td,
    .user-grid td {
        font-size: 20px !important;
    }

    .btn-sm,
    .btn-xs,
    .btn-small,
    .btn-action {
        font-size: 19px !important;
        min-height: 40px !important;
    }

    .modal-body {
        font-size: 20px !important;
    }

    small,
    .small,
    .text-muted,
    .help-block {
        font-size: 19px !important;
    }
}

/* ===== iOS SPECIFIC FIXES ===== */

@supports (-webkit-touch-callout: none) {
    /* iOS only */
    select,
    input,
    textarea {
        font-size: 26px !important;
    }

    /* Fix for iOS elastic scrolling in autocomplete */
    .autocomplete-items {
        -webkit-overflow-scrolling: touch;
        overflow-y: scroll;
    }

    /* Better appearance on iOS */
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"] {
        -webkit-appearance: none;
        appearance: none;
    }
}

/* ===== ACCESSIBILITY ===== */

*:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Skip link for keyboard navigation */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #667eea;
    color: white;
    padding: 10px;
    z-index: 10000;
    font-size: 24px;
}

.skip-link:focus {
    top: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .autocomplete-items {
        border-width: 3px;
    }

    .autocomplete-active {
        outline: 3px solid white;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
