/* ============================================
   QuickPOS — Design System
   ============================================ */

:root {
    --bg: #f0f2f5;
    --surface: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6b7280;

    --primary: #4f46e5;
    --primary-light: #eef2ff;
    --secondary: #0891b2;
    --secondary-light: #ecfeff;
    --accent: #059669;
    --accent-light: #ecfdf5;
    --info: #7c3aed;
    --info-light: #f5f3ff;
    --warm: #ea580c;
    --warm-light: #fff7ed;
    --neutral: #475569;
    --neutral-light: #f8fafc;

    --radius: 20px;
    --radius-sm: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.08), 0 8px 32px rgba(0,0,0,0.1);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* ---- Layout ---- */

.main-container {
    width: 100%;
    max-width: 860px;
    animation: fadeIn 0.6s ease-out;
}

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

/* ---- Header ---- */

.main-header {
    text-align: center;
    margin-bottom: 3rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}

.logo-icon {
    font-size: 2rem;
    color: var(--primary);
    line-height: 1;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
}

.tagline {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}

.datetime {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: capitalize;
}

/* ---- Home account switcher ---- */

.home-account-bar {
    margin-top: -1.2rem;
    margin-bottom: 1.4rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.home-account-current {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.home-account-current strong {
    font-size: 0.95rem;
    color: var(--text);
}

.home-account-current span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.home-switch-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ---- Dashboard Grid ---- */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

/* ---- Card (base) ---- */

.card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 2.2rem 1.5rem;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    border: 2px solid transparent;
    transition: border-color var(--transition);
    pointer-events: none;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.card:active {
    transform: translateY(-1px) scale(0.98);
}

/* ---- Card icon ---- */

.card-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition);
}

.card-icon svg {
    width: 26px;
    height: 26px;
}

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

/* ---- Card text ---- */

.card-title {
    font-size: 1.1rem;
    font-weight: 650;
    letter-spacing: -0.2px;
}

.card-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.3;
}

/* ---- Card PRIMARY (Caisse) — larger ---- */

.card-primary {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: flex-start;
    padding: 2.6rem 2.5rem;
    gap: 1.5rem;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #fff;
}

.card-primary .card-icon {
    width: 68px;
    height: 68px;
    background: rgba(255,255,255,0.18);
    border-radius: 16px;
}

.card-primary .card-icon svg {
    width: 34px;
    height: 34px;
}

.card-primary .card-desc {
    color: rgba(255,255,255,0.8);
}

.card-primary .card-title {
    font-size: 1.6rem;
    font-weight: 700;
}

