@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Primary Palette (Material Design 3 inspired) */
    --md-primary: #6750A4;
    --md-on-primary: #FFFFFF;
    --md-primary-container: #EADDFF;
    --md-on-primary-container: #21005D;
    
    --md-secondary: #625B71;
    --md-on-secondary: #FFFFFF;
    --md-secondary-container: #E8DEF8;
    --md-on-secondary-container: #1D192B;
    
    --md-tertiary: #7D5260;
    --md-on-tertiary: #FFFFFF;
    --md-tertiary-container: #FFD8E4;
    --md-on-tertiary-container: #31111D;
    
    --md-error: #B3261E;
    --md-on-error: #FFFFFF;
    --md-error-container: #F9DEDC;
    --md-on-error-container: #410E0B;
    
    /* Background & Surfaces */
    --bg-primary: #FDFBFF;
    --bg-secondary: #F3F0F5;
    --bg-surface: #FFFFFF;
    --bg-surface-variant: #E7E0EB;
    --bg-card: #FFFFFF;
    --bg-light: #f1f5f9;
    
    /* Neutral / Text */
    --text-primary: #1C1B1F;
    --text-secondary: #49454F;
    --text-muted: #79747E;
    --border: #CAC4D0;
    --border-variant: #E7E0EB;
    
    /* States */
    --hover-overlay: rgba(103, 80, 164, 0.08);
    --focus-overlay: rgba(103, 80, 164, 0.12);
    --pressed-overlay: rgba(103, 80, 164, 0.12);
    
    /* Semantic Colors (SaaS Standard) */
    --success: #2E7D32;
    --warning: #ED6C02;
    --info: #0288D1;
    --danger: #D32F2F;
    --accent: #6750A4;
    --accent-hover: #5a448d;
    
    /* Layout Constants */
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --header-height: 72px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-xl: 28px;
    
    /* Shadows (MUI Elevation) */
    --shadow-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.3);
    --shadow-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.3);
    --shadow-3: 0px 4px 8px 3px rgba(0, 0, 0, 0.15), 0px 1px 3px 0px rgba(0, 0, 0, 0.3);
}

/* RESET & BASE */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar (Light Theme) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* APP LAYOUT */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-variant);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.top-header {
    height: var(--header-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-variant);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 99;
    gap: 24px;
}

.header-search {
    flex: 1;
    max-width: 600px;
    position: relative;
}

.header-search i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.header-search input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-variant);
    background: var(--bg-secondary);
    font-size: 14px;
    transition: all 0.2s;
}

.header-search input:focus {
    background: var(--bg-surface);
    border-color: var(--md-primary);
    box-shadow: var(--shadow-1);
    outline: none;
}

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

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: var(--hover-overlay);
    color: var(--md-primary);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 12px 4px 4px;
    border-radius: var(--radius-xl);
    background: var(--bg-secondary);
    cursor: pointer;
    transition: background 0.2s;
}

.user-chip:hover {
    background: var(--bg-surface-variant);
}

.chip-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--md-primary);
    color: var(--md-on-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
}

.user-chip span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* ALERTS */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}
.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
}
.alert-danger {
    background: #ffebee;
    color: #c62828;
}
.alert-warning {
    background: #fff3e0;
    color: #ef6c00;
}

/* CARDS (MUI Standard) */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-variant);
    box-shadow: var(--shadow-1);
    padding: 24px;
    margin-bottom: 24px;
    transition: box-shadow 0.2s;
}
.card:hover {
    box-shadow: var(--shadow-2);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* BUTTONS (MUI Standard) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: var(--radius-xl);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    gap: 8px;
    text-decoration: none;
}
.btn-primary {
    background: var(--accent) !important;
    color: #FFFFFF !important;
}
.btn-primary:hover {
    background: var(--accent-hover) !important;
    box-shadow: 0 4px 12px rgba(103, 80, 164, 0.35);
}
.btn-secondary {
    background: var(--md-secondary-container) !important;
    color: var(--md-on-secondary-container) !important;
}
.btn-secondary:hover {
    background: var(--bg-surface-variant) !important;
}

/* DATA TABLES */
.table-wrapper {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-variant);
    overflow: hidden;
    box-shadow: var(--shadow-1);
}

