/* CSS Styling - Dark Glassmorphism Design System */
:root {
    color-scheme: dark;
    --bg-primary: #0a0d16;
    --bg-secondary: #111625;
    --accent-blue: #00c2ff;
    --accent-purple: #9d4edd;
    --accent-green: #06d6a0;
    --accent-orange: #ffb703;
    --accent-red: #ff4d6d;
    --text-primary: #f8f9fa;
    --text-muted: #8b9bb4;
    --border-color: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-blur: blur(16px);
    --shadow-glow: 0 0 20px rgba(0, 194, 255, 0.15);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --shadow-panel: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --modal-overlay-bg: rgba(0, 0, 0, 0.7);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    overflow-x: hidden;
    height: 100vh;
}

body.dark-mode {
    background-color: var(--bg-primary);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.01);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

/* Glassmorphism utility panel */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-panel);
}

/* Buttons */
button {
    font-family: var(--font-heading);
    font-weight: 500;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), #0072ff);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-glow {
    position: relative;
    overflow: hidden;
}
.btn-glow::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}
.btn-glow:hover::after {
    opacity: 1;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 8px;
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-green), #039f76);
    color: white;
    padding: 14px 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 16px;
    width: 100%;
}
.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(6, 214, 160, 0.3);
}
.btn-success:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-logout {
    background: transparent;
    color: var(--accent-red);
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    width: 100%;
    border-radius: 8px;
}
.btn-logout:hover {
    background: rgba(255, 77, 109, 0.08);
}

/* Authentication Screen */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: radial-gradient(circle at 10% 20%, rgb(17, 22, 37) 0%, rgb(10, 13, 22) 90.2%);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo-badge {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 194, 255, 0.2), rgba(157, 78, 221, 0.2));
    border: 1px solid rgba(0, 194, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
}

.glow-icon {
    font-size: 28px;
    color: var(--accent-blue);
    text-shadow: 0 0 15px var(--accent-blue);
}

.auth-header h2 {
    font-family: var(--font-heading);
    font-size: 24px;
    margin-bottom: 5px;
}

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

/* Inputs & Form Groups */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 12px 16px;
    font-family: var(--font-body);
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(0, 194, 255, 0.15);
}

.input-readonly {
    background: rgba(255, 255, 255, 0.01) !important;
    border-color: rgba(255, 255, 255, 0.04) !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
}

.input-with-button {
    display: flex;
    gap: 10px;
}
.input-with-button input {
    flex: 1;
}

/* Main Layout */
.app-layout {
    display: flex;
    height: 100vh;
}

.app-sidebar {
    width: 260px;
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-left: none;
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.brand-icon {
    font-size: 24px;
    color: var(--accent-blue);
}

.brand-text h1 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
}
.brand-text span {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    margin-bottom: 30px;
}

.profile-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(157, 78, 221, 0.15);
    border: 1px solid rgba(157, 78, 221, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-purple);
    font-size: 18px;
}

.profile-info h3 {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
}
.profile-info span {
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
}

.sidebar-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-nav li a {
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-weight: 500;
    transition: all 0.3s;
}

.sidebar-nav li:hover a {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-nav li.active a {
    color: var(--accent-blue);
    background: rgba(0, 194, 255, 0.08);
    border-left: 3px solid var(--accent-blue);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* App Content Area */
.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.content-header {
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    margin-bottom: 2px;
}

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

.status-badge {
    background: rgba(6, 214, 160, 0.08);
    color: var(--accent-green);
    border: 1px solid rgba(6, 214, 160, 0.15);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
}

/* App Screens */
.app-screen {
    padding: 40px;
    animation: fadeIn 0.4s ease-out;
}

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

.hidden {
    display: none !important;
}

/* Dashboard screen specific styles */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    padding: 24px;
    transition: all 0.3s;
}
.metric-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.15);
}

.card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 15px;
}
.card-icon.blue { background: rgba(0, 194, 255, 0.1); color: var(--accent-blue); }
.card-icon.purple { background: rgba(157, 78, 221, 0.1); color: var(--accent-purple); }
.card-icon.yellow { background: rgba(255, 183, 3, 0.1); color: var(--accent-orange); }
.card-icon.green { background: rgba(6, 214, 160, 0.1); color: var(--accent-green); }
.card-icon.orange { background: rgba(255, 183, 3, 0.15); color: var(--accent-orange); }
.card-icon.red { background: rgba(255, 77, 109, 0.1); color: var(--accent-red); }

