/* ============================================================
   Mishri Footwear Factory Management System - Stylesheet
   ============================================================ */

/* ─── Design Tokens ─────────────────────────────────────────── */
:root {
    --surface-0: #f8f9fa;
    --surface-1: #f1f3f5;
    --surface-2: #ffffff;
    --surface-3: #ffffff;
    --border: #dee2e6;
    --border-accent: #4f46e5;
    --border-danger: #e53e3e;
    --border-warning: #d97706;

    --text-primary: #1a1a2e;
    --text-secondary: #495057;
    --text-muted: #868e96;
    --text-accent: #4f46e5;
    --text-success: #059669;
    --text-warning: #d97706;
    --text-danger: #e53e3e;

    --fill-accent: #4f46e5;
    --fill-success: #059669;
    --fill-danger: #e53e3e;
    --fill-warning: #d97706;
    --bg-accent: rgba(79,70,229,0.08);
    --bg-success: rgba(5,150,105,0.08);
    --bg-danger: rgba(229,62,62,0.08);
    --bg-warning: rgba(217,119,6,0.08);

    --on-accent: #ffffff;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
    --transition: 0.2s ease;

    --sidebar-width: 240px;
    --header-height: 0px;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--surface-0);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    max-width: 100%;
}

a { color: var(--text-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Login Page ────────────────────────────────────────────── */
@keyframes loginFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    position: relative;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(139,92,246,0.10) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 0%, rgba(79,70,229,0.06) 0%, transparent 50%);
    pointer-events: none;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 40px 36px 32px;
    box-shadow:
        0 1px 2px rgba(0,0,0,0.04),
        0 8px 24px rgba(0,0,0,0.06),
        0 32px 64px rgba(0,0,0,0.08);
    text-align: center;
    animation: loginFadeIn 0.5s ease-out;
}

.login-brand {
    margin-bottom: 28px;
}

.login-logo {
    font-size: 44px;
    margin-bottom: 16px;
    display: inline-block;
    line-height: 1;
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #0f172a;
    letter-spacing: -0.03em;
}

.login-subtitle {
    font-size: 14px;
    color: #64748b;
    font-weight: 400;
    margin: 0;
}

/* Error */
.login-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    margin-bottom: 20px;
    animation: loginFadeIn 0.3s ease-out;
}

.login-error svg { flex-shrink: 0; }

/* Form */
.login-form {
    text-align: left;
}

.login-field {
    margin-bottom: 16px;
}

.login-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.login-field input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    font-family: var(--font-sans);
    color: #0f172a;
    background: #f8fafc;
    outline: none;
    transition: all 0.2s ease;
}

.login-field input::placeholder {
    color: #94a3b8;
}

.login-field input:focus {
    border-color: #6366f1;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.login-field input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0px 1000px #f8fafc inset;
    -webkit-text-fill-color: #0f172a;
}

/* Submit button */
.login-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    margin-top: 8px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-sans);
    color: white;
    background: #6366f1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.login-btn:hover {
    background: #4f46e5;
    box-shadow: 0 4px 16px rgba(99,102,241,0.3);
}

.login-btn:active {
    transform: scale(0.98);
}

.login-btn-arrow {
    transition: transform 0.2s ease;
}

.login-btn:hover .login-btn-arrow {
    transform: translateX(3px);
}

/* Footer */
.login-footer {
    margin-top: 24px;
    font-size: 12px;
    color: #94a3b8;
}

/* ─── App Layout ────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
    max-width: 100%;
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface-2);
    border-right: 0.5px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 12px;
    border-bottom: 0.5px solid var(--border);
}

.logo {
    font-size: 28px;
}

.brand-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-accent);
}

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

.sidebar-toggle {
    display: none;
    margin-left: auto;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
    border-left: 3px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
}

.nav-item:hover {
    background: var(--bg-accent);
    color: var(--text-accent);
    text-decoration: none;
}

.nav-item.active {
    background: var(--bg-accent);
    color: var(--text-accent);
    border-left-color: var(--fill-accent);
    font-weight: 500;
}

.nav-icon { font-size: 16px; width: 22px; text-align: center; }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 0.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-accent);
    color: var(--text-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

.logout-btn {
    font-size: 18px;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    opacity: 0.6;
    transition: opacity var(--transition);
}

.logout-btn:hover { opacity: 1; }

/* ─── Main Content ──────────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 28px 32px;
    min-height: 100vh;
    max-width: 100%;
    min-width: 0;
}

/* ─── Page Header ───────────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
}

.header-time {
    font-size: 14px;
    color: var(--text-muted);
}

/* ─── Cards ─────────────────────────────────────────────────── */
.card {
    background: var(--surface-2);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
}

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

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 20px;
}

