/* ==========================================================================
   PRODUCT QUALITY CONTROL SYSTEM - PREMIUM CSS STYLESHEET
   ========================================================================== */

/* Import Google Fonts for modern look (Outfit for English/Numbers, Sarabun for Thai) */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette */
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --primary-bg: #eff6ff;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    
    --bg-app: #f1f5f9;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --text-main: #1e293b;
    --text-sub: #64748b;
    --text-light: #94a3b8;
    
    /* Status Colors */
    --status-pass: #10b981;
    --status-pass-bg: #e6f8f2;
    --status-reject: #ef4444;
    --status-reject-bg: #fee2e2;
    --status-void: #64748b;
    --status-void-bg: #f1f5f9;
    
    /* Layout Sizes */
    --sidebar-width: 220px;
    --header-height: 56px;
    
    /* Effects */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.03);
    --shadow-inset: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', 'Sarabun', sans-serif;
}

html, body {
    background-color: var(--bg-app);
    color: var(--text-main);
    overflow-x: hidden !important;
    font-size: 12px;
    line-height: 1.35;
}


input, select, textarea, button {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* App Shell Layout */
#app-container {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden !important;
    position: relative;
    width: 100%;
}


/* Sidebar Styling */
#sidebar {
    width: var(--sidebar-width);
    background-color: #1a0f26;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
}

.sidebar-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #c084fc, #818cf8);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(129, 140, 248, 0.4);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #ffffff;
}

.sidebar-title span {
    font-size: 11px;
    display: block;
    color: #b19ffb;
    font-weight: 600;
    margin-top: -2px;
    letter-spacing: 1px;
}

.sidebar-menu {
    flex: 1;
    padding: 20px 12px;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-menu-header {
    font-size: 8.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(177, 159, 251, 0.5);
    padding: 14px 16px 4px 16px;
    margin-top: 12px;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-menu-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-menu-header:first-child,
.sidebar-menu-header:first-of-type {
    margin-top: 0;
}


.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.menu-item i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.menu-item.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%) !important;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(89, 69, 118, 0.4);
}

.sidebar-footer {
    padding: 16px 20px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    border-top: 1px solid rgba(255,255,255,0.08);
    text-align: center;
}

/* Main Content Area */
#main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden !important;
    width: 100%;
}


/* Top Header Bar */
#top-header {
    height: var(--header-height);
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.page-title-area h1 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-main);
}

.page-title-area p {
    font-size: 10px;
    color: var(--text-sub);
    margin-top: 2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 38px;
    height: 38px;
    background-color: var(--primary-bg);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    border: 2px solid var(--border);
}

.user-info .name {
    font-weight: 600;
    font-size: 11.5px;
    display: block;
}

.user-info .role {
    font-size: 9.5px;
    color: var(--text-sub);
    display: block;
}

/* Content Frame & Page Sections */
.content-wrapper {
    padding: 18px 24px;
    flex: 1;
}

.page-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.page-section.active {
    display: block;
}

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

/* Layout Utilities: Grids & Flex */
.grid-2 {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* Premium Card Panels */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 16px;
    margin-bottom: 16px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i {
    color: var(--primary);
    font-size: 15px;
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card-header-flex .card-title {
    margin-bottom: 0;
}

/* Premium Dashboard Metrics Panel */
.metric-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--primary);
}

.metric-card.success::after { background-color: var(--status-pass); }
.metric-card.danger::after { background-color: var(--status-reject); }
.metric-card.warning::after { background-color: var(--accent); }

.metric-info {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

.metric-subtext {
    font-size: 9.5px;
    color: var(--text-light);
    margin-top: 4px;
}

.metric-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--transition);
}

.metric-card.success .metric-icon { background-color: #d1fae5; color: var(--status-pass); }
.metric-card.danger .metric-icon { background-color: #fee2e2; color: var(--status-reject); }
.metric-card.warning .metric-icon { background-color: #ede9fe; color: var(--accent); }

.metric-card:hover .metric-icon {
    transform: scale(1.1);
}

/* Forms & Inputs styling */
.form-group {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}

.form-label span {
    color: var(--status-reject);
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background-color: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    outline: none;
    transition: var(--transition);
}

.form-input:focus {
    background-color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(89, 69, 118, 0.15);
}

.form-input-inline-btn {
    display: flex;
    gap: 8px;
}

/* Buttons Styling */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 11px;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    user-select: none;
}

.btn i {
    font-size: 13px;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(89, 69, 118, 0.15);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(89, 69, 118, 0.2);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: #ffffff;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #f8fafc;
    border-color: var(--border-hover);
}

.btn-accent {
    background-color: var(--accent);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.15);
}

.btn-accent:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background-color: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background-color: var(--primary-bg);
}

.btn-danger-outline {
    background-color: transparent;
    border: 1.5px solid var(--status-reject);
    color: var(--status-reject);
}

.btn-danger-outline:hover {
    background-color: #fee2e2;
}

.btn-success {
    background-color: var(--status-pass);
    color: #ffffff;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon-only {
    padding: 8px;
    border-radius: var(--radius-sm);
    aspect-ratio: 1;
}

.btn-close {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-light);
    transition: var(--transition);
}