.table-toolbar {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-variant);
    gap: 16px;
    flex-wrap: wrap;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--bg-secondary);
    padding: 14px 24px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-variant);
}

.data-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-variant);
    font-size: 14px;
    color: var(--text-primary);
    vertical-align: middle;
}

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

.data-table tr:hover {
    background: var(--hover-overlay);
}

/* PAGINATION */
.pagination {
    padding: 16px 24px;
    display: flex;
    justify-content: center;
    gap: 8px;
    border-top: 1px solid var(--border-variant);
}

.page-link {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-variant);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.page-link:hover {
    background: var(--hover-overlay);
    color: var(--md-primary);
    border-color: var(--md-primary);
}

.page-link.active {
    background: var(--md-primary);
    color: var(--md-on-primary);
    border-color: var(--md-primary);
}

/* FORMS (MODERN CARD) */
.form-card {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-variant);
    box-shadow: var(--shadow-2);
    overflow: hidden;
}

.form-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-variant);
}

.form-body {
    padding: 24px;
}

.form-footer {
    padding: 20px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-variant);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* FORMS (MUI Standard) */
.form-group {
    margin-bottom: 20px;
}
.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}
.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.form-control:hover {
    border-color: var(--text-muted);
}
.form-control:focus {
    outline: none;
    border-color: var(--md-primary);
    box-shadow: 0 0 0 4px var(--md-primary-container);
}

/* Specific Select Styles */
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2379747E' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat !important;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
    background-color: var(--bg-surface);
}
select.form-control:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236750A4' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat !important;
}

/* Select with Icon Wrapper */
.select-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}
.select-with-icon i.leading-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}
.select-with-icon select {
    padding-left: 40px !important;
}

/* DROPDOWNS */
.dropdown-wrapper { position: relative; }
.notif-badge { position: absolute; top: -2px; right: -2px; background: var(--danger); color: white; font-size: 9px; font-weight: 700; width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg-secondary); }

.notif-dropdown-content { position: absolute; right: 0; top: 110%; width: 320px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 200; display: none; overflow: hidden; }
.notif-dropdown-content.show { display: block; }
.notif-dropdown-header { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.notif-dropdown-body { max-height: 400px; overflow-y: auto; }

.notif-drop-item { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; gap: 12px; transition: 0.2s; }
.notif-drop-item:hover { background: var(--bg-hover); }
.notif-drop-item:last-child { border-bottom: none; }
.notif-drop-icon { width: 32px; height: 32px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px; }
.notif-drop-content { flex: 1; }
.notif-drop-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.notif-drop-msg { font-size: 11px; color: var(--text-secondary); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-drop-time { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

.page-content {
    padding: 24px;
    flex: 1;
}

/* SIDEBAR OVERLAY FOR MOBILE */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    display: none;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active {
    display: block;
}

/* SIDEBAR */
.nav-section {
    padding: 24px 24px 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.nav-item {
    display: flex;    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    margin: 4px 12px;
    border-radius: var(--radius-xl);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    position: relative;
}

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

.nav-item:hover {
    background: var(--hover-overlay);
    color: var(--md-primary);
}

.nav-item.active {
    background: var(--md-primary-container);
    color: var(--md-on-primary-container);
}

.nav-badge {
    margin-left: auto;
    background: var(--md-error);
    color: var(--md-on-error);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
}

.sidebar-logo {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--border-variant);
}

.sidebar-logo .logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--md-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--md-on-primary);
}

.sidebar-logo h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-user {
    margin-top: auto;
    padding: 24px;
    border-top: 1px solid var(--border-variant);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--md-secondary-container);
    color: var(--md-on-secondary-container);
    display: flex;    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.sidebar-user .user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-user .user-role {
    font-size: 12px;
    color: var(--text-muted);
}

.logout-link {
    margin-left: auto;
    color: var(--text-muted);
    transition: color 0.2s;
}

.logout-link:hover {
    color: var(--md-error);
}

/* TOPBAR */
.page-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
}

.header-actions {
    margin-left: auto;
    display: flex;
    gap: 10px;
    align-items: center;
}