.card-body.p-0 {
    padding: 0;
}

.card-body.p-0 .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.card-body.p-0 > .table {
    min-width: 100%;
}

/* ─── Stats Grid ────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface-2);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.2;
}

.stat-value.accent { color: var(--text-accent); }
.stat-value.warning { color: var(--text-warning); }
.stat-value.success { color: var(--text-success); }
.stat-value.secondary { color: var(--text-secondary); }

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ─── Grid ──────────────────────────────────────────────────── */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .grid-2 { grid-template-columns: 1fr; }
}

/* ─── Step Pipeline ─────────────────────────────────────────── */
.step-pipeline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.step-node {
    flex: 1;
    text-align: center;
    background: var(--surface-1);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 8px;
}

.step-node.active {
    background: var(--bg-accent);
    border-color: var(--border-accent);
}

.step-count {
    font-size: 22px;
    font-weight: 600;
}

.step-node.active .step-count { color: var(--text-accent); }
.step-node:not(.active) .step-count { color: var(--text-muted); }

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

.step-arrow {
    color: var(--text-muted);
    font-size: 18px;
    flex-shrink: 0;
}

/* ─── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.badge-primary {
    background: var(--bg-accent);
    color: var(--text-accent);
}

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

.badge-muted {
    background: var(--surface-1);
    color: var(--text-muted);
    border: 0.5px solid var(--border);
}

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

/* ─── Tables ────────────────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    text-align: left;
    padding: 10px 16px;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 0.5px solid var(--border);
    background: var(--surface-1);
}

.table td {
    padding: 10px 16px;
    border-bottom: 0.5px solid var(--border);
}

.table tr:hover { background: var(--surface-1); }

/* ─── Forms ─────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 9px 12px;
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--surface-2);
    transition: border-color var(--transition);
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--fill-accent);
    box-shadow: 0 0 0 2px var(--bg-accent);
}

textarea { resize: vertical; min-height: 60px; }

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

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    align-items: center;
}

.form-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 0.5px solid var(--border);
}

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

.section-header label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--fill-accent);
    color: var(--on-accent);
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: default; }

.btn-success {
    background: var(--fill-success);
    color: white;
}

.btn-success:hover { opacity: 0.9; }

.btn-danger {
    background: var(--fill-danger);
    color: white;
}

.btn-danger:hover { opacity: 0.9; }

.btn-outline {
    background: none;
    border: 0.5px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--surface-1);
    border-color: var(--text-muted);
}

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

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

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-muted);
    padding: 4px;
}

.btn-icon:hover { color: var(--text-danger); }

/* ─── Alerts ────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: var(--bg-success);
    color: var(--text-success);
    border: 0.5px solid var(--text-success);
}

.alert-error {
    background: var(--bg-danger);
    color: var(--text-danger);
    border: 0.5px solid var(--text-danger);
}

.alert-info {
    background: var(--bg-accent);
    color: var(--text-accent);
    border: 0.5px solid var(--border-accent);
}

/* ─── Modal ─────────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
}

.modal-content {
    position: relative;
    background: var(--surface-2);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-lg { max-width: 720px; }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 0.5px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface-2);
    z-index: 1;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
    text-decoration: none;
}

.modal-body {
    padding: 20px 24px 24px;
}

/* ─── Products ──────────────────────────────────────────────── */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.product-card {
    background: var(--surface-2);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

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

.product-image {
    width: 100%;
    height: 140px;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-image-preview { margin-top: 8px; }
.product-image-preview img { max-height: 80px; border-radius: var(--radius); }

.product-info { padding: 14px 16px 8px; }

.product-title {
    font-size: 16px;
    font-weight: 600;
}

.product-name {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.product-detail {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: left;
    padding: 0;
}

.product-colors { padding: 0 16px; }

.color-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    border-top: 0.5px solid var(--border);
}

.color-name {
    font-size: 12px;
    font-weight: 500;
    min-width: 60px;
}

.color-sizes {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.size-chip {
    font-size: 11px;
    background: var(--surface-1);
    border: 0.5px solid var(--border);
    border-radius: 20px;
    padding: 1px 7px;
}

.product-actions {
    display: flex;
    gap: 8px;
    padding: 10px 16px 14px;
}

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

.color-block {
    background: var(--surface-1);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 10px;
}

.color-block-header {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.color-name-input {
    flex: 1;
}

.size-palette { margin-bottom: 10px; }
.size-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; display: block; }

.size-grid {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.size-btn {
    width: 38px;
    height: 34px;
    border: 0.5px solid var(--border);
    background: none;
    color: var(--text-secondary);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition);
}

.size-btn:hover { border-color: var(--fill-accent); }

.size-btn.selected {
    background: var(--bg-accent);
    border-color: var(--fill-accent);
    color: var(--text-accent);
    font-weight: 600;
}

.mrp-per-size { margin-top: 10px; }
.mrp-per-size label { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; display: block; }
.mrp-size-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.mrp-input-group { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.mrp-input-group input { width: 80px; padding: 4px 8px; }

/* ─── Autocomplete ──────────────────────────────────────────── */
.autocomplete { position: relative; }
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-3);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    z-index: 10;
    box-shadow: var(--shadow-lg);
    display: none;
    max-height: 200px;
    overflow-y: auto;
}

.autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 0.5px solid var(--border);
    transition: background var(--transition);
}

.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--surface-1); }