.card-value {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 4px;
}

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

.dashboard-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.details-column {
    padding: 30px;
}

.column-header {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.column-header h3 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.empty-message {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

/* Progress Bars */
.progress-bar-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 500;
}
.progress-info .label {
    font-family: var(--font-heading);
}

.progress-track {
    height: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    border-radius: 4px;
    width: 0;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.green {
    background: linear-gradient(90deg, var(--accent-green), #039f76);
}

/* Scanning Screen Layout */
.scan-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 30px;
}

.scan-form-container {
    padding: 30px;
}

.qty-panel {
    padding: 30px;
    transition: all 0.3s;
}

.qty-panel.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.required-star {
    color: var(--accent-red);
}

/* Preview Card Details */
.scan-preview-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 24px;
    margin-top: 24px;
    animation: slideUp 0.3s ease-out;
}

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

.preview-validation-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.validation-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.validation-icon.valid {
    background: rgba(6, 214, 160, 0.15);
    color: var(--accent-green);
}
.validation-icon.invalid {
    background: rgba(255, 77, 109, 0.15);
    color: var(--accent-red);
}

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

.preview-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.preview-item label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}
.preview-item span {
    font-size: 14px;
    font-weight: 500;
}

/* Registry Screen search styles */
.search-panel {
    padding: 24px 30px;
    margin-bottom: 24px;
}

.search-form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 20px;
    align-items: flex-end;
}

.search-actions {
    display: flex;
    gap: 10px;
}
.search-actions button {
    flex: 1;
}

/* Data Table Styles */
.table-container {
    overflow-x: auto;
}

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

.data-table th {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.data-table tbody tr {
    transition: background-color 0.2s;
}
.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge.created { background: rgba(0, 194, 255, 0.1); color: var(--accent-blue); }
.badge.inprogress { background: rgba(157, 78, 221, 0.1); color: var(--accent-purple); }
.badge.finished { background: rgba(6, 214, 160, 0.1); color: var(--accent-green); }
.badge.cancelled { background: rgba(255, 77, 109, 0.1); color: var(--accent-red); }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--modal-overlay-bg);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.25s;
}

.modal-content {
    width: 100%;
    max-width: 600px;
    padding: 30px;
    border-radius: 20px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.selector-modal-content {
    max-width: 500px;
}

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

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
}

.btn-close-modal,
.btn-close-selector-modal {
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
}
.btn-close-modal:hover,
.btn-close-selector-modal:hover {
    color: var(--text-primary);
}

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

.roll-meta-summary {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 20px;
    font-size: 13px;
}

/* Timeline/History visualization */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 4px;
    width: 2px;
    height: calc(100% - 10px);
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-marker {
    position: absolute;
    top: 5px;
    left: -24px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--accent-blue);
    border: 2px solid var(--bg-secondary);
}

.timeline-marker.has-loss {
    background-color: var(--accent-red);
}

.timeline-content {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 8px;
}

.timeline-header h4 {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.timeline-header span {
    color: var(--text-muted);
}

.timeline-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    font-size: 12px;
    margin-bottom: 8px;
}

.timeline-remarks {
    font-size: 12px;
    font-style: italic;
    color: var(--text-muted);
    border-top: 1px dashed var(--border-color);
    padding-top: 6px;
    margin-top: 6px;
}

/* Selector List Modal simulation */
.selector-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.selector-item {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    transition: all 0.2s;
}
.selector-item:hover {
    background: rgba(0, 194, 255, 0.05);
    border-color: var(--accent-blue);
}