.icon-btn {
    width: 34px;
    height: 34px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 15px;
    transition: all 0.15s;
    position: relative;
    text-decoration: none;
}

.icon-btn:hover {
    border-color: var(--border-focus);
    color: var(--text-primary);
}

.notif-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 7px;
    height: 7px;
    background: var(--danger);
    border-radius: 50%;
    border: 1.5px solid var(--bg-secondary);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s;
}

.user-chip:hover {
    border-color: var(--border-focus);
}

.user-chip .chip-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4d78ff, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
}

.user-chip span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

/* CARDS */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

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

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* KPI CARDS */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid var(--border-variant);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.06);
    border-color: var(--md-primary-container);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-card.blue .stat-icon { background: #e3f2fd; color: #1976d2; }
.stat-card.green .stat-icon { background: #e8f5e9; color: #2e7d32; }
.stat-card.orange .stat-icon { background: #fff3e0; color: #ef6c00; }
.stat-card.red .stat-icon { background: #ffebee; color: #c62828; }
.stat-card.purple .stat-icon { background: #f3e5f5; color: #7b1fa2; }

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 4px;
}

.stat-card .stat-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.stat-card .stat-trend {
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

/* QUICK ACTIONS */
.quick-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.quick-action-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-variant);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
}

.quick-action-btn:hover {
    background: var(--md-primary-container);
    border-color: var(--md-primary);
    transform: translateY(-2px);
}

.quick-action-btn i {
    font-size: 24px;
    color: var(--md-primary);
    margin-bottom: 12px;
    display: block;
}

.quick-action-btn span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* TABLES */
.table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table-toolbar {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    padding: 11px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.data-table tbody td {
    padding: 13px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: middle;
}

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

.data-table tbody tr:hover td {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* FORMS */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.form-label .req {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background-color: var(--bg-secondary);
    border: 1.5px solid var(--border-variant, #e2e8f0);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
    outline: none;
    font-family: inherit;
}

.form-control:focus {
    background-color: #ffffff;
    border-color: var(--md-primary);
    box-shadow: 0 0 0 4px var(--md-primary-container);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    text-decoration: none;
    font-family: inherit;
    line-height: 1;
}

.btn-primary { background: var(--accent); color: #FFFFFF !important; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(103, 80, 164, 0.35); }
.btn-success { background: var(--success); color: #FFFFFF !important; }
.btn-danger { background: var(--danger); color: #FFFFFF !important; }
.btn-warning { background: var(--warning); color: #1a1a1a; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-secondary); padding: 8px; }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: var(--radius); }

/* BADGES */
.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.badge-success { background: rgba(34, 197, 94, 0.12); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.25); }
.badge-danger { background: rgba(239, 68, 68, 0.12); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.25); }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.25); }
.badge-info { background: rgba(6, 182, 212, 0.12); color: var(--info); border: 1px solid rgba(6, 182, 212, 0.25); }
.badge-primary { background: rgba(77, 120, 255, 0.12); color: var(--accent); border: 1px solid rgba(77, 120, 255, 0.25); }
.badge-purple { background: rgba(139, 92, 246, 0.12); color: var(--purple); border: 1px solid rgba(139, 92, 246, 0.25); }

/* PAGE HEADER */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.page-header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ALERTS */
.alert {
    padding: 11px 14px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 13px;
    border: 1px solid;
}

.alert-success { background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.25); color: var(--success); }
.alert-danger { background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.25); color: var(--danger); }
.alert-warning { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.25); color: var(--warning); }
.alert-info { background: rgba(6, 182, 212, 0.08); border-color: rgba(6, 182, 212, 0.25); color: var(--info); }

/* MODAL */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: #ffffff;
    border: 1px solid var(--border-variant);
    border-radius: 24px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.modal-box .form-control {
    background-color: #f1f5f9;
    border: 1.5px solid #e2e8f0;
}

.modal-box .form-control:focus {
    background-color: #ffffff;
    border-color: var(--md-primary);
}

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

.modal-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 18px;
    background: none;
    border: none;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.15s;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* GRID SYSTEM */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -12px;
    margin-left: -12px;
}
.row > [class*="col-"] {
    padding-right: 12px;
    padding-left: 12px;
    width: 100%;
}
.col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
.col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.col-9 { flex: 0 0 75%; max-width: 75%; }
.col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
.col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

@media (min-width: 768px) {
    .col-md-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .col-md-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-md-3 { flex: 0 0 25%; max-width: 25%; }
    .col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-md-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .col-md-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-md-9 { flex: 0 0 75%; max-width: 75%; }
    .col-md-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .col-md-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .col-md-12 { flex: 0 0 100%; max-width: 100%; }
}

@media (min-width: 992px) {
    .col-lg-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .col-lg-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
    .col-lg-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-lg-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
    .col-lg-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .col-lg-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-lg-9 { flex: 0 0 75%; max-width: 75%; }
    .col-lg-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .col-lg-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .col-lg-12 { flex: 0 0 100%; max-width: 100%; }
}

.g-1 { margin-right: -4px; margin-left: -4px; } .g-1 > [class*="col-"] { padding-right: 4px; padding-left: 4px; }
.g-2 { margin-right: -8px; margin-left: -8px; } .g-2 > [class*="col-"] { padding-right: 8px; padding-left: 8px; }
.g-3 { margin-right: -12px; margin-left: -12px; } .g-3 > [class*="col-"] { padding-right: 12px; padding-left: 12px; }
.g-4 { margin-right: -16px; margin-left: -16px; } .g-4 > [class*="col-"] { padding-right: 16px; padding-left: 16px; }
.g-5 { margin-right: -24px; margin-left: -24px; } .g-5 > [class*="col-"] { padding-right: 24px; padding-left: 24px; }

.grid-70-30 {
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: 24px;
}
.grid-60-40 {
    display: grid;
    grid-template-columns: 6fr 4fr;
    gap: 24px;
}

@media (max-width: 992px) {
    .grid-70-30, .grid-60-40 {
        grid-template-columns: 1fr;
    }
}

/* TRUNCATE */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* POS RESPONSIVE IMPROVEMENTS */
.pos-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .pos-table th:nth-child(3), 
    .pos-table td:nth-child(3),
    .pos-table th:nth-child(4),
    .pos-table td:nth-child(4) {
        display: none; /* Hide quantity and unit price on very small screens or make them stack */
    }
    
    .pos-product-info .sku {
        display: none;
    }
}

/* INVOICE RESPONSIVE */
@media (max-width: 768px) {
    .invoice-card {
        padding: 20px;
    }
    .invoice-header {
        flex-direction: column;
        text-align: left;
    }
    .invoice-header .text-end {
        text-align: left;
        margin-top: 20px;
    }
    .summary-table {
        width: 100%;
        margin-left: 0;
    }
    .invoice-table {
        display: block;
        overflow-x: auto;
    }
}

/* GENERAL RESPONSIVE FIXES */
@media (max-width: 576px) {
    .d-flex.justify-between.align-center {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .d-flex.gap-3 {
        width: 100%;
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}




.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 24px; }
.bg-light { background-color: var(--bg-light) !important; }
.bg-secondary { background-color: var(--bg-secondary) !important; }
.bg-white { background-color: #ffffff !important; }

.d-flex { display: flex; } 
.flex-column { flex-direction: column; }
.h-100 { height: 100%; }
.align-center { align-items: center; } 
.justify-between { justify-content: space-between; } 
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .w-100 { width: 100%; } .text-center { text-align: center; }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); } .text-muted { color: var(--text-muted); }
.fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.fs-12 { font-size: 12px; } .fs-13 { font-size: 13px; } .fs-16 { font-size: 16px; } .fs-20 { font-size: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }

.empty-state {
    text-align: center;
    padding: 48px 20px;
}

.empty-state .empty-icon {
    font-size: 36px;
    margin-bottom: 10px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 13px;
}

.badge-muted { background: var(--bg-hover); color: var(--text-muted); }

/* POS / BILLING - REFINED */
.pos-workspace {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 0;
    margin: -24px;
    height: calc(100vh - var(--header-height));
    background: #f8f9fa;
    overflow: hidden;
}

.pos-left {
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #f4f6f8;
}

.pos-right {
    background: var(--bg-surface);
    border-left: 1px solid var(--border-variant);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    box-shadow: -4px 0 16px rgba(0,0,0,0.03);
    z-index: 10;
    overflow: hidden;
}

.pos-header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 200px;
    gap: 16px;
    background: var(--bg-surface);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border-variant);
    box-shadow: var(--shadow-1);
}