/* ─── Buttons / Chips ───────────────────────────────────────── */
.btn-chip {
    padding: 6px 16px;
    border: 0.5px solid var(--border);
    background: none;
    color: var(--text-secondary);
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition);
}

.btn-chip:hover { border-color: var(--fill-accent); }
.btn-chip.active {
    background: var(--bg-accent);
    border-color: var(--fill-accent);
    color: var(--text-accent);
    font-weight: 500;
}

.color-options { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── Challans ──────────────────────────────────────────────── */
.challan-steps {
    display: flex;
    border-bottom: 0.5px solid var(--border);
    margin-bottom: 20px;
}

.challan-step {
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--transition);
}

.challan-step.active {
    color: var(--text-accent);
    border-bottom-color: var(--fill-accent);
    font-weight: 500;
}

.challan-list { display: flex; flex-direction: column; gap: 10px; }

.challan-card {
    background: var(--surface-2);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: box-shadow var(--transition);
}

.challan-card:hover { box-shadow: var(--shadow); }
.challan-card.flagged { border-color: var(--border-danger); }
.challan-card.flagged:hover { box-shadow: 0 1px 6px rgba(229,62,62,0.15); }

.challan-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.challan-info { flex: 1; }
.challan-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.challan-docket { font-size: 16px; font-weight: 600; }
.challan-details { font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }
.challan-date { font-size: 12px; }
.challan-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.search-input {
    width: 100%;
    max-width: 360px;
    margin-bottom: 16px;
    padding: 9px 12px;
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}

/* ─── Progress ──────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar input[type="text"],
.filter-bar input[type="date"],
.filter-bar select {
    padding: 8px 12px;
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    background: var(--surface-2);
}

.filter-bar label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.filter-count { font-size: 13px; color: var(--text-muted); margin-left: auto; }

.progress-card {
    background: var(--surface-2);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 10px;
}

.progress-card.flagged { border-color: var(--border-danger); }

.progress-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.progress-info { flex: 1; }
.progress-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.progress-details { font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; }
.progress-time { font-size: 12px; }
.progress-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.flag-label {
    font-size: 11px;
    background: var(--bg-danger);
    color: var(--text-danger);
    padding: 2px 8px;
    border-radius: 20px;
}

.progress-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    max-width: 300px;
}

.progress-segment {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--surface-1);
}

.progress-segment.done { background: var(--fill-success); }
.progress-segment.current { background: var(--fill-accent); }

/* ─── My Work ───────────────────────────────────────────────── */
.work-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 0.5px solid var(--border);
    gap: 16px;
}