.btn-close:hover {
    color: var(--text-main);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Premium Table Styling */
.table-container {
    width: 100%;
    overflow: visible; /* Changed from overflow-x: auto to allow dropdowns to spill out */
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: #ffffff;
}

.table-premium {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table-premium th {
    background-color: #1d4ed8; /* Deep Purple as screenshots */
    color: #ffffff;
    font-weight: 500;
    padding: 8px 12px;
    font-size: 11.5px;
    border: none;
    white-space: nowrap;
}

.table-premium td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    vertical-align: middle;
}

.table-premium tbody tr:last-child td {
    border-bottom: none;
}

.table-premium tbody tr:hover {
    background-color: #f8fafc;
}

.table-premium input.form-input {
    padding: 4px 8px;
    font-size: 11px;
}

.table-empty {
    padding: 40px;
    text-align: center;
    color: var(--text-light);
}

.table-empty i {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

/* Custom Checkbox for selections */
.checkbox-container {
    display: block;
    position: relative;
    padding-left: 20px;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 2px;
    left: 0;
    height: 16px;
    width: 16px;
    background-color: #ffffff;
    border: 1.5px solid var(--text-light);
    border-radius: 3px;
    transition: var(--transition);
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--primary);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.badge-pass {
    background-color: var(--status-pass-bg);
    color: var(--status-pass);
}

.badge-reject {
    background-color: var(--status-reject-bg);
    color: var(--status-reject);
}

.badge-void {
    background-color: var(--status-void-bg);
    color: var(--status-void);
}

/* Autocomplete Search Dropdown Styling */
.autocomplete-container {
    position: relative;
    width: 100%;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 480px; /* Wide enough to show the full product name in one line */
    background-color: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 999 !important; /* Ensure it floats on top of all elements */
    max-height: 250px;
    overflow-y: auto;
    display: none;
    animation: slideDown 0.15s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.autocomplete-item:hover {
    background-color: var(--primary-bg);
}

.autocomplete-item-code {
    font-weight: 700;
    font-size: 10.5px;
    color: var(--primary);
}

.autocomplete-item-name {
    font-size: 11px;
    color: var(--text-main);
}

/* Autocomplete Dropdown Selection Input */
.product-select-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Header Filters Bar (Reports Page) */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
    background-color: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.filter-item {
    flex: 1;
    min-width: 200px;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

/* Modal Popup Framework (Glassmorphism backdrop) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    transform: scale(0.92);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header h2 i {
    color: var(--primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: #f8fafc;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

/* SOP Checklist items inside SOP evaluation modal */
.sop-checklist {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sop-item {
    padding: 14px;
    background-color: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.sop-item:hover {
    border-color: var(--primary-light);
}

.sop-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sop-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
}

.sop-desc {
    font-size: 11px;
    color: var(--text-sub);
}

.sop-actions {
    display: flex;
    gap: 6px;
}

.sop-btn {
    border: 1.5px solid var(--border);
    background-color: #ffffff;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    transition: var(--transition);
}

.sop-btn-pass.active {
    background-color: var(--status-pass-bg);
    border-color: var(--status-pass);
    color: var(--status-pass);
}

.sop-btn-fail.active {
    background-color: var(--status-reject-bg);
    border-color: var(--status-reject);
    color: var(--status-reject);
}

/* NG Management forms inside NG Modal */
.ng-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ng-row {
    display: grid;
    grid-template-columns: 1fr 120px;
    gap: 16px;
    align-items: center;
    padding: 12px 16px;
    background-color: #f8fafc;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.ng-category {
    font-weight: 600;
    color: var(--text-main);
}

.ng-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ng-input {
    width: 70px;
    padding: 6px 8px;
    text-align: center;
    font-weight: 700;
}

.ng-unit {
    font-size: 12px;
    color: var(--text-sub);
}

.ng-validation-banner {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
}

.ng-validation-banner.success {
    background-color: var(--status-pass-bg);
    color: var(--status-pass);
}

.ng-validation-banner.error {
    background-color: var(--status-reject-bg);
    color: var(--status-reject);
}

/* Custom SVG Dashboard Graph */
.dashboard-graph-svg {
    width: 100%;
    height: 240px;
    background: transparent !important;
}

.dashboard-graph-axis {
    stroke: #e2e8f0;
    stroke-width: 1.5;
}

.dashboard-graph-grid {
    stroke: #f1f5f9;
    stroke-width: 1;
    stroke-dasharray: 4,4;
}

.dashboard-graph-bar-pass {
    fill: #10b981;
    opacity: 0.85;
    rx: 4;
    transition: var(--transition);
}

.dashboard-graph-bar-pass:hover {
    opacity: 1;
}

.dashboard-graph-bar-fail {
    fill: #ef4444;
    opacity: 0.85;
    rx: 4;
    transition: var(--transition);
}

.dashboard-graph-bar-fail:hover {
    opacity: 1;
}

.dashboard-graph-text {
    font-size: 11px;
    fill: #64748b;
    font-family: inherit;
}

.dashboard-graph-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-sub);
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

/* Pagination buttons styling */
.pagination-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    color: var(--text-sub);
    font-size: 13px;
}

.pagination-controls {
    display: flex;
    gap: 6px;
}

.pagination-btn {
    border: 1px solid var(--border);
    background-color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:hover:not(:disabled) {
    background-color: #f8fafc;
    border-color: var(--border-hover);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Row Action Buttons inside Reports Table */
.action-buttons {
    display: flex;
    gap: 6px;
}

.btn-action {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-action-info {
    color: #0284c7;
}
.btn-action-info:hover {
    background-color: #f0f9ff;
}

.btn-action-edit {
    color: #d97706;
}
.btn-action-edit:hover {
    background-color: #fffbeb;
}

.btn-action-void {
    color: #dc2626;
}
.btn-action-void:hover {
    background-color: #fef2f2;
}

.btn-action:disabled {
    color: var(--text-light) !important;
    background-color: transparent !important;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Info Details Popovers or sections inside modal */
.info-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.info-label {
    font-size: 12px;
    color: var(--text-sub);
    display: block;
    margin-bottom: 2px;
}

.info-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.info-header-divider {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 2px solid var(--primary-bg);
    padding-bottom: 6px;
    margin: 16px 0 10px 0;
}

/* Notification Ticker (Toast notification system) */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
}

.toast {
    background-color: #1e293b;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    max-width: 400px;
    font-size: 13px;
    font-weight: 500;
    border-left: 4px solid var(--accent);
    transform: translateY(100px);
    opacity: 0;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastIn {
    to { transform: translateY(0); opacity: 1; }
}

.toast.success { border-left-color: var(--status-pass); }
.toast.error { border-left-color: var(--status-reject); }

/* Custom Printing Certificate Styles */
@media print {
    @page {
        size: landscape;
        margin: 5mm 6mm;
    }
    
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    
    #app-container, .modal-overlay, .toast-container, .no-print {
        display: none !important;
    }
    
    #print-certificate-area {
        display: block !important;
        width: 100% !important;
        background-color: #ffffff !important;
        color: #000000 !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .no-print-screen {
        display: block !important;
    }
}

/* Certificate Layout container (Hidden by default in web, shown in print mockup) */
#print-certificate-area {
    display: none;
}

/* Print Inspection Record Container */
.print-inspection-record {
    background-color: #ffffff;
    font-family: 'Outfit', 'Sarabun', sans-serif;
    color: #0f172a;
    width: 100%;
    box-sizing: border-box;
    padding: 15px;
    border: 2px solid #2563eb;
    border-radius: 8px;
    margin-bottom: 20px;
    position: relative;
}

/* Print Non-Conformance Record Container */
.print-ncr-record {
    background-color: #ffffff;
    font-family: 'Outfit', 'Sarabun', sans-serif;
    color: #0f172a;
    width: 100%;
    box-sizing: border-box;
    padding: 15px;
    border: 2px solid #b91c1c; /* RED border for NCR */
    border-radius: 8px;
    margin-bottom: 20px;
    position: relative;
}

/* Print Sample Request Container */
.print-sample-record {
    background-color: #ffffff;
    font-family: 'Outfit', 'Sarabun', sans-serif;
    color: #0f172a;
    width: 100%;
    box-sizing: border-box;
    padding: 15px;
    border: 2px solid #3B82F6; /* Violet border for Sample request */
    border-radius: 8px;
    margin-bottom: 20px;
    position: relative;
}

@media print {
    .print-inspection-record {
        border: 2px solid #2563eb;
        padding: 10px;
        margin-bottom: 0;
        page-break-after: always;
        break-after: page;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    .print-ncr-record {
        border: 2px solid #b91c1c;
        padding: 10px;
        margin-bottom: 0;
        page-break-before: always;
        break-before: page;
        page-break-after: always;
        break-after: page;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    .print-sample-record {
        border: 2px solid #3B82F6;
        padding: 10px;
        margin-bottom: 0;
        page-break-after: always;
        break-after: page;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    .print-inspection-record:last-child,
    .print-ncr-record:last-child,
    .print-sample-record:last-child {
        page-break-after: avoid;
        break-after: avoid;
    }
}

/* Header inside print */
.print-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #2563eb;
    padding-bottom: 6px;
    margin-bottom: 10px;
}

.print-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #2563eb;
    text-transform: uppercase;
}

.print-header p {
    margin: 2px 0 0 0;
    font-size: 10px;
    color: #64748b;
}

.print-logo {
    height: 32px;
    object-fit: contain;
}

/* Print Body Layout: side-by-side columns */
.print-body {
    display: flex;
    gap: 12px;
    width: 100%;
}

.print-body.no-photos .print-col-left {
    width: 100%;
}

.print-body.has-photos .print-col-left {
    width: 45%;
}

.print-body.has-photos .print-col-right {
    width: 55%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Left column details table styling */
.print-col-left .certificate-details-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 8px;
}

.print-col-left .certificate-details-table td {
    padding: 3px 5px;
    font-size: 9.5px;
    line-height: 1.25;
    border-bottom: 1px solid #e2e8f0;
}

.print-col-left .certificate-details-table td.cert-label {
    font-weight: 700;
    width: 140px;
    color: #1d4ed8;
}

.print-col-left .certificate-details-table td.cert-value {
    color: #1e293b;
}

/* Left column signatures styling */
.print-signatures {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.print-sig-block {
    flex: 1;
    text-align: center;
}

.print-sig-line {
    border-bottom: 1px dashed #94a3b8;
    margin: 12px auto 3px auto;
    width: 130px;
}

.print-sig-label {
    font-size: 9px;
    color: #64748b;
    font-weight: 500;
    display: block;
}

.print-sig-name {
    font-size: 9px;
    font-weight: 600;
    color: #0f172a;
    margin-top: 2px;
}

/* Right column photo section styling */
.print-photo-section {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px;
    background-color: #f8fafc;
}

.print-photo-section-header {
    font-size: 9.5px;
    font-weight: 700;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 3px;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.print-photo-grid {
    display: grid;
    gap: 6px;
}

.print-photo-grid.cols-1 { grid-template-columns: 1fr; }
.print-photo-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.print-photo-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.print-photo-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.print-photo-grid.cols-5 { grid-template-columns: repeat(3, 1fr); }

.print-photo-item {
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 4px;
    background-color: #ffffff;
    text-align: center;
    page-break-inside: avoid;
    break-inside: avoid;
}

.print-photo-item img {
    max-width: 100%;
    max-height: 90px;
    min-height: 50px;
    object-fit: contain;
    border-radius: 2px;
    display: block;
    margin: 0 auto;
}

.print-photo-label {
    font-size: 8px;
    color: #64748b;
    display: block;
    margin-top: 3px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Footer & page number */
.print-page-footer {
    display: none;
}

/* ==========================================================================
   AUTHENTICATION & LOGIN GLASSMORPHISM STYLES
   ========================================================================== */

.login-overlay-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, #1e3a8a, #0f172a); /* Deep Purple to Slate dark gradient */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000; /* Float above everything including modals */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-overlay-screen.active {
    opacity: 1;
    pointer-events: auto;
}

.login-card {
    background-color: rgba(30, 41, 59, 0.65); /* Sleek translucent dark card */
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    color: #ffffff;
    animation: loginCardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes loginCardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo-area {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-circle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #c084fc, #818cf8);
    border-radius: 50%;
    margin: 0 auto 16px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(168, 85, 247, 0.3);
}

.login-logo-area h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #ffffff, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-logo-area p {
    font-size: 10px;
    color: #60a5fa;
    font-weight: 600;
    letter-spacing: 1.5px;
    margin-top: 4px;
    text-transform: uppercase;
}

.login-card .form-label {
    color: #cbd5e1;
    font-weight: 500;
}

.login-card .form-input {
    background-color: rgba(15, 23, 42, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.login-card .form-input:focus {
    background-color: rgba(15, 23, 42, 0.8);
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.2);
}

.quick-login-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0 16px 0;
    color: rgba(255, 255, 255, 0.35);
    font-size: 11px;
    font-weight: 600;
}

.quick-login-divider::before,
.quick-login-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
}

.quick-login-divider span {
    padding: 0 10px;
}

.quick-login-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-login-buttons .btn {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 500;
    padding: 8px 12px;
    justify-content: flex-start;
}

.quick-login-buttons .btn:hover {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: translateY(-1px);
}

.quick-login-buttons .btn i {
    width: 16px;
    text-align: center;
    color: #c084fc;
}

/* ==========================================================================
   SIDEBAR USER PROFILE PANEL STYLES
   ========================================================================== */

.sidebar-user-block {
    padding: 20px 16px;
    background-color: rgba(0, 0, 0, 0.3) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-role-badge {
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.user-profile-header-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    color: #ffffff;
}

.user-tag-procure { background-color: #3b82f6; } /* Procurement Purple badge */
.user-tag-warehouse { background-color: #10b981; } /* Warehouse Green badge */
.user-tag-admin { background-color: #f59e0b; } /* Admin Yellow badge */

/* ==========================================================================
   MOBILE & IPAD RESPONSIVE STYLES
   ========================================================================== */

/* 1. Sidebar Toggle Button styling on top header */
#sidebar-toggle {
    display: none; /* Hidden on desktop screens */
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--text-main);
    cursor: pointer;
    margin-right: 16px;
    padding: 8px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    transition: var(--transition);
}

#sidebar-toggle:hover {
    background-color: rgba(15, 23, 42, 0.05);
}

/* 2. Media Queries for Tablet/iPad (Screens < 1024px) */
@media screen and (max-width: 1023px) {
    #sidebar-toggle {
        display: flex; /* Show hamburger button */
    }

    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
    }

    #sidebar.active {
        transform: translateX(0);
    }

    #sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(15, 23, 42, 0.3);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }

    #sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    #main-content {
        margin-left: 0 !important; /* Full width for main workspace */
        width: 100%;
    }

    #top-header {
        padding: 16px 20px;
    }

    .content-wrapper {
        padding: 20px;
    }

    /* Stack grid elements on iPad */
    .grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }

    .grid-2 {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

/* ==========================================================================
   LIQUID GLASS THEME & RESPONSIVE OVERRIDES
   ========================================================================== */

:root {
    --glass-bg: rgba(255, 255, 255, 0.42);
    --glass-border: rgba(255, 255, 255, 0.35);
    --glass-glow: rgba(37, 99, 235, 0.15);
    --shadow-liquid: 0 8px 32px 0 rgba(31, 38, 135, 0.12), 
                      inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* 1. Global Liquid Background Blobs */
.liquid-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    z-index: -10;
    pointer-events: none;
    animation: fluidMovement 25s infinite alternate ease-in-out;
    opacity: 0.65;
}

.liquid-blob-1 {
    top: -10%;
    right: -10%;
    width: 45vw;
    height: 45vw;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.35) 0%, rgba(99, 102, 241, 0.05) 70%);
}

.liquid-blob-2 {
    bottom: -15%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.28) 0%, rgba(37, 99, 235, 0.05) 70%);
    animation-delay: -7s;
    animation-duration: 30s;
}

