﻿/* ═══════════════════════════════════════════════════════════
   LogicPOS — Feuille de style principale
   ═══════════════════════════════════════════════════════════ */

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --info: #17a2b8;
  --dark: #1e1e2d;
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #2d3748;
  --text-muted: #718096;
  --border: #e2e8f0;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); }

/* ── App Shell ──────────────────────────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: var(--sidebar-width); background: var(--dark); display: flex; flex-direction: column; transition: width .2s; flex-shrink: 0; }
.main-content { flex: 1; overflow-y: auto; background: var(--bg); }
.content-wrapper { padding: 24px; max-width: 1400px; margin: 0 auto; }

/* App Topbar (en-tete societe) */
.app-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: var(--card-bg); border-bottom: 1px solid var(--border); padding: 10px 24px; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 10; }
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-logo { max-height: 40px; max-width: 120px; object-fit: contain; }
.topbar-logo-icon { font-size: 30px; }
.topbar-company { display: block; font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.2; }
.topbar-sub { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.topbar-meta { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); }
.topbar-meta span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.topbar-fy { background: var(--primary); color: #fff; padding: 4px 12px; border-radius: 20px; font-weight: 600; }

/* Variante compacte (mobile / plateformes sans barre de titre native) */
.app-topbar--compact { padding: 8px 14px; gap: 10px; }
.app-topbar--compact .topbar-logo { max-height: 32px; max-width: 90px; }
.app-topbar--compact .topbar-company { font-size: 14px; }
.app-topbar--compact .topbar-sub { font-size: 11px; }
.app-topbar--compact .topbar-meta { font-size: 12px; gap: 12px; }
.app-topbar--compact .topbar-fy { padding: 3px 10px; }

@media (max-width: 600px) {
  .app-topbar--compact { flex-direction: column; align-items: flex-start; }
  .app-topbar--compact .topbar-meta { width: 100%; justify-content: space-between; }
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar-header { padding: 20px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.1); }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 24px; }
.logo-text { color: #fff; font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.sidebar-toggle { background: none; border: none; color: rgba(255,255,255,.6); cursor: pointer; font-size: 18px; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: rgba(255,255,255,.7); text-decoration: none; transition: all .15s; border-left: 3px solid transparent; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.08); color: #fff; border-left-color: var(--primary); }
.nav-icon { font-size: 18px; width: 22px; text-align: center; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: 10px; }
.user-info { flex: 1; }
.user-name { display: block; color: #fff; font-size: 14px; font-weight: 500; }
.user-role { display: block; color: rgba(255,255,255,.5); font-size: 12px; }
.btn-logout { background: rgba(255,255,255,.1); border: none; color: #fff; padding: 8px 12px; border-radius: 6px; cursor: pointer; }

/* ── Auth ───────────────────────────────────────────────── */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%); }
.login-card { background: #fff; border-radius: 16px; padding: 40px; width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-header { text-align: center; margin-bottom: 32px; }
.login-logo { font-size: 56px; margin-bottom: 12px; }
.login-logo-img { max-width: 120px; max-height: 80px; object-fit: contain; margin-bottom: 12px; }
.login-header h1 { font-size: 28px; color: var(--dark); }
.login-header p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.login-footer { text-align: center; margin-top: 24px; color: var(--text-muted); }

/* ── Page Header ────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h2 { font-size: 22px; font-weight: 600; color: var(--text); }
.date-badge { background: var(--card-bg); border: 1px solid var(--border); padding: 6px 14px; border-radius: 20px; font-size: 13px; color: var(--text-muted); text-transform: capitalize; }

/* ── KPI Grid ───────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card { background: var(--card-bg); border-radius: var(--radius); padding: 20px; display: flex; gap: 16px; align-items: center; box-shadow: var(--shadow); border-left: 4px solid var(--border); }
.kpi-card.kpi-sales { border-left-color: var(--primary); }
.kpi-card.kpi-transactions { border-left-color: var(--success); }
.kpi-card.kpi-month { border-left-color: var(--info); }
.kpi-card.kpi-tax { border-left-color: var(--warning); }
.kpi-card.kpi-alert { border-left-color: var(--danger); }
.kpi-card.kpi-ok { border-left-color: var(--success); }
.kpi-icon { font-size: 32px; }
.kpi-value { display: block; font-size: 20px; font-weight: 700; color: var(--text); }
.kpi-label { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Quick Actions ──────────────────────────────────────── */
.quick-actions { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }

/* ── Dashboard Grid ─────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dashboard-card { background: var(--card-bg); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.dashboard-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--text); }
.payment-bar { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }

/* ── POS Layout ─────────────────────────────────────────── */
.pos-layout { display: grid; grid-template-columns: 1fr 380px; gap: 20px; height: calc(100vh - 100px); }
.pos-products { display: flex; flex-direction: column; overflow: hidden; }
.pos-search { margin-bottom: 12px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; overflow-y: auto; flex: 1; }
.product-tile { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; cursor: pointer; text-align: left; transition: all .15s; position: relative; overflow: hidden; }
.product-tile:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); transform: translateY(-1px); }
.product-tile.out-of-stock { opacity: .5; }
.product-tile-color { height: 4px; border-radius: 2px; margin-bottom: 8px; }
.product-tile-name { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 4px; line-height: 1.3; }
.product-tile-price { font-size: 15px; font-weight: 700; color: var(--primary); }
.product-tile-stock { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Cart ───────────────────────────────────────────────── */
.pos-cart { background: var(--card-bg); border-radius: var(--radius); display: flex; flex-direction: column; box-shadow: var(--shadow); overflow: hidden; }
.cart-header { padding: 12px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.cart-customer { flex: 1; }
.cart-lines { flex: 1; overflow-y: auto; padding: 8px; }
.empty-cart { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text-muted); gap: 8px; }
.empty-cart span { font-size: 48px; }
.cart-line { display: flex; align-items: center; gap: 8px; padding: 8px; border-bottom: 1px solid var(--border); }
.cart-line-name { flex: 1; font-size: 13px; font-weight: 500; }
.cart-line-controls { display: flex; align-items: center; gap: 6px; }
.qty-btn { width: 26px; height: 26px; border: 1px solid var(--border); background: var(--bg); border-radius: 4px; cursor: pointer; font-size: 16px; }
.qty-value { min-width: 24px; text-align: center; font-weight: 600; }
.cart-line-price { font-size: 13px; font-weight: 600; color: var(--primary); min-width: 80px; text-align: right; }
.btn-remove { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 14px; }

/* ── Cart Totals ────────────────────────────────────────── */
.cart-totals { padding: 12px; border-top: 1px solid var(--border); background: #fafafa; }
.total-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13px; }
.total-tax { color: var(--text-muted); font-size: 12px; }
.total-grand { font-size: 18px; font-weight: 700; color: var(--text); border-top: 2px solid var(--border); padding-top: 8px; margin-top: 4px; }
.discount-input { display: flex; gap: 8px; align-items: center; }
.discount-input input { width: 70px; }
.btn-checkout { margin: 12px; padding: 14px; font-size: 16px; font-weight: 600; border-radius: 8px; }

/* ── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; outline: none; transition: border-color .15s; background: #fff; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,.15); }
.form-control-sm { padding: 5px 8px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-check-row { display: flex; gap: 24px; margin-top: 8px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }

/* ── Buttons ────────────────────────────────────────────── */
.btn { padding: 8px 18px; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all .15s; display: inline-flex; align-items: center; gap: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #218838; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #c82333; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-warning { background: var(--warning); color: #212529; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Tables ─────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--card-bg); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th { background: #f8fafc; padding: 12px 16px; text-align: left; font-weight: 600; font-size: 13px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.table-hover tbody tr:hover { background: #f8fafc; }
.table-sm th, .table-sm td { padding: 8px 12px; }
.table-total td { background: #f0f2f5; font-weight: 700; }
.table-footer { padding: 8px 16px; font-size: 13px; color: var(--text-muted); }
.row-danger { background: #fff5f5 !important; }
.row-warning { background: #fffbf0 !important; }

/* ── Badges ─────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-secondary { background: #e2e8f0; color: #4a5568; }

/* ── Stock Badges ───────────────────────────────────────── */
.stock-badge { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.group-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ── Modals ─────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-dialog { background: var(--card-bg); border-radius: 12px; width: 500px; max-width: 95vw; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-lg { width: 720px; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-header button { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal-success { text-align: center; padding: 40px; }
.success-icon { font-size: 64px; margin-bottom: 16px; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert { padding: 10px 16px; border-radius: 6px; margin: 12px 0; font-size: 14px; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }

/* ── Filter Bar ─────────────────────────────────────────── */
.filter-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.filter-bar .form-control { max-width: 240px; }

/* ── Stats Row ──────────────────────────────────────────── */
.stats-row { display: flex; gap: 16px; margin-bottom: 16px; }
.stat-chip { background: var(--card-bg); padding: 8px 16px; border-radius: 20px; font-size: 13px; box-shadow: var(--shadow); }

/* ── Report Sections ────────────────────────────────────── */
.report-section { background: var(--card-bg); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.report-section h3 { font-size: 15px; margin-bottom: 16px; }
.progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.progress-label { width: 120px; font-size: 13px; }
.progress-bar-wrap { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s; }
.progress-value { width: 120px; text-align: right; font-size: 13px; color: var(--text-muted); }

/* ── Cash Close ─────────────────────────────────────────── */
.cashclose-status { display: flex; gap: 16px; align-items: center; background: var(--card-bg); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.cashclose-open { border-left: 4px solid var(--success); }
.cashclose-closed { border-left: 4px solid var(--danger); }
.status-icon { font-size: 36px; }
.cashclose-action-card { background: var(--card-bg); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow); }
.cashclose-action-card h3 { margin-bottom: 16px; }
.z-report { background: var(--card-bg); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; border: 2px dashed var(--border); }
.z-report-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.z-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.z-row-total { font-weight: 700; font-size: 16px; }

/* ── Receipt ────────────────────────────────────────────── */
.receipt { font-family: monospace; font-size: 13px; }
.receipt-header { text-align: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 2px dashed var(--border); }
.receipt-totals { margin-top: 12px; border-top: 2px dashed var(--border); padding-top: 12px; }
.receipt-row { display: flex; justify-content: space-between; padding: 4px 0; }
.receipt-grand { font-weight: 700; font-size: 16px; border-top: 1px dashed var(--border); padding-top: 8px; margin-top: 4px; }

/* ── Payment Modal ──────────────────────────────────────── */
.payment-total { font-size: 20px; font-weight: 700; text-align: center; padding: 16px; background: var(--bg); border-radius: 8px; margin-bottom: 16px; }
.payment-method-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.payment-inputs { display: flex; gap: 8px; align-items: center; }
.payment-summary { margin-top: 16px; background: var(--bg); border-radius: 8px; padding: 12px; }
.payment-entry { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 13px; }
.payment-total-paid { font-weight: 700; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; }
.payment-change { color: var(--success); font-weight: 600; }

/* ── Settings ───────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-card { background: var(--card-bg); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.settings-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }

/* ── Misc ───────────────────────────────────────────────── */
.loading-spinner { padding: 40px; text-align: center; color: var(--text-muted); font-size: 18px; }
.empty-state { color: var(--text-muted); font-size: 14px; text-align: center; padding: 24px; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
code { background: #f0f2f5; padding: 2px 6px; border-radius: 4px; font-size: 12px; color: var(--primary); }

/* Menu latéral réduit (icônes seulement) — bouton ☰ */
.app-shell:not(.sidebar-open) .sidebar { width: 60px; }
.app-shell:not(.sidebar-open) .sidebar-header { padding: 20px 0; justify-content: center; }
.app-shell:not(.sidebar-open) .logo,
.app-shell:not(.sidebar-open) .logo-text,
.app-shell:not(.sidebar-open) .nav-label,
.app-shell:not(.sidebar-open) .user-info { display: none; }
.app-shell:not(.sidebar-open) .nav-item { padding: 12px 0; justify-content: center; }
.app-shell:not(.sidebar-open) .sidebar-footer { padding: 16px 0; justify-content: center; }
.sidebar { overflow: hidden; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .pos-layout { grid-template-columns: 1fr; }
  .form-grid, .dashboard-grid, .settings-grid { grid-template-columns: 1fr; }
  /* Petit écran : le menu ouvert se superpose au contenu au lieu de le pousser */
  .app-shell { position: relative; }
  .app-shell.sidebar-open > .main-content { margin-left: 60px; }
  .app-shell.sidebar-open > .sidebar { position: absolute; top: 0; bottom: 0; left: 0; z-index: 50; box-shadow: 4px 0 16px rgba(0,0,0,.35); }
  .content-wrapper { padding: 12px; }
}

/* ── Additions v1.1 ──────────────────────────────────────── */
.kpi-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.z-section-title { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--text-muted); text-transform: uppercase; padding: 8px 0 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); }
.table-total { background: rgba(79,142,247,0.1); font-weight: 700; }
.report-section { background: var(--card-bg); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.report-section h3 { margin-bottom: 14px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.alert-danger { background: rgba(239,68,68,0.1); border-left: 4px solid #ef4444; color: #fca5a5; }
.filter-bar { display: flex; align-items: center; gap: 12px; background: var(--card-bg); padding: 14px 16px; border-radius: var(--radius); margin-bottom: 20px; flex-wrap: wrap; }
@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .quick-actions { gap: 6px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
}

/* ── Blazor error UI — caché par défaut, visible uniquement si Blazor le force ── */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #7b1d1d;
    color: #fca5a5;
    padding: 8px 16px;
    font-size: 13px;
    z-index: 10000;
}
#blazor-error-ui .reload { color: #fcd34d; margin-left: 8px; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; color: #fca5a5; }

/* ── Icônes boutons (compatibles MAUI WebView) ────────────── */
.btn .icon-edit::before  { content: "\270F\FE0F"; }
.btn .icon-del::before   { content: "\1F5D1\FE0F"; }
.btn .icon-new::before   { content: "\1F4C4"; }
.btn .icon-adj::before   { content: "Ajuster"; }
.btn .icon-view::before  { content: "Voir"; }

.btn-icon-edit  { background:#e8f0fe; color:#1a73e8; border:1px solid #1a73e8; }
.btn-icon-edit:hover { background:#1a73e8; color:#fff; }
.btn-icon-del   { background:#fce8e6; color:#d93025; border:1px solid #d93025; }
.btn-icon-del:hover  { background:#d93025; color:#fff; }
.btn-icon-adj   { background:#e6f4ea; color:#1e8e3e; border:1px solid #1e8e3e; }
.btn-icon-adj:hover  { background:#1e8e3e; color:#fff; }
.btn-icon-view  { background:#fef7e0; color:#f57c00; border:1px solid #f57c00; }
.btn-icon-view:hover { background:#f57c00; color:#fff; }

/* ── Tabs ─────────────────────────────────────────────────── */
.tab-bar { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.tab-btn { background: none; border: none; padding: 8px 18px; cursor: pointer; font-size: 14px; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; border-radius: 4px 4px 0 0; transition: all .2s; }
.tab-btn:hover { background: #f0f2f5; color: var(--primary); }
.tab-active { color: var(--primary) !important; border-bottom-color: var(--primary) !important; font-weight: 600; }

/* ── Color Swatch ─────────────────────────────────────────── */
.color-swatch { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); vertical-align: middle; }

/* ── Modal XL ─────────────────────────────────────────────── */
.modal-xl { max-width: 860px !important; width: 96vw; }
.topbar-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.3; }
.login-titlebar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; background: var(--card-bg); border-bottom: 1px solid var(--border); padding: 8px 14px; font-size: 12px; font-weight: 600; color: var(--text); }
.popup-icon { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; }
.modal-header h3 { display: flex; align-items: center; gap: 8px; }
.login-popup-title { display: flex; align-items: center; gap: 8px; margin: -40px -40px 28px; padding: 12px 20px; background: #9ca3af; color: #111827; border-bottom: 1px solid #6b7280; font-size: 14px; font-weight: 600; border-radius: 16px 16px 0 0; }

/* ── Caisse tactile v1.3 ─────────────────────────────────── */
.pos-search-input { font-size: 16px; padding: 12px 14px; }
.group-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 4px; flex-shrink: 0; }
.chip { --chip-color: var(--primary); border: 2px solid var(--chip-color); background: #fff; color: var(--text); border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; min-height: 40px; }
.chip-active { background: var(--chip-color); color: #fff; }
.chip-sm { padding: 4px 10px; min-height: 32px; font-size: 13px; }
.pos-message { cursor: pointer; margin-bottom: 8px; padding: 8px 12px; }
.product-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); align-content: start; }
.product-tile { min-height: 96px; padding: 12px; }
.product-tile:active { transform: scale(.97); }
.product-tile:disabled { cursor: not-allowed; }
.product-tile-price small { font-size: 11px; font-weight: 400; color: var(--text-muted); }
.cart-line-name { cursor: pointer; }
.cart-line-sub { display: block; font-size: 11px; font-weight: 400; color: var(--text-muted); }
.qty-btn { width: 36px; height: 36px; font-size: 20px; }
.qty-value { min-width: 44px; height: 36px; border: 1px solid var(--border); background: #fff; border-radius: 4px; cursor: pointer; font-size: 15px; }
.btn-remove { font-size: 18px; padding: 6px; }
.discount-input .chip-sm { min-width: 32px; padding: 2px 8px; }
.discount-input input { width: 64px; }
.btn-checkout { min-height: 56px; font-size: 18px; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.keypad-key { min-height: 52px; font-size: 22px; font-weight: 600; border: 1px solid var(--border); background: #fff; border-radius: 10px; cursor: pointer; }
.keypad-key:active { background: var(--bg); transform: scale(.96); }
.quick-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.edit-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.edit-field { border: 2px solid var(--border); background: #fff; border-radius: 10px; padding: 10px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.edit-field strong { font-size: 26px; }
.edit-field small { color: var(--text-muted); }
.edit-field-active { border-color: var(--primary); background: rgba(79,142,247,.08); }

.modal-pay { max-width: 820px; width: 96vw; }
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.pay-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin: 10px 0 6px; }
.pay-methods { display: flex; flex-wrap: wrap; gap: 8px; }
.pay-method { border: 2px solid var(--border); background: #fff; border-radius: 10px; padding: 10px 14px; font-size: 14px; font-weight: 600; cursor: pointer; min-height: 48px; }
.pay-active { border-color: var(--success, #22c55e); background: rgba(34,197,94,.1); }
.pay-amount { font-size: 32px; font-weight: 700; text-align: right; padding: 10px 14px; border: 2px solid var(--border); border-radius: 10px; background: var(--bg); }
.pay-amount small { font-size: 16px; color: var(--text-muted); }
.payment-usd { font-size: 14px; font-weight: 400; color: var(--text-muted); }

@media (max-width: 768px) {
  .pos-layout { height: auto; }
  .product-grid { max-height: 45vh; }
  .pay-grid { grid-template-columns: 1fr; }
  .modal-pay { max-height: 94vh; overflow-y: auto; }
}

/* ── Stock v1.4 ─────────────────────────────────────────── */
.picker-selected { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border: 2px solid var(--primary); border-radius: 8px; background: rgba(79,142,247,.08); }
.picker-results { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-height: 240px; overflow-y: auto; }
.picker-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; font-size: 14px; }
.picker-item:hover { background: var(--bg); border-color: var(--primary); }
.picker-item small { color: var(--text-muted); }
.alert-info { background: rgba(79,142,247,.1); border: 1px solid rgba(79,142,247,.35); color: var(--text); }
.alert-success { cursor: pointer; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

/* ── Clients & fournisseurs v1.5 ───────────────────────── */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.detail-balance { display: flex; flex-direction: column; align-items: flex-end; padding: 10px 16px; border-radius: 10px; background: var(--bg); min-width: 170px; }
.detail-balance strong { font-size: 22px; }
.detail-balance small { color: var(--text-muted); }
.detail-owing strong { color: var(--danger); }
.detail-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 12px; }
.detail-kpis > div { background: var(--bg); border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; }
.detail-kpis small { color: var(--text-muted); font-size: 12px; }
.detail-kpis strong { font-size: 16px; }
.empty-row { text-align: center; color: var(--text-muted); padding: 16px; }

/* ── Caisse & paiements v1.8 ───────────────────────────── */
.diff-box { margin-top: 8px; padding: 8px 12px; border-radius: 6px; font-size: 13px; }
.diff-ok { background: rgba(16,185,129,0.12); color: #047857; }
.diff-bad { background: rgba(239,68,68,0.12); color: #b91c1c; }
.bill-row { display: grid; grid-template-columns: 90px 1fr 90px; gap: 8px; align-items: center; padding: 3px 0; }
.bill-row input { padding: 4px 8px; }

/* ── Droits & journal v1.9 ─────────────────────────────── */
.roles-matrix thead th { position: sticky; top: 0; background: var(--card-bg); z-index: 2; }
.roles-matrix .roles-module td { background: var(--bg); padding-top: 10px; }
.roles-matrix input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; }
.roles-matrix input[type=checkbox]:disabled { cursor: not-allowed; }

/* ── Switchboard v2.4 ──────────────────────────────────── */
.sw-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.sw-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 24px; background: var(--card-bg); box-shadow: var(--shadow); }
.sw-brand { display: flex; align-items: center; gap: 12px; }
.sw-brand img { height: 40px; }
.sw-brand strong { display: block; font-size: 18px; }
.sw-brand small, .sw-user small, .sw-footer { color: var(--text-muted); }
.sw-user { display: flex; align-items: center; gap: 16px; }
.sw-user small { display: block; font-size: 12px; }
.sw-main { flex: 1; padding: 24px; max-width: 1100px; width: 100%; margin: 0 auto; }
.sw-intro h2 { margin: 0 0 4px; }
.sw-intro p { margin: 0 0 8px; color: var(--text-muted); }
.sw-section { margin: 24px 0 12px; font-size: 16px; }
.sw-section small { color: var(--text-muted); font-weight: 400; }
.sw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.sw-tile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 18px 12px; border-radius: var(--radius); background: var(--card-bg); box-shadow: var(--shadow); border: 2px solid transparent; color: var(--text); text-decoration: none; transition: transform .1s, border-color .1s; }
.sw-tile:hover { border-color: var(--primary); transform: translateY(-2px); }
.sw-tile .sw-icon { font-size: 34px; }
.sw-tile small { color: var(--text-muted); font-size: 12px; }
.sw-tile--off { opacity: .55; cursor: not-allowed; box-shadow: none; border: 2px dashed var(--border); }
.sw-tile--off:hover { border-color: var(--border); transform: none; }
.sw-tile--off em { font-size: 11px; color: var(--text-muted); }
.sw-footer { text-align: center; padding: 10px; font-size: 12px; }
.module-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; margin-right: 6px; border-radius: 999px; background: var(--bg); font-size: 13px; text-decoration: none; color: var(--text); border: 1px solid var(--border); }
.module-label { padding: 6px 16px; font-size: 12px; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.sw-banner { padding: 8px 24px; font-size: 13px; text-align: center; }
.sw-banner--info { background: rgba(26,115,232,.12); color: var(--text); }
.sw-banner--warn { background: #fff3cd; color: #856404; }
.sw-banner a { margin-left: 8px; font-weight: 600; }