.work-item:last-child { border-bottom: none; }
.work-info { flex: 1; }
.work-docket { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.work-meta { font-size: 13px; color: var(--text-secondary); }
.work-sizes { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.work-remark { margin-top: 6px; font-size: 13px; color: var(--text-warning); }
.work-actions { flex-shrink: 0; }
.work-status { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.work-item.pending { background: var(--bg-accent); border-left: 3px solid var(--fill-accent); }
.work-item.completed { opacity: 0.85; }

/* ─── Bag details ───────────────────────────────────────────── */
.bag-details { margin-top: 12px; }
.bag-detail-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 0.5px solid var(--border);
}

.bag-detail-row:last-child { border-bottom: none; }

.bag-pieces-input {
    width: 100px !important;
}

.bag-mult { font-size: 13px; color: var(--text-muted); }

.bag-summary {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 0.5px solid var(--border);
}

.summary-line { font-size: 14px; text-align: right; }

/* ─── Preview ───────────────────────────────────────────────── */
.preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.preview-section {
    background: var(--surface-1);
    border-radius: var(--radius);
    padding: 16px;
}

.preview-section h4 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.preview-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 0.5px solid var(--border);
    font-size: 14px;
}

.preview-row:last-child { border-bottom: none; }

.preview-remarks {
    background: var(--bg-warning);
    border: 0.5px solid var(--border-warning);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--text-warning);
}

.bag-details-preview {
    margin-top: 10px;
}

/* ─── QR Display ────────────────────────────────────────────── */
.qr-display {
    text-align: center;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.flag-badge {
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    width: 100%;
}

.flag-badge.danger {
    background: var(--bg-danger);
    color: var(--text-danger);
    border: 0.5px solid var(--border-danger);
}

.flag-badge.success {
    background: var(--bg-success);
    color: var(--text-success);
    border: 0.5px solid var(--text-success);
}

.bag-composition {
    background: var(--surface-1);
    border-radius: var(--radius);
    padding: 12px;
    margin: 12px 0;
}

.bag-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 0.5px solid var(--border);
    font-size: 14px;
}

.bag-row.total {
    border-bottom: none;
    padding-top: 8px;
    font-weight: 600;
    border-top: 0.5px solid var(--border);
}

.detail-table { width: 100%; }
.detail-table td {
    padding: 8px 0;
    border-bottom: 0.5px solid var(--border);
    font-size: 14px;
}

.detail-table td:first-child {
    color: var(--text-muted);
    width: 140px;
}

/* ─── QR Page ───────────────────────────────────────────────── */
.qr-page { max-width: 800px; margin: 0 auto; }
.qr-header { text-align: center; margin-bottom: 24px; }

.qr-code-display {
    display: inline-block;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 16px 0;
}

.qr-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.qr-subtitle { font-size: 16px; color: var(--text-secondary); }
.qr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 640px) { .qr-grid { grid-template-columns: 1fr; } }

/* ─── Timeline ──────────────────────────────────────────────── */
.timeline {
    padding: 8px 0;
}

.timeline-step {
    display: flex;
    gap: 14px;
    padding: 12px 0;
    border-left: 2px solid var(--border);
    margin-left: 12px;
    padding-left: 24px;
    position: relative;
}

.timeline-step:last-child { border-left-color: transparent; }
.timeline-step.current { border-left-color: var(--fill-accent); }
.timeline-step.done { border-left-color: var(--fill-success); }

.timeline-marker {
    position: absolute;
    left: -9px;
    top: 14px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    background: var(--surface-2);
    border: 2px solid var(--border);
}

.timeline-step.current .timeline-marker {
    border-color: var(--fill-accent);
    color: var(--fill-accent);
}

.timeline-step.done .timeline-marker {
    border-color: var(--fill-success);
    background: var(--fill-success);
    color: white;
}

.timeline-title { font-size: 14px; font-weight: 500; }
.timeline-date { font-size: 12px; color: var(--text-muted); }
.timeline-duration { font-size: 12px; color: var(--text-accent); font-weight: 500; }
.timeline-performer { font-size: 11px; color: var(--text-muted); }