.liquid-blob-3 {
    top: 40%;
    left: 35%;
    width: 35vw;
    height: 35vw;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.22) 0%, rgba(236, 72, 153, 0.05) 70%);
    animation-delay: -12s;
    animation-duration: 22s;
}

@keyframes fluidMovement {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    33% { transform: translate(5vw, 4vh) scale(1.08) rotate(45deg); }
    66% { transform: translate(-3vw, -5vh) scale(0.92) rotate(90deg); }
    100% { transform: translate(2vw, 2vh) scale(1.02) rotate(135deg); }
}

/* 2. Liquid Glass Card Overrides */
.card, #top-header {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(25px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
    border: 1px solid var(--glass-border) !important;
    box-shadow: var(--shadow-liquid) !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease !important;
}

#sidebar {
    background: rgba(15, 23, 42, 0.97) !important; /* Highly opaque dark purple glass for absolute contrast */
    backdrop-filter: blur(40px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(40px) saturate(200%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 4px 0 32px rgba(15, 10, 28, 0.3) !important;
}

.login-card {
    background: rgba(30, 41, 59, 0.75) !important; /* Sleek translucent dark card for readable white text */
    backdrop-filter: blur(25px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3) !important;
}

.modal-overlay {
    background-color: rgba(15, 23, 42, 0.75) !important; /* Darker backdrop to dim background contents */
    backdrop-filter: blur(12px) !important; /* Blur the background content heavily */
    -webkit-backdrop-filter: blur(12px) !important;
}

.modal-container {
    background: #ffffff !important; /* Solid white to completely prevent text bleed */
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22) !important;
    border-radius: 28px !important;
    border: 1px solid var(--border) !important;
}