.card-primary:hover {
    background: linear-gradient(135deg, #4338ca, #7c3aed);
}

.card-primary::before {
    border-color: rgba(255,255,255,0.15);
}

.card-primary-text {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

/* ---- Card variants ---- */

.card-secondary .card-icon { background: var(--secondary-light); color: var(--secondary); }
.card-secondary:hover::before { border-color: var(--secondary); }

.card-accent .card-icon { background: var(--accent-light); color: var(--accent); }
.card-accent:hover::before { border-color: var(--accent); }

.card-info .card-icon { background: var(--info-light); color: var(--info); }
.card-info:hover::before { border-color: var(--info); }

.card-warm .card-icon { background: var(--warm-light); color: var(--warm); }
.card-warm:hover::before { border-color: var(--warm); }

.card-neutral .card-icon { background: var(--neutral-light); color: var(--neutral); }
.card-neutral:hover::before { border-color: var(--neutral); }

/* ---- Footer ---- */

.main-footer {
    text-align: center;
    margin-top: 3rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.8rem 2.4rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header .logo h1 { font-size: 1.6rem; }

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    width: 100%;
    min-width: 0;
    padding: 0.65rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: #fafafa;
    transition: border-color var(--transition), background var(--transition);
    outline: none;
    box-sizing: border-box;
}

.form-group input:focus {
    border-color: var(--primary);
    background: #fff;
}

.form-group input::placeholder {
    color: #b0b5bf;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #fff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4338ca, #7c3aed);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}

.btn-full { width: 100%; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.btn-icon:hover {
    background: #f3f4f6;
    color: var(--text);
}

/* Alert */

.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* ---- Back button (touch-friendly, shared) ---- */

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem 0.5rem 0.65rem;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    min-height: 44px;
    min-width: 44px;
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.back-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.back-btn:active {
    transform: scale(0.96);
    background: #ddd6fe;
}

.back-btn-center {
    justify-content: center;
    margin-top: 1.2rem;
    width: 100%;
}

/* ============================================
   POS — CAISSE
   ============================================ */

.pos-body {
    display: flex;
    flex-direction: column;
    padding: 0;
    align-items: stretch;
    justify-content: flex-start;
    background: var(--bg);
    height: 100vh;
    overflow: hidden;
}

/* ---- Top Bar ---- */

.pos-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.2rem;
    height: 52px;
    background: var(--surface);
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.pos-topbar-left,
.pos-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

/* pos-home-btn removed — replaced by .back-btn */

.pos-logo {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    letter-spacing: -0.3px;
}

.pos-datetime {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: capitalize;
}

.pos-user {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.pos-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    color: var(--text-muted);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    -webkit-tap-highlight-color: transparent;
}
.pos-logout-btn:hover { background: #fef2f2; color: #dc2626; }

/* ---- POS Layout (2 columns) ---- */

.pos-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ---- Left: Cart ---- */

.pos-cart {
    width: 380px;
    min-width: 340px;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid #e5e7eb;
}

.pos-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #f0f0f3;
}

.pos-cart-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.pos-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 0.6rem 0;
}

.pos-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    height: 100%;
    color: #d1d5db;
    font-size: 0.9rem;
}

/* Cart line */

.cart-line {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1.2rem;
    border-bottom: 1px solid #f5f5f8;
    animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: translateX(0); }
}

.cart-line-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.cart-line-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-line-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cart-line-controls {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.qty-btn {
    width: 38px;
    height: 38px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.qty-btn:hover { border-color: var(--primary); color: var(--primary); }

.qty-value {
    width: 28px;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.cart-line-total {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
    min-width: 60px;
    text-align: right;
}

.cart-line-remove {
    border: none;
    background: none;
    color: #d1d5db;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    transition: color var(--transition), background var(--transition);
}
.cart-line-remove:hover { color: #dc2626; background: #fef2f2; }

/* Cart footer */

.pos-cart-footer {
    border-top: 1px solid #e5e7eb;
    padding: 1rem 1.2rem;
}

.pos-cart-totals {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.total-main {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text);
    padding-top: 0.6rem;
    border-top: 2px solid var(--primary);
    margin-top: 0.3rem;
}

.btn-pay {
    background: linear-gradient(135deg, var(--accent), #10b981);
    color: #fff;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
    font-size: 1.05rem;
    padding: 1rem;
}

.btn-pay:hover {
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.45);
}

.btn-pay:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

/* ---- Right: Products ---- */

.pos-products {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 1.2rem;
    overflow: hidden;
}

/* Search */

.pos-search {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 1rem;
    height: 46px;
    background: var(--surface);
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-sm);
    margin-bottom: 0.8rem;
    transition: border-color var(--transition);
}

.pos-search:focus-within { border-color: var(--primary); }

.pos-search svg { color: var(--text-muted); flex-shrink: 0; }

.pos-search input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.92rem;
    font-family: inherit;
    color: var(--text);
    background: transparent;
}

.pos-search input::placeholder { color: #b0b5bf; }

/* Categories */

.pos-categories {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    overflow-x: auto;
    padding-bottom: 0.3rem;
    flex-shrink: 0;
}

.pos-categories::-webkit-scrollbar { height: 3px; }
.pos-categories::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

.cat-btn {
    padding: 0.6rem 1.2rem;
    border: 2px solid #e5e7eb;
    border-radius: 50px;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    transition: all var(--transition);
}

.cat-btn:hover {
    border-color: var(--cat-color, var(--primary));
    color: var(--cat-color, var(--primary));
}

.cat-btn.active {
    background: var(--cat-color, var(--primary));
    border-color: var(--cat-color, var(--primary));
    color: #fff;
}

/* Product grid */

.pos-product-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.7rem;
    overflow-y: auto;
    padding: 0.2rem;
    align-content: start;
}

.pos-product-grid::-webkit-scrollbar { width: 4px; }
.pos-product-grid::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

.product-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 1.2rem 0.6rem;
    min-height: 80px;
    background: var(--surface);
    border: 2px solid #eef0f4;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.product-tile::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--tile-color, var(--primary));
    opacity: 0;
    transition: opacity var(--transition);
}

.product-tile:hover {
    border-color: var(--tile-color, var(--primary));
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transform: translateY(-2px);
}

.product-tile:hover::after { opacity: 1; }

.product-tile:active { transform: translateY(0) scale(0.97); }

.tile-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    line-height: 1.25;
}

.tile-price {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--tile-color, var(--primary));
}