/* ─── Sales ─────────────────────────────────────────────────── */
.sales-list { display: flex; flex-direction: column; gap: 10px; }
.sale-card {
    background: var(--surface-2);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px;
}

.sale-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.sale-info { flex: 1; }
.sale-title { font-size: 15px; font-weight: 500; margin-bottom: 2px; }
.sale-meta { font-size: 13px; color: var(--text-muted); }
.sale-sizes { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.sale-total { font-size: 18px; font-weight: 600; color: var(--text-success); white-space: nowrap; }

.size-badge {
    font-size: 11px;
    background: var(--surface-1);
    border: 0.5px solid var(--border);
    border-radius: 20px;
    padding: 2px 8px;
}

.sale-qty-list {
    background: var(--surface-1);
    border-radius: var(--radius);
    padding: 12px;
}

.sale-qty-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 0.5px solid var(--border);
}

.sale-qty-row:last-child { border-bottom: none; }

.sale-qty-input { width: 100px !important; }
.new-dealer-fields { margin-top: 14px; }

/* ─── Radio / Checkbox ──────────────────────────────────────── */
.radio-group { display: flex; gap: 16px; flex-wrap: wrap; }
.radio { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }

/* ─── Dealers ───────────────────────────────────────────────── */
.dealer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.dealer-card {
    background: var(--surface-2);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    text-align: center;
}

.dealer-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-accent);
    color: var(--text-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    margin: 0 auto 10px;
}

.dealer-name { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.dealer-info { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.dealer-actions { margin-top: 12px; display: flex; gap: 8px; justify-content: center; }

/* ─── Stock ─────────────────────────────────────────────────── */
.stock-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.stock-card {
    background: var(--surface-2);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.stock-header { margin-bottom: 12px; }
.stock-title { font-size: 15px; font-weight: 600; }
.stock-color { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.stock-sizes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.stock-size {
    background: var(--surface-1);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    text-align: center;
    min-width: 60px;
}

.stock-size-label { font-size: 11px; color: var(--text-muted); }
.stock-size-qty { font-size: 16px; font-weight: 600; }
.stock-total { text-align: right; font-size: 14px; border-top: 0.5px solid var(--border); padding-top: 10px; }

/* ─── Flags ─────────────────────────────────────────────────── */
.flag-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 20px;
    border-bottom: 0.5px solid var(--border);
    gap: 16px;
}

.flag-card:last-child { border-bottom: none; }
.flag-info { flex: 1; }
.flag-head { font-size: 14px; margin-bottom: 4px; }
.flag-details { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.flag-reason { font-size: 14px; margin-bottom: 4px; }
.flag-meta { font-size: 12px; }
.flag-actions { flex-shrink: 0; }

.flag-item {
    background: var(--bg-danger);
    border: 0.5px solid var(--border-danger);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 10px;
}

.flag-item:last-child { margin-bottom: 0; }
.flag-item-head { font-weight: 500; margin-bottom: 4px; }
.flag-item-reason { font-size: 14px; }
.flag-item-date { font-size: 12px; margin-top: 4px; }

/* ─── Users ─────────────────────────────────────────────────── */
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.user-card {
    background: var(--surface-2);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    position: relative;
}

.user-card.current {
    border-color: var(--border-accent);
    background: var(--bg-accent);
}

.user-card .user-avatar {
    width: 48px;
    height: 48px;
    font-size: 20px;
    margin: 0 auto 10px;
}

.user-name { font-size: 15px; font-weight: 500; }
.user-username { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.user-role-label {
    display: inline-block;
    margin-top: 8px;
    font-size: 11px;
    background: var(--surface-1);
    border: 0.5px solid var(--border);
    border-radius: 20px;
    padding: 2px 10px;
    color: var(--text-secondary);
}

.user-current-label {
    font-size: 11px;
    color: var(--text-accent);
    font-weight: 500;
    margin-top: 4px;
}

.user-actions { margin-top: 12px; display: flex; gap: 8px; justify-content: center; }

/* ─── QR Scanner Widget ─────────────────────────────────────── */
.qr-scanner-card {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin-bottom: 24px;
    color: white;
    box-shadow: 0 4px 20px rgba(79,70,229,0.25);
    position: relative;
}

.qr-scanner-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    background: radial-gradient(circle at 100% 0%, rgba(255,255,255,0.08) 0%, transparent 60%);
    pointer-events: none;
}

.scanner-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.scanner-icon {
    font-size: 36px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.15);
    border-radius: 14px;
    flex-shrink: 0;
    backdrop-filter: blur(4px);
    transition: transform 0.3s ease, background 0.2s ease;
}

.qr-scanner-card:hover .scanner-icon {
    transform: scale(1.05);
    background: rgba(255,255,255,0.2);
}

.scanner-text {
    flex: 1;
    min-width: 160px;
}

.scanner-text h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 2px;
    color: white;
    letter-spacing: -0.01em;
}

.scanner-text p {
    margin: 0;
    font-size: 13px;
    opacity: 0.8;
    color: white;
}

.scanner-form {
    flex-shrink: 0;
}

.scanner-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.scanner-input-group input {
    width: 200px;
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font-sans);
    background: rgba(255,255,255,0.95);
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition);
}