.card {
    border-radius: 20px !important;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 36px 0 rgba(31, 38, 135, 0.16), 
                inset 0 1px 0 rgba(255, 255, 255, 0.45) !important;
}

/* 3. Rounded Pill Form Inputs & Buttons */
.form-input, select, textarea {
    border-radius: 14px !important;
    border: 1.5px solid rgba(89, 69, 118, 0.12) !important;
    background: rgba(255, 255, 255, 0.6) !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    color: var(--text-main) !important;
    font-weight: 500 !important;
    padding: 7px 11px !important;
    font-size: 11px !important;
}

.form-input:focus, select:focus, textarea:focus {
    border-color: var(--primary) !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(89, 69, 118, 0.18) !important;
    outline: none !important;
}

.btn {
    border-radius: 22px !important;
    padding: 7px 16px !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    position: relative;
    overflow: hidden;
    font-size: 11px !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%) !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(89, 69, 118, 0.3) !important;
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 6px 20px rgba(89, 69, 118, 0.4) !important;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(89, 69, 118, 0.2) !important;
    color: var(--primary) !important;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.85) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(89, 69, 118, 0.1) !important;
}

/* 4. Brand Logo Styles */
.login-brand-logo {
    height: 70px;
    max-width: 180px;
    object-fit: contain;
    margin-bottom: 10px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.login-brand-logo:hover {
    transform: scale(1.05);
}

.sidebar-brand-logo {
    height: 38px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
    transition: transform 0.3s ease;
}

.sidebar-brand-logo:hover {
    transform: rotate(-3deg) scale(1.05);
}

/* 5. Custom Alert & Confirm Modals */
.confirm-modal-container {
    border-radius: 28px !important;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.15) !important;
    animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modalPop {
    0% { transform: scale(0.9) translateY(20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

#confirm-modal-icon {
    animation: iconPulse 2s infinite ease-in-out;
}

@keyframes iconPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(89, 69, 118, 0.2); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 12px rgba(89, 69, 118, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(89, 69, 118, 0); }
}

/* 6. Mobile Bottom Nav Bar Styles */
#bottom-nav-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 66px;
    background: rgba(255, 255, 255, 0.65) !important;
    backdrop-filter: blur(25px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(190%) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.45) !important;
    justify-content: space-around;
    align-items: center;
    z-index: 998;
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.06) !important;
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #64748b;
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    font-family: 'Outfit', 'Sarabun', sans-serif;
    flex: 1;
    height: 100%;
    transition: all 0.25s ease;
    position: relative;
    cursor: pointer;
}