/* Quick actions */

.pos-quick-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.8rem;
    flex-shrink: 0;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem 0.8rem;
    min-height: 48px;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 30, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
    padding: 1rem;
    box-sizing: border-box;
}

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

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    width: 92%;
    max-width: 440px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: modalIn 0.3s ease-out;
    box-sizing: border-box;
}

/* Modales formulaires (produit, client, utilisateur…) */
.modal.modal-form {
    max-width: 580px;
}

.modal.modal-form .modal-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal.modal-form form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
    overflow: hidden;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-body {
    padding: 1.5rem;
    box-sizing: border-box;
}

.modal-form-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-footer {
    padding: 0 1.5rem 1.5rem;
    flex-shrink: 0;
    box-sizing: border-box;
}

.modal-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
}

.modal-total span { font-size: 0.9rem; color: var(--text-muted); }
.modal-total strong { font-size: 1.5rem; color: var(--primary); }

.payment-methods {
    display: flex;
    gap: 0.7rem;
    margin-bottom: 1.2rem;
}

.pay-method {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-muted);
    transition: all var(--transition);
}

.pay-method:hover { border-color: var(--primary); color: var(--primary); }

.pay-method.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.cash-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cash-input-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cash-input-group input {
    padding: 0.85rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-sm);
    font-size: 1.2rem;
    font-weight: 700;
    font-family: inherit;
    color: var(--text);
    outline: none;
    transition: border-color var(--transition);
}

.cash-input-group input:focus { border-color: var(--primary); }

.change-display {
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0.6rem 0;
}

.change-display strong {
    font-size: 1.1rem;
    color: var(--accent);
}

.modal-close {
    color: var(--text-muted);
}
.modal-close:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* ============================================
   TOAST
   ============================================ */

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--text);
    color: #fff;
    padding: 0.85rem 1.6rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================
   PAGES LAYOUT (shared for all back-office pages)
   ============================================ */