/* Alert popups */
.error-alert {
    background: rgba(255, 77, 109, 0.12);
    color: var(--accent-red);
    border: 1px solid rgba(255, 77, 109, 0.25);
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

/* ====================================================
   LIGHT THEME SUPPORT
   ==================================================== */

/* Smooth transitions for theme switching */
body, aside, main, header, div, .glass-panel, input, select, textarea, td, th, a, button {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Light mode overrides */
body.light-mode {
    color-scheme: light;
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --accent-blue: #0284c7;
    --accent-purple: #7c3aed;
    --accent-green: #059669;
    --accent-orange: #d97706;
    --accent-red: #dc2626;
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --border-color: rgba(15, 23, 42, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-blur: blur(20px);
    --shadow-glow: 0 0 20px rgba(2, 132, 199, 0.15);
    --shadow-panel: 0 8px 32px 0 rgba(15, 23, 42, 0.08);
    --modal-overlay-bg: rgba(15, 23, 42, 0.4);
}

body.light-mode .auth-container {
    background: radial-gradient(circle at 10% 20%, #f1f5f9 0%, #e2e8f0 90%);
}

body.light-mode .form-group input,
body.light-mode .form-group select,
body.light-mode .form-group textarea {
    background: rgba(15, 23, 42, 0.02);
    color: var(--text-primary);
}

body.light-mode .form-group input:focus,
body.light-mode .form-group select:focus,
body.light-mode .form-group textarea:focus {
    background: rgba(15, 23, 42, 0.04);
}

body.light-mode .input-readonly {
    background: rgba(15, 23, 42, 0.01) !important;
}

body.light-mode .sidebar-nav li:hover a {
    background: rgba(15, 23, 42, 0.03);
}

body.light-mode .sidebar-nav li.active a {
    background: rgba(2, 132, 199, 0.08);
}

body.light-mode .data-table tbody tr:hover {
    background-color: rgba(15, 23, 42, 0.015);
}

body.light-mode .timeline-content {
    background: rgba(15, 23, 42, 0.01);
}

body.light-mode .selector-item {
    background: rgba(15, 23, 42, 0.015);
}

body.light-mode .selector-item:hover {
    background: rgba(2, 132, 199, 0.05);
}

/* Theme Toggle Button */
.btn-theme-toggle {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s;
}

.btn-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

body.light-mode .btn-theme-toggle {
    background: rgba(15, 23, 42, 0.05);
    color: var(--text-primary);
    border-color: var(--border-color);
}

body.light-mode .btn-theme-toggle:hover {
    background: rgba(15, 23, 42, 0.1);
}

/* Explicitly style option dropdown elements for default dark mode */
select option {
    background-color: #111625; /* Matches --bg-secondary (dark blue-gray) */
    color: #f8f9fa;            /* Matches --text-primary (white) */
}

/* Override option styling when light mode is active */
body.light-mode select option {
    background-color: #ffffff; /* Matches --bg-secondary (white) */
    color: #0f172a;            /* Matches --text-primary (dark slate) */
}

/* QR Code Printable Sheet & Card Styling */
.qr-printable-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 16px;
}

.qr-printable-card-item {
    background: #ffffff;
    color: #0f172a;
    border: 2px solid #94a3b8;
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    break-inside: avoid;
    page-break-inside: avoid;
}

/* ====================================================
   MOBILE RESPONSIVE DESIGN
   ==================================================== */

/* Hamburger Toggle Button (hidden on desktop) */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1100;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 20px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-panel);
    transition: all 0.3s;
}
.mobile-menu-toggle:hover {
    background: rgba(0, 194, 255, 0.12);
    border-color: var(--accent-blue);
}

/* Sidebar Backdrop (hidden on desktop) */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* ========== TABLET BREAKPOINT (max-width: 1024px) ========== */
@media (max-width: 1024px) {
    .app-sidebar {
        width: 220px;
        padding: 20px 16px;
    }

    .app-screen {
        padding: 24px;
    }

    .content-header {
        padding: 16px 24px;
    }

    .dashboard-details {
        grid-template-columns: 1fr;
        gap: 20px;
    }

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

    .search-form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ========== MOBILE BREAKPOINT (max-width: 768px) ========== */
@media (max-width: 768px) {

    /* -- Show hamburger toggle -- */
    .mobile-menu-toggle {
        display: flex;
    }

    .sidebar-backdrop {
        display: block;
    }

    /* -- Sidebar becomes slide-over drawer -- */
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        z-index: 1050;
        border-radius: 0;
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 24px 20px;
        overflow-y: auto;
    }
    .app-sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar-brand {
        margin-bottom: 24px;
    }

    .user-profile {
        margin-bottom: 20px;
        padding: 12px;
    }

    .sidebar-nav li a {
        padding: 12px 14px;
        font-size: 14px;
    }

    /* -- Main Content takes full width -- */
    .app-layout {
        flex-direction: column;
    }

    .app-content {
        width: 100%;
        min-height: 100vh;
    }

    /* -- Content Header adjustments -- */
    .content-header {
        padding: 16px 16px 16px 64px; /* left padding to avoid hamburger overlap */
        flex-wrap: wrap;
        gap: 10px;
    }

    .header-title h2 {
        font-size: 16px;
    }

    .header-title p {
        font-size: 11px;
    }

    /* -- All app-screen sections -- */
    .app-screen {
        padding: 16px;
    }

    /* -- Metric Cards Grid -- */
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 20px;
    }

    .metric-card {
        padding: 16px;
    }

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

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

    .card-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
        margin-bottom: 10px;
    }

    /* -- Dashboard Two-Column -> Stack -- */
    .dashboard-details {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .details-column {
        padding: 20px;
    }

    .column-header h3 {
        font-size: 14px;
    }

    /* -- QR Scan & Move Grid -> Stack -- */
    .scan-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .scan-form-container {
        padding: 20px;
    }

    .qty-panel {
        padding: 20px;
    }

    /* -- Preview Grid -> Stack -- */
    .preview-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* -- Registry Search Grid -> Stack -- */
    .search-panel {
        padding: 16px;
        margin-bottom: 16px;
    }

    .search-form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .search-actions {
        flex-direction: row;
    }

    /* -- Data Tables: horizontal scroll with touch hint -- */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 12px;
        white-space: nowrap;
    }

    /* -- Modals: full screen on mobile -- */
    .modal-overlay {
        align-items: flex-end; /* slide up from bottom */
        padding: 0;
    }

    .modal-content {
        max-width: 100% !important;
        width: 100% !important;
        border-radius: 20px 20px 0 0;
        max-height: 92vh;
        padding: 20px 16px;
    }

    .selector-modal-content {
        max-width: 100% !important;
    }

    .modal-header h2 {
        font-size: 16px;
    }

    .modal-body {
        padding-right: 0;
    }

    /* -- Cutting Modal inner grids -> stack -- */
    .modal-content .form-group {
        margin-bottom: 12px;
    }

    /* -- Roll Meta Summary -> stack -- */
    .roll-meta-summary {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    /* -- Timeline details grid -> stack -- */
    .timeline-details {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    /* -- Buttons: larger tap targets on mobile -- */
    .btn-primary,
    .btn-secondary,
    .btn-success {
        padding: 12px 18px;
        font-size: 14px;
        min-height: 44px;
    }

    /* -- Form Inputs: larger touch targets -- */
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px 14px;
        font-size: 15px;
        min-height: 44px;
    }

    /* -- QR Printable Grid: 1 column on mobile -- */
    .qr-printable-grid-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* -- Auth Card: less padding -- */
    .auth-card {
        padding: 28px 20px;
    }

    .auth-header h2 {
        font-size: 20px;
    }

    /* -- Status badge -- */
    .status-badge {
        font-size: 11px;
        padding: 4px 10px;
    }

    /* -- Inline flex/grid overrides for deeply nested inline styles -- */
    /* Cutting modal inner grid (PO/Color selection) */
    #cutting-modal [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Reports filter grid */
    [style*="grid-template-columns: repeat(4, 1fr)"] {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Charts grid */
    [style*="grid-template-columns: 1fr 1fr"][style*="gap: 30px"] {
        grid-template-columns: 1fr !important;
    }

    /* QR Preview modal: single-column info grid */
    .qr-printable-card-single [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Bulk print header: stack vertically */
    #qr-bulk-print-modal [style*="justify-content: space-between"][style*="align-items: center"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    /* Bulk action toolbar: stack vertically */
    .glass-panel[style*="justify-content: space-between"][style*="flex-wrap: wrap"] {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ========== SMALL MOBILE BREAKPOINT (max-width: 480px) ========== */
@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .metric-card {
        padding: 14px;
        display: flex;
        align-items: center;
        gap: 14px;
    }

    .card-icon {
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .card-value {
        font-size: 20px;
        margin-bottom: 0;
    }

    .card-label {
        font-size: 10px;
    }

    .content-header {
        padding: 12px 12px 12px 60px;
    }

    .app-screen {
        padding: 12px;
    }

    .header-title h2 {
        font-size: 14px;
    }

    .details-column {
        padding: 16px;
    }

    .auth-card {
        padding: 24px 16px;
    }

    .logo-badge {
        width: 52px;
        height: 52px;
    }

    .glow-icon {
        font-size: 22px;
    }

    .auth-header h2 {
        font-size: 18px;
    }

    /* Reports filter -> 1 column */
    [style*="grid-template-columns: repeat(4, 1fr)"] {
        grid-template-columns: 1fr !important;
    }

    /* Cutting modal: full stacking */
    #cutting-modal .modal-content {
        padding: 16px 12px;
    }

    /* Small bundle split row: stack */
    [style*="display: flex"][style*="gap: 15px"][style*="align-items: flex-end"] {
        flex-direction: column !important;
        align-items: stretch !important;
    }
}