.bottom-nav-item i {
    font-size: 20px;
    margin-bottom: 4px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.25s ease;
}

.bottom-nav-item.active {
    color: var(--primary) !important;
}

.bottom-nav-item.active i {
    transform: translateY(-4px) scale(1.15);
    color: var(--primary) !important;
}

.bottom-nav-item::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--primary);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.bottom-nav-item.active::after {
    opacity: 1;
}

/* Floating Scan Button Style */
#bottom-nav-scan {
    overflow: visible !important;
}

#bottom-nav-scan .scan-icon-wrapper {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary)) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 3px solid #ffffff !important;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35) !important;
    margin-bottom: 2px !important;
    transform: translateY(-8px) !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

#bottom-nav-scan .scan-icon-wrapper svg {
    display: block !important;
    transition: transform 0.3s ease !important;
}

#bottom-nav-scan.active .scan-icon-wrapper {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    transform: translateY(-12px) scale(1.1) !important;
    box-shadow: 0 6px 15px rgba(29, 78, 216, 0.5) !important;
}

#bottom-nav-scan.active .scan-icon-wrapper svg {
    transform: rotate(90deg) !important;
}

#bottom-nav-scan span {
    transform: translateY(-4px) !important;
    transition: transform 0.3s ease !important;
}

#bottom-nav-scan.active span {
    transform: translateY(-6px) !important;
}

#bottom-nav-scan::after {
    display: none !important;
}

/* 7. Tablet/iPad Responsiveness (Screens < 1024px) */
@media screen and (max-width: 1023px) {
    #sidebar-toggle {
        display: flex !important;
    }

    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
    }

    #sidebar.active {
        transform: translateX(0);
    }

    #sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(15, 23, 42, 0.3);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }

    #sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    #main-content {
        margin-left: 0 !important;
        width: 100%;
    }

    #top-header {
        padding: 16px 20px;
    }

    .content-wrapper {
        padding: 20px;
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }

    .grid-2 {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

/* Container Photos responsive grid */
.container-photos-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 12px;
    margin-bottom: 24px;
}