.pos-cart-container {
    background: var(--bg-surface);
    border-radius: 16px;
    border: 1px solid var(--border-variant);
    box-shadow: var(--shadow-1);
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

.pos-table th {
    padding: 16px 24px;
    background: #fcfcfd;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-variant);
}

.pos-table td {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-variant);
    vertical-align: middle;
}

.pos-product-info .name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 2px;
}
.pos-product-info .sku {
    font-size: 11px;
    color: var(--text-muted);
}

.qty-control {
    display: flex;
    align-items: center;
    background: #f1f3f5;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}
.qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--bg-surface);
    color: var(--md-primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.qty-btn:hover { background: var(--md-primary); color: white; }
.qty-input {
    width: 45px;
    border: none;
    background: transparent;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
}

.pos-right form {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}
.pos-summary-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-variant);
    flex-shrink: 0;
}
.pos-summary-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
.pos-summary-footer {
    padding: 24px;
    border-top: 1px solid var(--border-variant);
    background: #fcfcfd;
    flex-shrink: 0;
}

.payment-type-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.payment-type-btn {
    padding: 12px;
    border-radius: 12px;
    border: 2px solid #e9ecef;
    background: var(--bg-surface);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}
/* RESPONSIVE DESIGN */

/* Desktop Collapsed Sidebar */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}
.sidebar.collapsed .sidebar-logo h2,
.sidebar.collapsed .sidebar-logo div,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .sidebar-user div,
.sidebar.collapsed .sidebar-user .logout-link {
    display: none;
}
.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px;
}
.main-content.expanded {
    margin-left: var(--sidebar-collapsed-width);
}