.page-body {
    display: flex;
    flex-direction: column;
    padding: 0;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---- Page Top Bar + Nav ---- */

.page-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-topbar-left { display: flex; align-items: center; }

.page-nav {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.page-nav-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 600;
    min-height: 44px;
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.page-nav-link:hover { color: var(--primary); background: var(--primary-light); }

.page-nav-link.active {
    color: var(--primary);
    background: var(--primary-light);
}

.page-nav-link span {
    display: inline;
}

/* ---- Page Content Area ---- */

.page-content {
    flex: 1;
    padding: 1.5rem 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.page-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title-bar h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.title-count {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 1rem;
}

.title-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* ---- Panels ---- */

.panel {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.2rem;
    margin-bottom: 1.2rem;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.panel-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.panel-stack {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.page-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    align-items: start;
}

/* ---- Data Table ---- */

.table-wrap { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table th {
    text-align: left;
    padding: 0.7rem 0.8rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid #eef0f4;
}

.data-table td {
    padding: 0.75rem 0.8rem;
    border-bottom: 1px solid #f5f5f8;
    vertical-align: middle;
}

.data-table tbody tr:hover { background: #fafbfd; }

.cell-id { color: var(--text-muted); font-size: 0.8rem; }
.cell-name { font-weight: 600; }
.cell-amount { font-weight: 700; text-align: right; white-space: nowrap; }
.cell-truncate { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-actions { white-space: nowrap; text-align: right; }

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

/* ---- Badges ---- */

.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #f0f2f5;
    color: var(--text-muted);
}

.badge-cash { background: var(--accent-light); color: var(--accent); }
.badge-card { background: var(--primary-light); color: var(--primary); }
.badge-role-admin   { background: #fef2f2; color: #dc2626; }
.badge-role-manager { background: var(--warm-light); color: var(--warm); }
.badge-role-cashier { background: var(--secondary-light); color: var(--secondary); }

/* ---- Code tag ---- */

.code-tag {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.78rem;
    background: #f3f4f6;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    color: var(--text-muted);
}

/* ---- Category dot ---- */

.cat-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--dot);
    margin-right: 0.4rem;
    vertical-align: middle;
}

/* ---- Color swatch ---- */

.color-swatch {
    display: inline-block;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    vertical-align: middle;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}

/* ---- Stock badge ---- */

.stock-badge { font-weight: 600; }
.stock-low { color: #dc2626; }

/* ---- Buttons small ---- */

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-outline {
    background: var(--surface);
    color: var(--text-muted);
    border: 2px solid #e5e7eb;
    box-shadow: none;
}

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

.btn-icon-danger:hover { background: #fef2f2; color: #dc2626; }

/* ---- Detail row (Historique) ---- */

.detail-row td { padding: 0 !important; }
.detail-row[hidden] { display: none; }

.detail-content {
    padding: 0.8rem 1.5rem;
    background: #fafbfd;
    border-radius: 0 0 12px 12px;
}

.detail-line {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.35rem 0;
    font-size: 0.84rem;
    color: var(--text-muted);
}

.detail-line span:first-child { flex: 1; color: var(--text); font-weight: 500; }
.detail-qty { color: var(--text-muted); font-size: 0.8rem; }
.detail-linetotal { font-weight: 700; color: var(--text); min-width: 70px; text-align: right; }

.detail-footer {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed #e5e7eb;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.toggle-details svg { transition: transform var(--transition); }
.toggle-details.open svg { transform: rotate(180deg); }

/* ---- Pagination ---- */

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    padding-top: 1rem;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all var(--transition);
}

.page-link:hover { background: var(--primary-light); color: var(--primary); }
.page-link.active { background: var(--primary); color: #fff; }

/* ---- Filter bar ---- */

.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-bar input[type="date"] {
    padding: 0.5rem 0.7rem;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text);
    outline: none;
    transition: border-color var(--transition);
}

.filter-bar input[type="date"]:focus { border-color: var(--primary); }

.search-inline input {
    padding: 0.5rem 0.9rem;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text);
    outline: none;
    width: 200px;
    transition: border-color var(--transition);
}

.search-inline input:focus { border-color: var(--primary); }

/* ---- Empty state ---- */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 3rem 1rem;
    color: #d1d5db;
}

.empty-state p { font-size: 0.95rem; }

.empty-state-sm {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* ---- Rapports X / Z (Recettes) ---- */

.report-print-panel {
    margin-bottom: 1.5rem;
}

.report-print-header {
    margin-bottom: 1rem;
}

.report-print-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.report-print-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.report-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;
    border: 2px solid transparent;
    transition: all var(--transition);
    min-height: 72px;
    -webkit-tap-highlight-color: transparent;
}

.report-btn-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: 800;
    flex-shrink: 0;
}

.report-btn-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    text-align: left;
}

.report-btn-text strong {
    font-size: 1rem;
    font-weight: 700;
}

.report-btn-text small {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.report-btn svg {
    flex-shrink: 0;
    opacity: 0.5;
}

.report-btn-x {
    background: #fffbeb;
    border-color: #fcd34d;
}

.report-btn-x .report-btn-letter {
    background: #fbbf24;
    color: #78350f;
}

.report-btn-x:hover {
    border-color: #f59e0b;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.2);
    transform: translateY(-2px);
}

.report-btn-z {
    background: #ecfdf5;
    border-color: #6ee7b7;
}

.report-btn-z .report-btn-letter {
    background: #10b981;
    color: #fff;
}

.report-btn-z:hover {
    border-color: #059669;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.2);
    transform: translateY(-2px);
}

.report-btn:active {
    transform: translateY(0) scale(0.98);
}

/* ---- Period tabs (Recettes) ---- */

.period-tabs {
    display: flex;
    gap: 0.3rem;
    background: #f3f4f6;
    padding: 0.25rem;
    border-radius: 12px;
}

.period-tab {
    padding: 0.45rem 1rem;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition);
}

.period-tab:hover { color: var(--text); }

.period-tab.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* ---- KPI Grid ---- */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.2rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.kpi-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text);
}

.kpi-primary { color: var(--primary); }

.kpi-sub {
    font-size: 0.76rem;
    color: var(--text-muted);
}

/* ---- Ranking list ---- */

.ranking-list { display: flex; flex-direction: column; }

.ranking-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 0.2rem;
    border-bottom: 1px solid #f5f5f8;
}

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