/* 8. Mobile Responsiveness (Screens < 768px) */
@media screen and (max-width: 767px) {
    .container-photos-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    #sidebar .sidebar-menu {
        display: none !important;
    }

    #sidebar .sidebar-brand {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding-bottom: 15px;
        margin-bottom: 15px;
    }
    
    #sidebar-toggle {
        display: flex !important;
        order: 3;
        margin-right: 0;
        margin-left: 12px;
        border: 1px solid var(--glass-border) !important;
        background: rgba(255, 255, 255, 0.4) !important;
        align-items: center;
        justify-content: center;
    }
    
    .page-title-area {
        order: 1;
    }
    
    .header-actions {
        display: none !important;
    }
    
    #bottom-nav-bar {
        display: flex !important;
    }
    
    .content-wrapper {
        padding-bottom: 96px !important;
        padding-left: 14px !important;
        padding-right: 14px !important;
    }
    
    .card {
        padding: 16px !important;
    }
    
    #top-header {
        position: sticky !important;
        top: 0;
        z-index: 990;
        background: rgba(255, 255, 255, 0.6) !important;
        backdrop-filter: blur(20px) saturate(180%) !important;
        border-bottom: 1px solid var(--glass-border) !important;
        padding: 12px 16px;
        height: auto;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }
    
    .page-title-area h1 {
        font-size: 16px !important;
        margin: 0;
    }
    
    .page-title-area p {
        display: none;
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .metric-card {
        padding: 12px 14px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        justify-content: center !important;
        gap: 6px !important;
    }

    .metric-card .metric-info {
        width: 100% !important;
    }

    .metric-card .metric-value {
        font-size: 20px !important;
        margin-top: 2px !important;
    }

    .metric-card .metric-label {
        font-size: 10px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .metric-card .metric-icon {
        position: absolute !important;
        right: 10px !important;
        top: 50% !important;
        transform: translateY(-50%) scale(0.75) !important;
        opacity: 0.18 !important;
        background: transparent !important;
        width: auto !important;
        height: auto !important;
    }
    
    .modal-container {
        width: 95% !important;
        margin: 10px !important;
        max-height: 85vh;
        display: flex;
        flex-direction: column;
    }
    
    .modal-body {
        overflow-y: auto;
        padding: 20px 16px !important;
    }
    
    .login-card {
        width: 92% !important;
        padding: 30px 20px !important;
    }
    
    .login-logo-area h2 {
        font-size: 18px !important;
    }
    
    .table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 12px;
    }

    /* Keep PO items table container visible to prevent dropdown clipping */
    .table-container.po-table-container {
        overflow-x: visible !important;
        overflow: visible !important;
    }

    #po-items-table {
        table-layout: fixed;
        width: 100% !important;
        min-width: 0 !important;
    }
    
    #po-items-table th:nth-child(1),
    #po-items-table td:nth-child(1) {
        width: 25px !important;
    }
    
    #po-items-table th:nth-child(2),
    #po-items-table td:nth-child(2) {
        width: auto !important;
    }
    
    #po-items-table th:nth-child(3),
    #po-items-table td:nth-child(3) {
        width: 100px !important;
    }
    
    #po-items-table th:nth-child(4),
    #po-items-table td:nth-child(4) {
        width: 70px !important;
    }
    
    #po-items-table th:nth-child(5),
    #po-items-table td:nth-child(5) {
        width: 40px !important;
    }
    
    #po-items-table input.form-input {
        padding: 6px 8px !important;
        font-size: 11px !important;
    }
    
    /* Reset table layout and min-widths on mobile to enable card layout */
    #po-history-table,
    #product-catalog-table,
    #employee-table,
    #samples-table,
    #qc-record-table,
    #reports-table,
    #dash-recent-table,
    #customers-table,
    #vendors-table,
    #claims-history-table,
    #refund-pending-table,
    #refund-history-table,
    #pr-history-table,
    #pr-approve-table {
        min-width: 0 !important;
        display: block !important;
        width: 100% !important;
        border: none !important;
        background: transparent !important;
    }

    /* Hide table headers on mobile */
    #po-history-table thead,
    #product-catalog-table thead,
    #employee-table thead,
    #samples-table thead,
    #qc-record-table thead,
    #reports-table thead,
    #dash-recent-table thead,
    #customers-table thead,
    #vendors-table thead,
    #claims-history-table thead,
    #refund-pending-table thead,
    #refund-history-table thead,
    #pr-history-table thead,
    #pr-approve-table thead {
        display: none !important;
    }

    #po-history-table tbody,
    #product-catalog-table tbody,
    #employee-table tbody,
    #samples-table tbody,
    #qc-record-table tbody,
    #reports-table tbody,
    #dash-recent-table tbody,
    #customers-tbody,
    #vendors-tbody,
    #claims-history-tbody,
    #refund-pending-tbody,
    #refund-history-tbody,
    #pr-history-tbody,
    #pr-approve-tbody {
        display: block !important;
        width: 100% !important;
    }

    /* Restructure tr into premium styled cards */
    #po-history-table tbody tr,
    #product-catalog-table tbody tr,
    #employee-table tbody tr,
    #samples-table tbody tr,
    #qc-record-table tbody tr,
    #reports-table tbody tr,
    #dash-recent-table tbody tr,
    #customers-tbody tr,
    #vendors-tbody tr,
    #claims-history-tbody tr,
    #refund-pending-tbody tr,
    #refund-history-tbody tr,
    #pr-history-tbody tr,
    #pr-approve-tbody tr {
        display: block !important;
        width: 100% !important;
        background: var(--bg-card) !important;
        border: 1px solid var(--border) !important;
        border-radius: var(--radius-md) !important;
        padding: 14px !important;
        margin-bottom: 12px !important;
        box-shadow: var(--shadow-sm) !important;
        box-sizing: border-box !important;
    }

    /* Prevent table containers of card-styled tables from clipping dropdowns and scroll locks */
    .table-container {
        overflow: visible !important;
        overflow-x: visible !important;
        border: none !important;
        background: transparent !important;
        max-height: none !important; /* Allow natural scrolling on mobile screen */
    }

    /* Style the table empty state row */
    #po-history-table td.table-empty,
    #product-catalog-table td.table-empty,
    #employee-table td.table-empty,
    #samples-table td.table-empty,
    #qc-record-table td.table-empty,
    #reports-table td.table-empty,
    #dash-recent-table td.table-empty,
    #customers-table td.table-empty,
    #vendors-table td.table-empty {
        display: block !important;
        text-align: center !important;
        padding: 30px 10px !important;
        width: 100% !important;
        border: none !important;
    }

    /* Restructure cells with data-label into two-column grids */
    #po-history-table td[data-label],
    #product-catalog-table td[data-label],
    #employee-table td[data-label],
    #samples-table td[data-label],
    #qc-record-table td[data-label],
    #reports-table td[data-label],
    #dash-recent-table td[data-label],
    #customers-table td[data-label],
    #vendors-table td[data-label],
    #claims-history-table td[data-label],
    #refund-pending-table td[data-label],
    #refund-history-table td[data-label],
    #pr-history-table td[data-label],
    #pr-approve-table td[data-label] {
        display: grid !important;
        grid-template-columns: 120px 1fr !important;
        gap: 8px !important;
        align-items: center !important;
        text-align: left !important;
        padding: 8px 0 !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
        min-height: 38px !important;
        min-width: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Remove bottom border on last cell of each card */
    #po-history-table td[data-label]:last-child,
    #product-catalog-table td[data-label]:last-child,
    #employee-table td[data-label]:last-child,
    #samples-table td[data-label]:last-child,
    #qc-record-table td[data-label]:last-child,
    #reports-table td[data-label]:last-child,
    #dash-recent-table td[data-label]:last-child,
    #customers-table td[data-label]:last-child,
    #vendors-table td[data-label]:last-child,
    #claims-history-table td[data-label]:last-child,
    #refund-pending-table td[data-label]:last-child,
    #refund-history-table td[data-label]:last-child,
    #pr-history-table td[data-label]:last-child,
    #pr-approve-table td[data-label]:last-child {
        border-bottom: none !important;
    }

    /* Create the left label using ::before */
    #po-history-table td[data-label]::before,
    #product-catalog-table td[data-label]::before,
    #employee-table td[data-label]::before,
    #samples-table td[data-label]::before,
    #qc-record-table td[data-label]::before,
    #reports-table td[data-label]::before,
    #dash-recent-table td[data-label]::before,
    #customers-table td[data-label]::before,
    #vendors-table td[data-label]::before,
    #pr-history-table td[data-label]::before,
    #pr-approve-table td[data-label]::before {
        content: attr(data-label) !important;
        font-weight: 600 !important;
        color: var(--text-sub) !important;
        font-size: 11px !important;
        text-align: left !important;
        white-space: nowrap !important;
    }

    /* Condensed layouts for lists/tables on mobile (reduce by ~60%) */
    #po-history-table td:nth-child(3),
    #po-history-table td:nth-child(4),
    #product-catalog-table td:nth-child(3),
    #product-catalog-table td:nth-child(4),
    #product-catalog-table td:nth-child(5),
    #samples-table td:nth-child(2),
    #samples-table td:nth-child(3),
    #samples-table td:nth-child(5),
    #samples-table td:nth-child(7),
    #customers-table td:nth-child(3),
    #customers-table td:nth-child(4),
    #customers-table td:nth-child(5),
    #customers-table td:nth-child(6),
    #vendors-table td:nth-child(3),
    #vendors-table td:nth-child(4),
    #vendors-table td:nth-child(5),
    #vendors-table td:nth-child(6),
    #vendors-table td:nth-child(7),
    #employee-table td:nth-child(3),
    #employee-table td:nth-child(4),
    #employee-table td:nth-child(5),
    #reports-table td:nth-child(3),
    #reports-table td:nth-child(4),
    #reports-table td:nth-child(6),
    #reports-table td:nth-child(7),
    #reports-table td:nth-child(8) {
        display: none !important;
    }

    #po-history-table tbody tr,
    #product-catalog-table tbody tr,
    #samples-table tbody tr,
    #customers-tbody tr,
    #vendors-tbody tr,
    #employee-tbody tr,
    #reports-table tbody tr {
        cursor: pointer !important;
        transition: background-color 0.2s ease, border-color 0.2s ease !important;
    }

    #po-history-table tbody tr:active, #po-history-table tbody tr:hover,
    #product-catalog-table tbody tr:active, #product-catalog-table tbody tr:hover,
    #samples-table tbody tr:active, #samples-table tbody tr:hover,
    #customers-tbody tr:active, #customers-tbody tr:hover,
    #vendors-tbody tr:active, #vendors-tbody tr:hover,
    #employee-tbody tr:active, #employee-tbody tr:hover,
    #reports-table tbody tr:active, #reports-table tbody tr:hover,
    #pr-history-tbody tr:active, #pr-history-tbody tr:hover,
    #pr-approve-tbody tr:active, #pr-approve-tbody tr:hover {
        background: rgba(255, 255, 255, 0.08) !important;
        border-color: var(--primary) !important;
    }
    .autocomplete-dropdown {
        min-width: 280px !important;
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        z-index: 1000 !important;
    }

    #qc-record-table th:nth-child(1),
    #qc-record-table td:nth-child(1) {
        display: none;
    }

    #qc-record-table td[data-label="ลบ"] button,
    #qc-record-table td[data-label="ลบ"] button.btn {
        width: 32px !important;
        height: 32px !important;
        min-height: 32px !important;
        min-width: 32px !important;
        padding: 0 !important;
        aspect-ratio: 1 / 1 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: var(--radius-md) !important;
        justify-self: start !important;
        background: rgba(239, 68, 68, 0.1) !important;
        border: 1px solid rgba(239, 68, 68, 0.2) !important;
    }

    #qc-record-table td[data-label="ลบ"] button i {
        color: var(--status-reject) !important;
        font-size: 14px !important;
    }
    
    .btn-xs, .btn-sm {
        padding: 6px 12px !important;
        font-size: 11px !important;
        min-height: 32px;
    }

    .filter-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding: 16px !important;
    }

    .filter-item {
        max-width: 100% !important;
    }

    .filter-actions {
        width: 100%;
        display: flex;
        gap: 8px;
        justify-content: flex-end;
        margin-top: 4px;
    }

    .filter-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .form-input-inline-btn {
        flex-direction: row !important;
    }
}