.scanner-input-group input::placeholder {
    color: #999;
}

.scanner-input-group input:focus {
    border-color: white;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.3);
    background: white;
}

.scanner-input-group .btn-primary {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.scanner-input-group .btn-primary:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
}

.scanner-input-group .btn-outline {
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    background: rgba(255,255,255,0.08);
}

.scanner-input-group .btn-outline:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.5);
}

.scanner-error {
    width: 100%;
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    background: rgba(239,68,68,0.15);
    color: #fca5a5;
    display: none;
    margin-top: 12px;
}

.scanner-error.show {
    display: block;
}

/* ─── Scanner Modal ─────────────────────────────────────────── */
.modal-sm .modal-content {
    max-width: 420px;
}

/* ─── Empty State ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.empty-state.full-width { grid-column: 1 / -1; }

/* ─── Utilities ─────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--text-accent); }
.text-success { color: var(--text-success); }
.text-warning { color: var(--text-warning); }
.text-danger { color: var(--text-danger); }
.text-center { text-align: center; }

/* ─── Mobile Top Bar ────────────────────────────────────────── */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #ffffff;
    border-bottom: 0.5px solid var(--border);
    z-index: 40;
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
}

.mobile-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-menu-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-primary);
    border-radius: 8px;
    transition: background 0.2s ease;
}

.mobile-menu-btn:hover,
.mobile-menu-btn:active {
    background: var(--surface-1);
}

.mobile-topbar-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.mobile-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-accent);
    color: var(--text-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

/* ─── Mobile Bottom Navigation ──────────────────────────────── */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #ffffff;
    border-top: 0.5px solid var(--border);
    z-index: 40;
    padding: 4px 0 env(safe-area-inset-bottom, 0px);
    justify-content: space-around;
    align-items: flex-start;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.05);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 6px 12px;
    min-width: 48px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
    position: relative;
    border-radius: 8px;
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item:hover {
    color: var(--text-secondary);
    text-decoration: none;
}

.mobile-nav-item.active {
    color: var(--text-accent);
}

.mobile-nav-item.active::after {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--fill-accent);
    border-radius: 0 0 3px 3px;
}

.mobile-nav-icon {
    font-size: 20px;
    line-height: 1;
}

.mobile-nav-label {
    font-size: 10px;
    line-height: 1.2;
    font-weight: 500;
}

.mobile-nav-more {
    color: var(--text-muted);
}

/* ─── Mobile Drawer ─────────────────────────────────────────── */
.mobile-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 60;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-drawer-overlay.open {
    display: block;
    opacity: 1;
}

.mobile-drawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 80vw;
    background: #ffffff;
    z-index: 70;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
}

.mobile-drawer.open {
    transform: translateX(0);
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 12px;
    border-bottom: 0.5px solid var(--border);
}

.mobile-drawer-logo {
    font-size: 28px;
}

.mobile-drawer-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-accent);
}

.mobile-drawer-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.mobile-drawer-close {
    margin-left: auto;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 8px;
}

.mobile-drawer-close:hover,
.mobile-drawer-close:active {
    background: var(--surface-1);
}

.mobile-drawer-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.mobile-drawer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 400;
    text-decoration: none;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    -webkit-tap-highlight-color: transparent;
}