/* Tablet (Large) */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 240px;
    }
    
    .pos-workspace {
        grid-template-columns: 1fr 320px;
    }
    
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile Toggle - Default Hidden */
#mobile-toggle {
    display: none;
}

/* Tablet & Mobile (Standard) */
@media (max-width: 992px) {
    #mobile-toggle {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 280px;
    }

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

    .main-content {
        margin-left: 0 !important;
    }

    .header-search {
        display: none; /* Hide search on smaller screens or make it an icon */
    }

    .pos-workspace {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }

    .pos-right {
        border-left: none;
        border-top: 1px solid var(--border-variant);
        position: sticky;
        bottom: 0;
        max-height: 80vh;
    }

    .pos-left {
        height: auto;
    }

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

    .form-row, .form-row-3 {
        grid-template-columns: 1fr;
    }
}

/* Mobile (Small) */
@media (max-width: 600px) {
    .top-header {
        padding: 0 16px;
        gap: 12px;
    }

    .header-actions .icon-btn:not(:first-child), 
    .header-actions .user-chip span {
        display: none;
    }

    .user-chip {
        padding: 4px;
    }

    .page-content {
        padding: 16px;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .table-toolbar .d-flex {
        flex-direction: column;
        width: 100%;
    }

    .table-toolbar .btn {
        width: 100%;
        justify-content: center;
    }

    .data-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .modal-box {
        width: 95%;
        padding: 16px;
    }

    .pos-header-actions {
        grid-template-columns: 1fr;
    }
}

/* ENHANCED FORM STYLES */
.form-section-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--md-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.form-section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-variant);
}

.input-group-modern {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.2s;
}
.input-group-modern:focus-within {
    border-color: var(--md-primary);
    background: var(--bg-surface);
    box-shadow: 0 0 0 4px var(--md-primary-container);
}
.input-group-modern .leading-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}
.input-group-modern .form-control {
    border: none !important;
    background: transparent !important;
    padding-left: 44px !important;
    box-shadow: none !important;
}

.image-upload-wrapper {
    width: 100%;
    height: 180px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-secondary);
    overflow: hidden;
    position: relative;
}
.image-upload-wrapper:hover {
    border-color: var(--md-primary);
    background: var(--md-primary-container);
}
.image-upload-wrapper i {
    font-size: 32px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.image-upload-wrapper p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}