/* Sidebar Logout Button Contrast Override */
#btn-sidebar-logout {
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: #fca5a5 !important;
    background-color: rgba(239, 68, 68, 0.08) !important;
    transition: var(--transition) !important;
}

#btn-sidebar-logout:hover {
    background-color: #ef4444 !important;
    color: #ffffff !important;
    border-color: #ef4444 !important;
}

/* Glassmorphism Warehouse Toggle Switcher */
.glass-toggle-container {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 30px;
    padding: 3px;
    gap: 4px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.warehouse-toggle-btn {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-sub);
    padding: 6px 16px;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.warehouse-toggle-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.warehouse-toggle-btn.active {
    background: var(--primary); /* Violet #3B82F6 */
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

/* Adjust top header layout for header actions */
#top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Premium Menu Hub Cards */
.menu-card {
    border: 1px solid var(--border);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease !important;
}
.menu-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.25), 0 0 1px 1px rgba(255,255,255,0.08);
    border-color: var(--accent-light) !important;
}

/* Premium Custom Scrollbars for Sidebar Menu */
#sidebar nav::-webkit-scrollbar {
    width: 5px;
}
#sidebar nav::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}
#sidebar nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
}
#sidebar nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Reason Pill Selector Styling */
.reason-pill {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: var(--text-sub) !important;
    border-radius: 20px !important;
    padding: 6px 16px !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}
.reason-pill:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--text-light) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}
.reason-pill.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25) !important;
    font-weight: 600 !important;
}



/* Odoo-style Apps Grid */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 100px));
    gap: 36px 28px;
    justify-content: center;
    max-width: 800px;
    width: 100%;
    margin: 40px auto;
}

.app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-item:hover {
    transform: translateY(-6px);
}

.app-icon-wrapper {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.1), 0 0 1px rgba(0, 0, 0, 0.1);
    font-size: 28px;
    margin-bottom: 10px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.app-item:hover .app-icon-wrapper {
    box-shadow: 0 12px 24px -6px rgba(37, 99, 235, 0.3), 0 0 1px rgba(37, 99, 235, 0.2);
}

.app-name {
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

/* Odoo-style Full Screen Menu Hub Layout */
body.full-screen-menu #sidebar {
    display: none !important;
}
body.full-screen-menu #top-header {
    display: none !important;
}
body.full-screen-menu #bottom-nav-bar {
    display: none !important;
}
body.full-screen-menu #app-container {
    padding-left: 0 !important;
    background: radial-gradient(circle at top right, #eff6ff 0%, #f8fafc 100%) !important;
}
body.full-screen-menu .content-wrapper {
    margin-left: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 100vh;
    display: flex !important;
    align-items: center;
    justify-content: center;
}
body.full-screen-menu #menu-hub {
    width: 100% !important;
    max-width: 860px !important;
    padding: 60px 24px !important;
    box-sizing: border-box !important;
    animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@media screen and (max-width: 767px) {
    .apps-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 80px)) !important;
        gap: 24px 16px !important;
    }
    .app-icon-wrapper {
        width: 60px !important;
        height: 60px !important;
        font-size: 24px !important;
        border-radius: 14px !important;
    }
    .app-name {
        font-size: 11.5px !important;
    }
    body.full-screen-menu #menu-hub {
        padding: 40px 16px !important;
    }
}

/* --- Chailai SmartHub Mobile Optimization Phase 2 --- */
.mobile-only {
    display: none !important;
}