.mobile-drawer-item:hover,
.mobile-drawer-item:active {
    background: var(--bg-accent);
    color: var(--text-accent);
    text-decoration: none;
}

.mobile-drawer-item.active {
    background: var(--bg-accent);
    color: var(--text-accent);
    border-left-color: var(--fill-accent);
    font-weight: 500;
}

.mobile-drawer-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.mobile-drawer-label {
    font-size: 15px;
}

.mobile-drawer-footer {
    padding: 12px 16px;
    border-top: 0.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.mobile-user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-accent);
    color: var(--text-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

.mobile-user-name {
    font-size: 13px;
    font-weight: 500;
}

.mobile-user-role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: capitalize;
}

.mobile-logout-btn {
    font-size: 18px;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.mobile-logout-btn:hover { opacity: 1; }

body.drawer-open {
    overflow: hidden;
}

/* ─── Responsive ────────────────────────────────────────────── */

/* Tablet and below: 1024px */
@media (max-width: 1024px) {
    .main-content {
        padding: 24px;
    }
    .stock-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* Mobile: 768px and below */
@media (max-width: 768px) {
    /* ── Layout ── */
    .sidebar {
        display: none;
    }

    .mobile-topbar {
        display: flex;
    }

    .mobile-bottom-nav {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 72px 16px 80px;
        min-height: 100vh;
    }

    /* ── Page header ── */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 16px;
    }

    .page-header h1 {
        font-size: 18px;
    }

    .header-time {
        font-size: 12px;
    }

    /* ── Cards ── */
    .card-header {
        padding: 12px 16px;
    }

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

    .card-body {
        padding: 16px;
    }

    /* ── Stats ── */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 16px;
    }

    .stat-card {
        padding: 12px;
    }

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

    /* ── Grids ── */
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 16px;
    }

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

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

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

    .users-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .user-card {
        padding: 14px;
    }

    /* ── Step pipeline ── */
    .step-pipeline {
        gap: 4px;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .step-node {
        min-width: 60px;
        padding: 8px 4px;
    }

    .step-count {
        font-size: 18px;
    }

    .step-name {
        font-size: 8px;
        line-height: 1.2;
        white-space: normal;
        word-break: break-word;
    }

    .step-arrow {
        font-size: 14px;
    }

    /* ── Cards ── */
    .card {
        overflow: visible;
    }

    .card-body.p-0 {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ── Tables ── */
    .table th,
    .table td {
        padding: 8px 10px;
        font-size: 13px;
        white-space: nowrap;
    }

    .table th {
        font-size: 11px;
    }

    /* ── Forms ── */
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .form-actions {
        flex-wrap: wrap;
    }

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

    input[type="text"],
    input[type="number"],
    input[type="password"],
    input[type="date"],
    input[type="file"],
    textarea,
    select {
        font-size: 16px; /* Prevent iOS zoom */
    }

    /* ── Buttons ── */
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

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

    /* ── Challans ── */
    .challan-main {
        flex-direction: column;
        gap: 10px;
    }

    .challan-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .challan-actions .btn-sm {
        flex: 0 1 auto;
    }

    .challan-docket {
        font-size: 14px;
    }

    .challan-details {
        font-size: 13px;
    }

    .challan-card {
        padding: 12px;
    }

    .challan-steps {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .challan-step {
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 12px;
    }

    .search-input {
        max-width: 100%;
        font-size: 16px;
    }

    /* ── Products ── */
    .product-image {
        height: 100px;
    }

    .product-info {
        padding: 10px 14px 6px;
    }

    .product-title {
        font-size: 14px;
    }

    .product-colors {
        padding: 0 12px;
    }

    .product-actions {
        padding: 8px 12px 12px;
    }

    .color-block {
        padding: 12px;
    }

    .size-btn {
        width: 36px;
        height: 32px;
        font-size: 13px;
    }

    /* ── Progress ── */
    .progress-main {
        flex-direction: column;
        gap: 10px;
    }

    .progress-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .progress-actions .btn-sm {
        flex: 0 1 auto;
    }

    .progress-card {
        padding: 12px;
    }

    /* ── Filter bar ── */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .filter-bar input,
    .filter-bar select {
        width: 100% !important;
        font-size: 16px;
    }

    .filter-bar label {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar label input {
        width: 100% !important;
    }

    .filter-count {
        margin-left: 0;
        text-align: right;
        font-size: 12px;
    }

    /* ── Sales ── */
    .sale-main {
        flex-direction: column;
        gap: 8px;
    }

    .sale-total {
        align-self: flex-start;
    }

    .sale-qty-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .sale-qty-input {
        width: 80px !important;
    }

    /* ── My Work ── */
    .work-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 16px;
    }

    .work-actions {
        width: 100%;
    }

    .work-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .work-sizes {
        flex-wrap: wrap;
    }

    .work-status {
        justify-content: space-between;
    }

    /* ── Dealers ── */
    .dealer-actions {
        flex-wrap: wrap;
    }

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

    /* ── Flags ── */
    .flag-card {
        flex-direction: column;
        gap: 10px;
        padding: 12px 16px;
    }

    .flag-actions {
        width: 100%;
    }

    .flag-actions .btn-sm {
        width: 100%;
        justify-content: center;
    }

    .flag-details {
        flex-wrap: wrap;
    }

    /* ── Preview ── */
    .preview-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* ── QR Page ── */
    .qr-title {
        font-size: 20px;
    }

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

    /* ── QR Scanner Widget ── */
    .qr-scanner-card {
        padding: 18px 20px;
    }

    .scanner-content {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .scanner-icon {
        margin: 0 auto;
    }

    .scanner-form {
        width: 100%;
    }

    .scanner-input-group {
        flex-wrap: wrap;
    }

    .scanner-input-group input {
        width: 100%;
    }

    .scanner-input-group .btn {
        flex: 1;
        justify-content: center;
    }

    /* ── Modals ── */
    .modal-content {
        width: 96%;
        max-height: 90vh;
    }

    .modal-sm .modal-content,
    .modal-content.modal-sm {
        max-width: 96%;
    }

    .modal-body {
        padding: 16px 18px 20px;
    }

    .modal-header {
        padding: 14px 18px;
    }

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

    /* ── Autocomplete ── */
    .autocomplete-list {
        max-height: 160px;
    }

    .autocomplete-item {
        padding: 12px 14px;
        font-size: 14px;
    }

    /* ── Bag details ── */
    .bag-detail-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .bag-pieces-input {
        width: 80px !important;
    }

    /* ── Timeline ── */
    .timeline-step {
        padding: 10px 0 10px 20px;
        margin-left: 10px;
    }

    /* ── Color options ── */
    .color-options {
        gap: 6px;
    }

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

    /* ── Radio / Checkbox ── */
    .radio-group {
        gap: 10px;
    }

    /* ── Bag composition ── */
    .bag-row {
        font-size: 13px;
    }

    /* ── Empty state ── */
    .empty-state {
        padding: 24px 16px;
    }

    /* ── Badges ── */
    .badge {
        font-size: 10px;
        padding: 2px 8px;
    }

    /* ── Reports table ── */
    .detail-table td:first-child {
        width: 100px;
        font-size: 13px;
    }

    .detail-table td {
        font-size: 13px;
    }

    /* ── MRP inputs ── */
    .mrp-size-grid {
        gap: 6px;
    }

    .mrp-input-group input {
        width: 60px;
    }

    /* ── Stock sizes ── */
    .stock-size {
        min-width: 52px;
        padding: 6px 8px;
    }

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

    .stock-size-qty {
        font-size: 14px;
    }

    .stock-total {
        font-size: 13px;
    }

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

    /* ── Flags items ── */
    .flag-item {
        padding: 8px 12px;
    }
}

/* Small phones: 420px and below */
@media (max-width: 420px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

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

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

    .mobile-bottom-nav {
        height: 56px;
    }

    .mobile-nav-item {
        padding: 4px 8px;
    }

    .mobile-nav-icon {
        font-size: 18px;
    }

    .mobile-nav-label {
        font-size: 9px;
    }

    .main-content {
        padding: 68px 12px 72px;
    }

    .modal-content {
        width: 100%;
        border-radius: var(--radius);
    }

    .scanner-input-group input {
        font-size: 16px;
    }
}