.ranking-pos {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    flex-shrink: 0;
}

.ranking-item:nth-child(1) .ranking-pos { background: #fef3c7; color: #d97706; }
.ranking-item:nth-child(2) .ranking-pos { background: #f1f5f9; color: #64748b; }
.ranking-item:nth-child(3) .ranking-pos { background: #fff7ed; color: #ea580c; }

.ranking-info { flex: 1; min-width: 0; }
.ranking-name { display: block; font-weight: 600; font-size: 0.88rem; }
.ranking-qty { font-size: 0.76rem; color: var(--text-muted); }
.ranking-revenue { font-weight: 700; font-size: 0.9rem; white-space: nowrap; }

/* ---- Payment bars ---- */

.payment-bars { display: flex; flex-direction: column; gap: 0.7rem; }

.pay-bar-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.pay-bar-label { font-size: 0.82rem; font-weight: 600; width: 70px; flex-shrink: 0; }

.pay-bar-track {
    flex: 1;
    height: 10px;
    background: #f3f4f6;
    border-radius: 50px;
    overflow: hidden;
}

.pay-bar-fill {
    height: 100%;
    border-radius: 50px;
    transition: width 0.6s ease;
}

.pay-bar-amount { font-size: 0.82rem; font-weight: 700; white-space: nowrap; min-width: 70px; text-align: right; }

/* ---- Mini chart ---- */

.mini-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    height: 120px;
    padding-top: 0.5rem;
}

.mini-chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: 0.3rem;
}

.mini-chart-bar {
    width: 100%;
    background: linear-gradient(to top, var(--primary), #818cf8);
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    transition: height 0.5s ease;
}

.mini-chart-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ---- Settings tabs ---- */

.settings-tabs {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 1.2rem;
    background: #f3f4f6;
    padding: 0.25rem;
    border-radius: 12px;
    width: fit-content;
}

.settings-tab {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.2rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition);
}

.settings-tab:hover { color: var(--text); }

.settings-tab.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.settings-tabs-scroll {
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
}

.page-content-wide {
    max-width: 960px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.settings-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

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

.settings-form-actions {
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.panel-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 1.2rem;
    line-height: 1.5;
}

.panel-title-spaced {
    margin-bottom: 0.35rem;
}

.panel-info {
    background: var(--primary-light);
    border: 1px solid #c7d2fe;
}

.panel-muted {
    background: #f8fafc;
}

.settings-checks {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.settings-check {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 500;
    min-height: 44px;
    padding: 0.5rem 0;
}

.settings-check input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--primary);
}

.settings-check span:first-of-type {
    flex: 1;
}

.field-hint {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 0.2rem;
}

.role-permissions-box {
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 0.8rem 0.9rem;
}

.role-permissions-head {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.45rem;
}

.role-permissions-head small {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.role-permissions-text {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.role-permissions-tags {
    margin-top: 0.6rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.role-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.22rem 0.55rem;
    background: #e2e8f0;
    color: #334155;
}

.settings-test-print {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.sys-info-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sys-info-list li {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.sys-info-list li:last-child {
    border-bottom: none;
}

.sys-info-list span {
    color: var(--text-muted);
}

.copy-field {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.copy-field input {
    flex: 1;
    min-width: 0;
}

.woo-setup-steps {
    margin: 0 0 1.2rem 1.2rem;
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.woo-warning {
    color: #b45309;
    background: #fffbeb;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid #fcd34d;
}

/* ---- WooCommerce caisse ---- */

.woo-orders-bar {
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 0.8rem;
    color: #fff;
    flex-shrink: 0;
}

.woo-orders-bar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.woo-orders-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.92rem;
}

.woo-badge {
    background: #fff;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 800;
    min-width: 22px;
    height: 22px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.4rem;
}

.woo-orders-bar .btn-icon {
    color: rgba(255,255,255,0.9);
}

.woo-orders-bar .btn-icon:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.woo-section {
    margin-top: 0.55rem;
}

.woo-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.92;
    margin-bottom: 0.35rem;
}

.woo-section-head-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.woo-section-count {
    font-size: 0.75rem;
    font-weight: 800;
    background: rgba(255,255,255,0.18);
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
}

.woo-collapse-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255,255,255,0.14);
    color: #fff;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.woo-collapse-btn:hover {
    background: rgba(255,255,255,0.24);
}

.woo-collapse-btn svg {
    transition: transform var(--transition);
}

.woo-collapse-btn.collapsed svg {
    transform: rotate(-90deg);
}

.woo-orders-list {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.woo-orders-list-processed {
    opacity: 0.88;
}

.woo-orders-list::-webkit-scrollbar { height: 4px; }
.woo-orders-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.4); border-radius: 4px; }

.woo-orders-empty {
    font-size: 0.85rem;
    opacity: 0.85;
    margin: 0;
}

.woo-order-card {
    flex: 0 0 auto;
    min-width: 140px;
    padding: 0.65rem 0.85rem;
    background: rgba(255,255,255,0.95);
    color: var(--text);
    border: 2px solid transparent;
    border-radius: 12px;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.woo-order-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.woo-order-card.active {
    border-color: #fbbf24;
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.5);
}

.woo-order-card-processed {
    background: rgba(255,255,255,0.78);
    border-color: rgba(255,255,255,0.25);
}

.woo-order-num {
    display: block;
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--primary);
}

.woo-order-name {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0.15rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.woo-order-meta {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.cart-woo-tag {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 800;
    background: #7c3aed;
    color: #fff;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    margin-left: 0.35rem;
    vertical-align: middle;
}

/* ---- Form extras ---- */

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    width: 100%;
}

.form-row .form-group {
    min-width: 0;
}

.form-group select,
.form-group textarea {
    padding: 0.85rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: #fafafa;
    transition: border-color var(--transition), background var(--transition);
    outline: none;
    width: 100%;
}

.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    background: #fff;
}

.form-group textarea { resize: vertical; }

.input-color {
    width: 100%;
    height: 46px;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-sm);
    padding: 4px;
    cursor: pointer;
    background: #fafafa;
}

.alert-success {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

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

@media (max-width: 900px) {
    .page-grid-2 { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
    body { padding: 1.2rem; }

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

    .card-primary { grid-column: 1 / -1; }
    .card { padding: 1.6rem 1rem; }
    .card-primary { padding: 2rem 1.5rem; }
    .home-account-bar { margin-top: 0; flex-direction: column; align-items: flex-start; }
    .home-switch-menu { width: 100%; justify-content: flex-start; }

    .pos-layout { flex-direction: column; }

    .pos-cart {
        width: 100%;
        min-width: 0;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }

    .pos-products { overflow-y: auto; }

    .page-content { padding: 1rem; }

    .page-nav-link span { display: none; }
    .page-nav-link { padding: 0.5rem; }

    .page-title-bar { flex-direction: column; align-items: flex-start; }

    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .kpi-value { font-size: 1.2rem; }

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

    .modal.modal-form {
        width: 100%;
        max-width: none;
    }

    .report-print-actions {
        grid-template-columns: 1fr;
    }

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

    .filter-bar { flex-wrap: wrap; }
}

@media (max-width: 440px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .card-primary { flex-direction: column; text-align: center; }
    .kpi-grid { grid-template-columns: 1fr; }
}