@media screen and (max-width: 767px) {
    .desktop-only {
        display: none !important;
    }
    .mobile-only {
        display: block !important;
    }
    
    /* Prevent iOS auto-zoom on inputs, selects, and textareas */
    input, select, textarea, .form-input, .select-premium, .textarea-premium {
        font-size: 16px !important;
    }
    
    /* Collapse form grid layouts to 1 column on mobile */
    .grid-3 {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    /* Restructure claims and refunds tables into cards on mobile */
    #claims-history-table,
    #refund-pending-table,
    #refund-history-table {
        min-width: 0 !important;
        display: block !important;
        width: 100% !important;
        border: none !important;
        background: transparent !important;
    }
    
    #claims-history-table thead,
    #refund-pending-table thead,
    #refund-history-table thead {
        display: none !important;
    }
    
    #claims-history-tbody,
    #refund-pending-tbody,
    #refund-history-tbody {
        display: block !important;
        width: 100% !important;
    }
    
    #claims-history-tbody tr,
    #refund-pending-tbody tr,
    #refund-history-tbody tr {
        display: block !important;
        width: 100% !important;
        background: var(--bg-card) !important;
        border: 1px solid var(--border) !important;
        border-radius: var(--radius-md) !important;
        padding: 14px !important;
        margin-bottom: 12px !important;
        box-shadow: var(--shadow-sm) !important;
        box-sizing: border-box !important;
        cursor: pointer !important;
        transition: background-color 0.2s ease, border-color 0.2s ease !important;
    }
    
    #claims-history-tbody tr:active, #claims-history-tbody tr:hover,
    #refund-pending-tbody tr:active, #refund-pending-tbody tr:hover,
    #refund-history-tbody tr:active, #refund-history-tbody tr:hover {
        background: rgba(255, 255, 255, 0.08) !important;
        border-color: var(--primary) !important;
    }
    
    #claims-history-table td[data-label],
    #refund-pending-table td[data-label],
    #refund-history-table td[data-label] {
        display: grid !important;
        grid-template-columns: 120px 1fr !important;
        gap: 8px !important;
        align-items: center !important;
        text-align: left !important;
        padding: 8px 0 !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
        min-height: 38px !important;
        min-width: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    #claims-history-table td[data-label]:last-child,
    #refund-pending-table td[data-label]:last-child,
    #refund-history-table td[data-label]:last-child {
        border-bottom: none !important;
    }
    
    #claims-history-table td[data-label]::before,
    #refund-pending-table td[data-label]::before,
    #refund-history-table td[data-label]::before {
        content: attr(data-label) !important;
        font-weight: 600 !important;
        color: var(--text-sub) !important;
        font-size: 11px !important;
        text-align: left !important;
        white-space: nowrap !important;
    }
    
    /* Settings tab mobile responsive layout fixes */
    .settings-branch-tabs {
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    #settings-form div[style*="display: flex; gap: 12px"],
    #settings-form div[style*="display:flex; gap:12px"] {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    #settings-form div[style*="display: flex; gap: 12px"] > div,
    #settings-form div[style*="display:flex; gap:12px"] > div {
        margin-bottom: 12px !important;
    }
    
    #settings-layout-container > .card {
        max-width: 100% !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }
    
    #settings-layout-container {
        max-width: 100% !important;
        overflow: hidden !important;
    }
    
    /* Enforce hiding of desktop-only cells even if they match td[data-label] on mobile */
    #claims-history-table td[data-label].desktop-only,
    #refund-pending-table td[data-label].desktop-only,
    #refund-history-table td[data-label].desktop-only,
    #pr-history-table td[data-label].desktop-only,
    #pr-approve-table td[data-label].desktop-only,
    .table-premium td[data-label].desktop-only {
        display: none !important;
    }

    /* PR Items Creation Table mobile collapse overrides */
    #pr-form-items-table {
        min-width: 0 !important;
        display: block !important;
        width: 100% !important;
        border: none !important;
        background: transparent !important;
    }
    #pr-form-items-table thead {
        display: none !important;
    }
    #pr-form-items-tbody {
        display: block !important;
        width: 100% !important;
    }
    #pr-form-items-tbody tr {
        display: block !important;
        width: 100% !important;
        background: var(--bg-card) !important;
        border: 1px solid var(--border) !important;
        border-radius: var(--radius-md) !important;
        padding: 14px !important;
        margin-bottom: 12px !important;
        box-shadow: var(--shadow-sm) !important;
        box-sizing: border-box !important;
    }
    #pr-form-items-table td[data-label] {
        display: grid !important;
        grid-template-columns: 120px 1fr !important;
        gap: 8px !important;
        align-items: center !important;
        text-align: left !important;
        padding: 8px 0 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
        min-height: 38px !important;
        min-width: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    #pr-form-items-table td[data-label]:last-child {
        border-bottom: none !important;
    }
    #pr-form-items-table td[data-label]::before {
        content: attr(data-label) !important;
        font-weight: 600 !important;
        color: var(--text-sub) !important;
        font-size: 11px !important;
        text-align: left !important;
        white-space: nowrap !important;
    }
    #pr-form-items-table td[data-label] input,
    #pr-form-items-table td[data-label] select,
    #pr-form-items-table td[data-label] textarea {
        width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* Glassmorphism Auto-Refresh Widget */
.glass-refresh-container {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-right: 12px;
}

.glass-refresh-container:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 16px rgba(96, 165, 250, 0.15);
}

.refresh-toggle-btn {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.refresh-toggle-btn i {
    font-size: 11px;
    color: var(--primary);
    transition: transform 0.3s ease;
}

.refresh-toggle-btn strong {
    font-family: monospace;
    font-size: 13px;
    color: var(--primary);
}

/* Paused State */
.glass-refresh-container.paused {
    border-color: rgba(239, 68, 68, 0.2);
}

.glass-refresh-container.paused .refresh-toggle-btn strong {
    color: var(--status-reject);
}

.glass-refresh-container.paused .refresh-toggle-btn i {
    color: var(--status-reject);
}

.spinner-refresh.spinning {
    animation: fa-spin 1.5s infinite linear;
}

@keyframes fa-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Mobile responsive details */
@media screen and (max-width: 767px) {
    .glass-refresh-container {
        padding: 1px;
        margin-right: 6px;
    }
    .refresh-toggle-btn {
        padding: 4px 10px;
        font-size: 10.5px;
        gap: 6px;
    }
    .refresh-label {
        font-size: 10.5px;
    }
    .refresh-toggle-btn strong {
        font-size: 11.5px;
    }
}

/* Premium Global Loading Overlay */
.global-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4); /* Slate 900 translucent */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.global-loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.loading-card {
    background: var(--bg-card, rgba(255, 255, 255, 0.85));
    border: 1px solid var(--border, rgba(255, 255, 255, 0.25));
    padding: 30px 40px;
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-lg, 0 10px 25px rgba(0, 0, 0, 0.1));
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-width: 220px;
}

.dark-theme .loading-card {
    background: rgba(30, 41, 59, 0.85); /* Slate 800 */
    border-color: rgba(255, 255, 255, 0.1);
}

.loading-spinner-wrapper {
    position: relative;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid rgba(37, 99, 235, 0.1); /* light blue */
    border-top: 3px solid var(--primary, #2563eb);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

.spinner-icon {
    font-size: 18px;
    color: var(--primary, #2563eb);
    animation: counter-spin 2s linear infinite;
}

.loading-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main, #0f172a);
}

.loading-subtext {
    font-size: 11px;
    color: var(--text-sub, #64748b);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes counter-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