.image-upload-wrapper img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pricing-card {
    background: linear-gradient(135deg, var(--md-primary-container) 0%, #f3e5f5 100%);
    border: 1px solid rgba(103, 80, 164, 0.1);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.input-group-modern .btn-inline {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 12px;
    font-size: 11px;
    height: auto;
    border-radius: var(--radius-md);
    background: var(--md-primary-container);
    color: var(--md-primary);
}
.input-group-modern .btn-inline:hover {
    background: var(--md-primary);
    color: white;
}

.barcode-preview-box {
    background: white;
    border: 1px solid var(--border-variant);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}
.barcode-preview-box .barcode-text {
    font-family: 'Libre Barcode 39', 'IDAutomationHC39M', 'Courier New', Courier, monospace;
    font-size: 48px;
    margin-bottom: 8px;
}
.barcode-preview-box .barcode-value {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 2px;
}

/* Fixed Footer for Actions */
.form-footer-sticky {
    position: sticky;
    bottom: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-variant);
    padding: 20px 0;
    margin-top: 40px;
    z-index: 10;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.03);
}

/* DASHBOARD TABLE SPECIFIC */
.dashboard-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: -8px;
}
.dashboard-table th {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    background: transparent;
}
.dashboard-table td {
    padding: 12px;
    background: var(--bg-secondary);
    border: none;
    font-size: 13px;
}
.dashboard-table td:first-child {
    border-radius: 8px 0 0 8px;
}
.dashboard-table td:last-child {
    border-radius: 0 8px 8px 0;
}
.dashboard-table tr:hover td {
    background: var(--bg-surface-variant);
}

/* UTILITIES */


/* Utilities for Responsive Visibility */
.show-mobile {
    display: none;
}

.payment-type-btn.active {
    border-color: var(--md-primary);
    background: var(--md-primary-container);
    color: var(--md-primary);
}

.payment-type-btn i { font-size: 18px; margin-bottom: 4px; display: block; }
.payment-type-btn span { font-size: 12px; font-weight: 700; text-transform: uppercase; }

.summary-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    margin-top: 20px;
}
.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}
.summary-line.total {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #dee2e6;
    font-size: 22px;
    font-weight: 800;
    color: var(--md-primary);
}

.received-input-wrapper {
    background: #fff;
    border: 2px solid var(--md-primary);
    border-radius: 12px;
    padding: 12px 16px;
    margin-top: 20px;
}
.received-input-wrapper label {
    font-size: 11px;
    font-weight: 700;
    color: var(--md-primary);
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
}
.received-input-wrapper input {
    border: none;
    width: 100%;
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    outline: none;
}

.change-amount-box {
    background: #e7f5ff;
    border-radius: 12px;
    padding: 12px 16px;
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.change-amount-box span { font-size: 13px; font-weight: 600; color: #1971c2; }
.change-amount-box .amount { font-size: 18px; font-weight: 800; }

.quick-pick-section {
    background: var(--bg-surface);
    border-radius: 16px;
    border: 1px solid var(--border-variant);
    padding: 20px;
}
.quick-pick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}
.quick-item {
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.quick-item:hover {
    border-color: var(--md-primary);
    background: var(--md-primary-container);
}
.quick-item .name { font-size: 11px; font-weight: 600; color: var(--text-primary); }


/* ============================================================
   MOBILE RESPONSIVENESS — Consolidated & Complete
   ============================================================ */

/* --- 768px and below --- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }
    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }

    .top-header {
        padding: 0 16px;
    }

    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }

    .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .form-row, .form-row-3 {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .pos-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .pos-sidebar {
        border-left: none;
        border-top: 1px solid var(--border-variant);
    }

    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 600px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-header .btn {
        width: 100%;
    }

    /* Overlay for sidebar */
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    /* Modal improvements */
    .modal-box {
        margin: 12px;
        width: calc(100% - 24px);
        max-height: calc(100vh - 24px);
        overflow-y: auto;
    }

    /* Card padding reduce */
    .card {
        padding: 14px;
    }

    /* Page header actions stack */
    .page-header-actions {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }
    .page-header-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Hide mobile utility */
    .hide-mobile {
        display: none !important;
    }
    .show-mobile {
        display: block !important;
    }
}

/* === RESPONSIVE OVERRIDES === */

/* --- 1200px: large screens --- */
@media (max-width: 1200px) {
    .stat-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- 992px: tablets --- */
@media (max-width: 992px) {
    .top-header {
        height: 60px;
    }

    .page-breadcrumb {
        font-size: 12px;
    }

    .page-breadcrumb .text-muted {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 200px;
    }

    .card {
        padding: 14px;
    }

    .stat-card .stat-value {
        font-size: 22px;
    }

    .stat-card .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .data-table {
        min-width: 550px;
    }

    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* --- 600px: small mobiles --- */
@media (max-width: 600px) {
    .top-header {
        height: 56px;
        padding: 0 12px;
        gap: 8px;
    }

    .page-breadcrumb {
        display: none;
    }

    .page-title, h1.fw-800 {
        font-size: 18px;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-card .stat-value {
        font-size: 20px;
    }

    /* Bottom-sheet style modals */
    .modal-overlay {
        align-items: flex-end;
    }
    .modal-box {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
        overflow-y: auto;
        padding: 20px 16px;
    }

    /* Tables */
    .data-table {
        font-size: 12px;
    }
    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }

    /* Buttons */
    .btn {
        font-size: 12px;
        padding: 8px 12px;
    }
    .btn-sm {
        font-size: 11px;
        padding: 6px 10px;
    }

    /* Touch-friendly nav items */
    .nav-item a {
        min-height: 44px;
    }

    /* Compact modal close */
    .modal-close {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* --- 480px: very small phones --- */
@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .card {
        padding: 12px;
        box-shadow: none;
        border: 1px solid var(--border-variant);
    }

    .form-control, select.form-control, textarea.form-control {
        padding: 8px 10px;
        font-size: 14px;
    }

    .form-label {
        font-size: 11px;
    }

    .modal-box {
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-height: 100vh;
        margin: 0;
    }

    .modal-overlay {
        align-items: flex-start;
    }

    .nav-item a {
        padding: 10px 16px;
    }

    .data-table {
        min-width: 480px;
        font-size: 11px;
    }

    .page-content {
        padding: 12px;
    }

    .table-toolbar {
        gap: 8px;
    }
}

/* --- Landscape orientation on short screens --- */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        width: 220px;
    }

    .top-header {
        height: 50px;
    }

    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* --- POS Mobile: Cart panel toggle --- */
@media (max-width: 992px) {
    .pos-workspace {
        position: relative;
    }

    .pos-right {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 65vh;
        z-index: 150;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(0,0,0,0.18);
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        background: var(--bg-surface);
    }

    .pos-right.cart-open {
        transform: translateY(0);
    }

    .pos-left {
        padding-bottom: 80px;
    }

    /* Cart drag handle */
    .cart-drag-handle {
        display: flex;
        justify-content: center;
        padding: 10px;
        cursor: pointer;
    }
    .cart-drag-handle::before {
        content: '';
        width: 40px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
    }

    /* FAB toggle button */
    .pos-cart-fab {
        display: flex;
        position: fixed;
        bottom: 24px;
        right: 24px;
        z-index: 200;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--md-primary);
        color: white;
        border: none;
        box-shadow: var(--shadow-lg);
        align-items: center;
        justify-content: center;
        font-size: 20px;
        cursor: pointer;
        transition: all 0.2s;
    }
    .pos-cart-fab:hover {
        transform: scale(1.08);
        background: var(--md-primary-dark, #5940a0);
    }
    .pos-cart-fab .fab-badge {
        position: absolute;
        top: 6px;
        right: 6px;
        background: #f44336;
        color: white;
        border-radius: 50%;
        width: 18px;
        height: 18px;
        font-size: 10px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .pos-cart-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 140;
    }
    .pos-cart-overlay.active {
        display: block;
    }
}

@media (min-width: 993px) {
    .pos-cart-fab {
        display: none;
    }
    .pos-cart-overlay {
        display: none !important;
    }
    .cart-drag-handle {
        display: none;
    }
}
