/* ═══════════════════════════════════════════════════════
   KEMA DEPOT — Design System (PHP version)
   ═══════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary-50:#eff6ff;--primary-100:#dbeafe;--primary-200:#bfdbfe;
  --primary-300:#93c5fd;--primary-400:#60a5fa;--primary-500:#3b82f6;
  --primary-600:#2563eb;--primary-700:#1d4ed8;--primary-800:#1e40af;--primary-900:#1e3a8a;
  --accent-400:#c084fc;--accent-500:#a855f7;--accent-600:#9333ea;
  --emerald-50:#ecfdf5;--emerald-400:#34d399;--emerald-500:#10b981;--emerald-600:#059669;
  --amber-50:#fffbeb;--amber-400:#fbbf24;--amber-500:#f59e0b;--amber-600:#d97706;
  --rose-50:#fff1f2;--rose-400:#fb7185;--rose-500:#f43f5e;--rose-600:#e11d48;
  --sky-50:#f0f9ff;--sky-400:#38bdf8;--sky-500:#0ea5e9;
  --slate-50:#f8fafc;--slate-100:#f1f5f9;--slate-200:#e2e8f0;--slate-300:#cbd5e1;
  --slate-400:#94a3b8;--slate-500:#64748b;--slate-600:#475569;--slate-700:#334155;
  --slate-800:#1e293b;--slate-900:#0f172a;--slate-950:#020617;
  --surface-bg:#f4f7fb;--surface-card:rgba(255,255,255,0.85);--surface-elevated:#ffffff;
  --surface-sidebar:rgba(12,18,34,0.7);--surface-sidebar-hover:rgba(255,255,255,.08);
  --surface-sidebar-active:rgba(37,99,235,.2);
  --gradient-primary:linear-gradient(135deg,#3b82f6,#8b5cf6);
  --gradient-success:linear-gradient(135deg,#10b981,#34d399);
  --gradient-danger:linear-gradient(135deg,#f43f5e,#fb7185);
  --gradient-warning:linear-gradient(135deg,#f59e0b,#fbbf24);
  --gradient-info:linear-gradient(135deg,#0ea5e9,#38bdf8);
  --gradient-dark:linear-gradient(135deg,#1e293b,#334155);
  --gradient-sidebar:linear-gradient(180deg,rgba(12,18,34,0.75) 0%,rgba(19,27,46,0.85) 100%);
  --shadow-xs:0 1px 2px rgba(0,0,0,.04);
  --shadow-sm:0 1px 3px rgba(0,0,0,.06),0 1px 2px rgba(0,0,0,.04);
  --shadow-md:0 4px 6px -1px rgba(0,0,0,.07),0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg:0 10px 15px -3px rgba(0,0,0,.08),0 4px 6px -4px rgba(0,0,0,.05);
  --shadow-xl:0 20px 25px -5px rgba(0,0,0,.08),0 8px 10px -6px rgba(0,0,0,.04);
  --shadow-2xl:0 25px 50px -12px rgba(0,0,0,.15);
  --shadow-primary:0 8px 20px rgba(59,130,246,.35);
  --shadow-card:0 4px 20px rgba(0,0,0,.03),inset 0 1px 0 rgba(255,255,255,.6);
  --shadow-card-hover:0 12px 30px rgba(0,0,0,.08),inset 0 1px 0 rgba(255,255,255,.8);
  --radius-sm:8px;--radius-md:12px;--radius-lg:16px;--radius-xl:20px;
  --radius-2xl:24px;--radius-full:9999px;
  --transition-fast:150ms cubic-bezier(.4,0,.2,1);
  --transition-base:250ms cubic-bezier(.4,0,.2,1);
  --transition-slow:350ms cubic-bezier(.4,0,.2,1);
  --sidebar-width:280px;--sidebar-collapsed:80px;
}

/* ─── Dark Theme ─── */
[data-theme="dark"] {
  --surface-bg:#0a0c10;--surface-card:rgba(22,27,39,0.7);--surface-elevated:#1e2533;
  --slate-50:#1e2533;--slate-100:#262d3b;--slate-200:#2d3648;--slate-300:#3d4a5f;
  --slate-400:#8896b3;--slate-500:#7a8ba5;--slate-600:#9aaccc;--slate-700:#b8cae0;
  --slate-800:#d1dcee;--slate-900:#f8fafc;
  --shadow-card:0 4px 20px rgba(0,0,0,.4),inset 0 1px 0 rgba(255,255,255,.05);
  --shadow-card-hover:0 12px 30px rgba(0,0,0,.6),inset 0 1px 0 rgba(255,255,255,.1);
}

*,*::before,*::after{margin:0;padding:0;box-sizing:border-box;}
html{font-size:16px;scroll-behavior:smooth;-webkit-font-smoothing:antialiased;}
body{font-family:'Plus Jakarta Sans',system-ui,sans-serif;background:var(--surface-bg);color:var(--slate-900);line-height:1.6;overflow-x:hidden;}
a{text-decoration:none;color:inherit;}
button{cursor:pointer;font-family:inherit;border:none;background:none;}
input,select,textarea{font-family:inherit;font-size:inherit;}

/* ─── Layout ─── */
.app-layout{display:flex;min-height:100vh;}
.main-area{flex:1;min-width:0;margin-left:var(--sidebar-width);min-height:100vh;transition:margin-left var(--transition-base);}
.page-content{width:100%;min-width:0;padding:2rem 2.5rem;max-width:1440px;animation:fadeInUp .5s cubic-bezier(0.16, 1, 0.3, 1);}
@keyframes fadeInUp{from{opacity:0;transform:translateY(20px);}to{opacity:1;transform:translateY(0);}}

/* ─── Sidebar ─── */
.sidebar{width:var(--sidebar-width);height:100vh;position:fixed;top:0;left:0;z-index:100;
  background:var(--gradient-sidebar);display:flex;flex-direction:column;
  backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);
  transition:transform var(--transition-base),width var(--transition-base);border-right:1px solid rgba(255,255,255,.08);}
.sidebar-brand{padding:1.75rem 1.5rem;display:flex;align-items:center;gap:.875rem;border-bottom:1px solid rgba(255,255,255,.06);}
.sidebar-brand-icon{width:42px;height:42px;background:var(--gradient-primary);border-radius:var(--radius-md);
  display:flex;align-items:center;justify-content:center;color:white;font-weight:800;font-size:1.15rem;
  flex-shrink:0;box-shadow:0 4px 12px rgba(37,99,235,.5);}
.sidebar-brand-name{color:#fff;font-weight:800;font-size:1.125rem;letter-spacing:-.02em;}
.sidebar-brand-tagline{color:rgba(255,255,255,.6);font-size:.7rem;font-weight:500;text-transform:uppercase;letter-spacing:.08em;}
.sidebar-brand-text{display:flex;flex-direction:column;}
.sidebar-nav{flex:1;padding:1rem .75rem;overflow-y:auto;}
.sidebar-nav-section{margin-bottom:1.5rem;}
.sidebar-nav-label{padding:0 .75rem;margin-bottom:.6rem;color:rgba(255,255,255,.4);font-size:.65rem;font-weight:700;text-transform:uppercase;letter-spacing:.12em;}
.sidebar-link{display:flex;align-items:center;gap:.85rem;padding:.75rem .875rem;border-radius:var(--radius-sm);
  color:rgba(255,255,255,.65);font-size:.875rem;font-weight:600;transition:all var(--transition-fast);
  margin-bottom:4px;position:relative;overflow:hidden;}
.sidebar-link::before{content:'';position:absolute;left:0;top:50%;transform:translateY(-50%);
  width:4px;height:0;background:var(--gradient-primary);border-radius:0 4px 4px 0;transition:height .3s cubic-bezier(0.16, 1, 0.3, 1);}
.sidebar-link:hover{background:var(--surface-sidebar-hover);color:var(--slate-100);transform:translateX(4px);}
.sidebar-link.active{background:var(--surface-sidebar-active);color:#fff;}
.sidebar-link.active::before{height:70%;}
.sidebar-link svg{width:20px;height:20px;flex-shrink:0;transition:color var(--transition-fast);}
.sidebar-link.active svg{color:var(--primary-400);}
.sidebar-footer{padding:1rem .75rem;border-top:1px solid rgba(255,255,255,.06);}
.sidebar-user{display:flex;align-items:center;gap:.75rem;padding:.75rem;border-radius:var(--radius-sm);transition:background var(--transition-fast);}
.sidebar-user:hover{background:var(--surface-sidebar-hover);}
.sidebar-user-avatar{width:36px;height:36px;border-radius:var(--radius-sm);background:var(--gradient-primary);
  display:flex;align-items:center;justify-content:center;color:white;font-weight:700;font-size:.8rem;flex-shrink:0;}
.sidebar-user-info{flex:1;min-width:0;}
.sidebar-user-name{color:#fff;font-size:.8rem;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.sidebar-user-role{color:rgba(255,255,255,.5);font-size:.7rem;}

/* ─── Top Header ─── */
.top-header{padding:1.25rem 2.5rem;display:flex;align-items:center;justify-content:space-between;
  background:rgba(255,255,255,.6);backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);
  border-bottom:1px solid rgba(226,232,240,.6);
  position:sticky;top:0;z-index:50;}
[data-theme="dark"] .top-header{background:rgba(10,12,16,.65);border-bottom:1px solid rgba(255,255,255,.06);}
.header-left{display:flex;align-items:center;gap:.75rem;}
.header-right{display:flex;align-items:center;gap:1rem;}
.header-icon-btn{width:42px;height:42px;border-radius:50%;display:flex;align-items:center;justify-content:center;
  color:var(--slate-500);transition:all var(--transition-fast);position:relative;background:var(--surface-elevated);box-shadow:var(--shadow-sm);}
.header-icon-btn:hover{background:var(--primary-50);color:var(--primary-600);transform:translateY(-2px);box-shadow:var(--shadow-md);}
[data-theme="dark"] .header-icon-btn:hover{background:var(--slate-800);color:var(--slate-100);}
.header-icon-btn .notif-dot{position:absolute;top:10px;right:10px;width:8px;height:8px;background:var(--rose-500);
  border-radius:50%;border:2px solid var(--surface-bg);}
.mobile-menu-btn{display:none;align-items:center;justify-content:center;width:42px;height:42px;
  border-radius:var(--radius-sm);color:var(--slate-600);transition:var(--transition-fast);background:var(--surface-elevated);}
.mobile-menu-btn:hover{background:var(--slate-100);}

/* ─── Page Header ─── */
.page-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:2rem;}
.page-header h1{font-size:1.5rem;font-weight:700;color:var(--slate-900);letter-spacing:-.02em;}
.page-header p{color:var(--slate-500);font-size:.85rem;margin-top:.15rem;}
.header-date{font-size:.78rem;color:var(--slate-400);}

/* ─── Stat Cards ─── */
.stats-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:1.5rem;margin-bottom:2rem;}
.stat-card{background:var(--surface-card);border-radius:var(--radius-xl);padding:1.75rem;
  box-shadow:var(--shadow-card);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);
  display:flex;align-items:flex-start;justify-content:space-between;transition:all var(--transition-base);
  position:relative;overflow:hidden;border:1px solid rgba(255,255,255,.4);}
[data-theme="dark"] .stat-card{border:1px solid rgba(255,255,255,.05);}
.stat-card::after{content:'';position:absolute;top:0;left:0;right:0;height:4px;opacity:0;transition:opacity var(--transition-base);}
.stat-card:hover{transform:translateY(-6px);box-shadow:var(--shadow-card-hover);}
.stat-card:hover::after{opacity:1;}
.stat-card.primary::after{background:var(--gradient-primary);}
.stat-card.success::after{background:var(--gradient-success);}
.stat-card.warning::after{background:var(--gradient-warning);}
.stat-card.danger::after{background:var(--gradient-danger);}
.stat-label{font-size:.85rem;font-weight:600;color:var(--slate-500);margin-bottom:.5rem;text-transform:uppercase;letter-spacing:.05em;}
.stat-value{font-size:2rem;font-weight:800;color:var(--slate-900);letter-spacing:-.03em;line-height:1.2;}
.stat-change{display:inline-flex;align-items:center;gap:.35rem;font-size:.78rem;font-weight:700;
  margin-top:.75rem;padding:.3rem .65rem;border-radius:var(--radius-full);}
.stat-change.up{color:var(--emerald-600);background:var(--emerald-50);}
.stat-change.down{color:var(--rose-600);background:var(--rose-50);}
.stat-icon-box{width:56px;height:56px;border-radius:16px;display:flex;align-items:center;justify-content:center;flex-shrink:0;box-shadow:var(--shadow-sm);}
.stat-icon-box.primary{background:linear-gradient(135deg, var(--primary-50), var(--primary-100));color:var(--primary-600);}
.stat-icon-box.success{background:linear-gradient(135deg, var(--emerald-50), var(--emerald-100));color:var(--emerald-600);}
.stat-icon-box.warning{background:linear-gradient(135deg, var(--amber-50), var(--amber-100));color:var(--amber-600);}
.stat-icon-box.danger{background:linear-gradient(135deg, var(--rose-50), var(--rose-100));color:var(--rose-600);}
[data-theme="dark"] .stat-icon-box.primary{background:rgba(37,99,235,.15);}
[data-theme="dark"] .stat-icon-box.success{background:rgba(16,185,129,.15);}
[data-theme="dark"] .stat-icon-box.warning{background:rgba(245,158,11,.15);}
[data-theme="dark"] .stat-icon-box.danger{background:rgba(244,63,94,.15);}
.currency-mark{font-size:.8rem;font-weight:900;letter-spacing:.08em;line-height:1;text-transform:uppercase;margin-left:.1rem;}

body.sidebar-hidden .sidebar{transform:translateX(calc(-1 * var(--sidebar-width)));
  box-shadow:none;pointer-events:none;}
body.sidebar-hidden .main-area{margin-left:0;}

/* ─── Cards ─── */
.card{background:var(--surface-card);border-radius:var(--radius-xl);box-shadow:var(--shadow-card);
  backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);
  border:1px solid rgba(255,255,255,.4);overflow:hidden;}
[data-theme="dark"] .card{border:1px solid rgba(255,255,255,.05);}
.card-header{padding:1.5rem 1.75rem;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid rgba(226,232,240,.4);}
[data-theme="dark"] .card-header{border-bottom:1px solid rgba(255,255,255,.06);}
.card-header h3{font-size:1.1rem;font-weight:800;color:var(--slate-800);letter-spacing:-.01em;}
.card-body{padding:1.75rem;}
.card-body.no-padding{padding:0;}

/* ─── Tables ─── */
.data-table{width:100%;border-collapse:collapse;}
.data-table thead th{text-align:left;padding:1rem 1.5rem;background:rgba(241,245,249,.5);color:var(--slate-500);
  font-size:.78rem;font-weight:700;text-transform:uppercase;letter-spacing:.08em;white-space:nowrap;border-bottom:1px solid var(--slate-100);}
[data-theme="dark"] .data-table thead th{background:rgba(255,255,255,.02);border-bottom:1px solid rgba(255,255,255,.06);}
.data-table tbody td{padding:1.15rem 1.5rem;border-bottom:1px solid var(--slate-100);font-size:.9rem;font-weight:500;color:var(--slate-700);vertical-align:middle;position:relative;}
[data-theme="dark"] .data-table tbody td{border-bottom:1px solid rgba(255,255,255,.04);color:var(--slate-300);}
.data-table tbody tr{transition:background var(--transition-fast), transform var(--transition-fast);position:relative;z-index:1;}
.data-table tbody tr::before{content:'';position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--primary-500);transform:scaleY(0);transition:transform .2s ease;transform-origin:center;}
.data-table tbody tr:hover{background:var(--slate-50);z-index:2;}
[data-theme="dark"] .data-table tbody tr:hover{background:rgba(255,255,255,.03);}
.data-table tbody tr:hover::before{transform:scaleY(1);}
.data-table tbody tr:last-child td{border-bottom:none;}
.text-right{text-align:right;}
.text-center{text-align:center;}
.text-danger{color:var(--rose-500);}

/* ─── Buttons ─── */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:.6rem;padding:.75rem 1.5rem;
  border-radius:var(--radius-sm);font-size:.9rem;font-weight:700;transition:all .3s cubic-bezier(0.16, 1, 0.3, 1);
  white-space:nowrap;cursor:pointer;border:none;}
.btn-primary{background:var(--gradient-primary);color:white;box-shadow:var(--shadow-primary);}
.btn-primary:hover{transform:translateY(-2px) scale(1.02);box-shadow:0 12px 24px rgba(59,130,246,.45);}
.btn-primary:active{transform:translateY(0) scale(0.98);}
.btn-success{background:var(--gradient-success);color:white;box-shadow:0 8px 20px rgba(16,185,129,.3);}
.btn-success:hover{transform:translateY(-2px) scale(1.02);box-shadow:0 12px 24px rgba(16,185,129,.4);}
.btn-danger{background:var(--gradient-danger);color:white;box-shadow:0 8px 20px rgba(244,63,94,.3);}
.btn-danger:hover{transform:translateY(-2px) scale(1.02);box-shadow:0 12px 24px rgba(244,63,94,.4);}
.btn-warning{background:var(--gradient-warning);color:white;}
.btn-ghost{background:transparent;color:var(--slate-600);border:1px solid var(--slate-200);box-shadow:var(--shadow-sm);}
.btn-ghost:hover{background:var(--slate-50);border-color:var(--slate-300);transform:translateY(-2px);}
[data-theme="dark"] .btn-ghost{border-color:rgba(255,255,255,.1);color:var(--slate-300);}
[data-theme="dark"] .btn-ghost:hover{background:rgba(255,255,255,.05);border-color:rgba(255,255,255,.15);}
.btn-sm{padding:.5rem 1rem;font-size:.8rem;}
.btn-lg{padding:1rem 2rem;font-size:1rem;}
.btn-icon{width:42px;height:42px;padding:0;border-radius:var(--radius-md);}
.btn-icon.sm{width:36px;height:36px;border-radius:var(--radius-sm);}
.btn:disabled{opacity:.6;cursor:not-allowed;transform:none!important;box-shadow:none;}

/* ─── Badges ─── */
.badge{display:inline-flex;align-items:center;gap:.35rem;padding:.25rem .65rem;border-radius:var(--radius-full);font-size:.72rem;font-weight:600;white-space:nowrap;}
.badge-success{background:var(--emerald-50);color:var(--emerald-600);}
.badge-warning{background:var(--amber-50);color:var(--amber-600);}
.badge-danger{background:var(--rose-50);color:var(--rose-600);}
.badge-primary{background:var(--primary-50);color:var(--primary-600);}
.badge-neutral{background:var(--slate-100);color:var(--slate-600);}
.badge-dot{width:6px;height:6px;border-radius:50%;background:currentColor;}

/* ─── Forms ─── */
.form-group{margin-bottom:1.5rem;}
.form-label{display:block;margin-bottom:.5rem;font-size:.85rem;font-weight:700;color:var(--slate-700);}
.form-input,.form-select,.form-textarea{width:100%;padding:.8rem 1rem;border:1.5px solid var(--slate-200);
  border-radius:var(--radius-md);font-size:.9rem;color:var(--slate-800);background:var(--surface-elevated);
  transition:all .3s cubic-bezier(0.16, 1, 0.3, 1);box-shadow:var(--shadow-xs);}
.form-input:focus,.form-select:focus,.form-textarea:focus{outline:none;border-color:var(--primary-400);box-shadow:0 0 0 4px rgba(59,130,246,.15);transform:translateY(-1px);}
.form-input::placeholder{color:var(--slate-400);}
[data-theme="dark"] .form-input, [data-theme="dark"] .form-select, [data-theme="dark"] .form-textarea{border-color:rgba(255,255,255,.1);background:rgba(0,0,0,.2);}
[data-theme="dark"] .form-input:focus, [data-theme="dark"] .form-select:focus, [data-theme="dark"] .form-textarea:focus{border-color:var(--primary-500);box-shadow:0 0 0 4px rgba(59,130,246,.25);}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;}
.form-grid .full-width{grid-column:span 2;}
.form-actions{display:flex;justify-content:flex-end;margin-top:1.75rem;gap:1rem;}

/* ─── Modal ─── */
.modal-overlay{position:fixed;inset:0;background:rgba(10,15,25,.65);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);
  z-index:1400;display:flex;align-items:center;justify-content:center;animation:fadeIn .3s ease;padding:1rem;}
@keyframes fadeIn{from{opacity:0;}to{opacity:1;}}
.modal-box{background:var(--surface-card);border-radius:var(--radius-2xl);box-shadow:0 25px 50px -12px rgba(0,0,0,.3);
  backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);border:1px solid rgba(255,255,255,.5);
  max-width:440px;width:92%;text-align:center;padding:2.5rem;animation:modalScale .3s cubic-bezier(0.16, 1, 0.3, 1);}
@keyframes modalScale{from{opacity:0;transform:scale(.9) translateY(20px);}to{opacity:1;transform:scale(1) translateY(0);}}
.modal-icon{width:64px;height:64px;border-radius:50%;display:flex;align-items:center;justify-content:center;margin:0 auto 1.5rem;box-shadow:var(--shadow-md);}
.modal-icon.danger{background:linear-gradient(135deg, var(--rose-50), var(--rose-100));color:var(--rose-600);}
.modal-icon.success{background:linear-gradient(135deg, var(--emerald-50), var(--emerald-100));color:var(--emerald-600);}
.modal-icon.info{background:linear-gradient(135deg, var(--primary-50), var(--primary-100));color:var(--primary-600);}
.modal-title{font-size:1.35rem;font-weight:800;color:var(--slate-900);margin-bottom:.75rem;}
.modal-text{font-size:.95rem;color:var(--slate-500);line-height:1.6;margin-bottom:2rem;}
.modal-actions{display:flex;gap:1rem;justify-content:center;}
.modal-actions .btn{flex:1;padding:.85rem;}

/* ─── Login ─── */
.login-page{min-height:100vh;display:flex;align-items:center;justify-content:center;
  background:var(--surface-bg);padding:2rem;position:relative;overflow:hidden;}
.login-page::before{content:'';position:absolute;width:600px;height:600px;background:var(--gradient-primary);
  border-radius:50%;filter:blur(100px);opacity:.15;top:-100px;left:-100px;z-index:0;animation:floatAnim 10s infinite alternate ease-in-out;}
@keyframes floatAnim{0%{transform:translate(0,0);}100%{transform:translate(50px,50px);}}
.login-form-container{width:100%;max-width:420px;background:var(--surface-card);
  backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border:1px solid rgba(255,255,255,.5);
  border-radius:var(--radius-2xl);box-shadow:var(--shadow-2xl);padding:3rem;position:relative;z-index:1;}
.login-logo{width:64px;height:64px;background:var(--gradient-primary);border-radius:var(--radius-lg);
  display:flex;align-items:center;justify-content:center;color:white;font-weight:800;font-size:1.5rem;
  margin-bottom:2rem;box-shadow:var(--shadow-primary);}
.login-form-container h1{font-size:2rem;font-weight:800;color:var(--slate-900);margin-bottom:.5rem;letter-spacing:-.03em;}
.login-subtitle{color:var(--slate-500);font-size:.95rem;margin-bottom:2.5rem;}
.login-form .form-group{margin-bottom:1.5rem;}
.login-form .form-input{padding:1rem 1.25rem;font-size:.95rem;}
.login-form .btn-primary{width:100%;padding:1rem;font-size:1rem;margin-top:1rem;}
.login-error{background:linear-gradient(135deg, var(--rose-50), var(--rose-100));color:var(--rose-700);padding:1rem 1.25rem;
  border-radius:var(--radius-sm);font-size:.85rem;font-weight:600;margin-bottom:1.5rem;display:flex;align-items:center;gap:.75rem;}

/* ─── Charts ─── */
.charts-grid{display:grid;grid-template-columns:2fr 1fr;gap:1.5rem;margin-bottom:2rem;}
.chart-container{height:300px;position:relative;}
.report-chart-container{height:300px;position:relative;}
.report-chart-sm{height:250px;position:relative;}

/* ─── POS ─── */
.pos-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(360px,400px);gap:1.5rem;width:100%;min-width:0;min-height:calc(100vh - 160px);align-items:start;}
.pos-layout > section,.pos-layout > aside,.pos-products-card{min-width:0;}
.pos-products-card{background:transparent;border:none;box-shadow:none;}
.pos-products-card .card-body{padding:0;}
.pos-products-toolbar{display:flex;gap:1rem;align-items:center;margin-bottom:1.25rem;}
.pos-products-meta{font-size:.85rem;font-weight:600;color:var(--slate-500);white-space:nowrap;}
.pos-products-search{position:relative;flex:1;}
.pos-products-search input{width:100%;padding:1rem 1.25rem 1rem 3rem;border:1.5px solid var(--slate-200);
  border-radius:var(--radius-lg);font-size:.95rem;background:var(--surface-elevated);transition:all var(--transition-fast);box-shadow:var(--shadow-sm);}
.pos-products-search input:focus{outline:none;border-color:var(--primary-400);box-shadow:0 0 0 4px rgba(59,130,246,.15);transform:translateY(-1px);}
.pos-products-search .search-icon{position:absolute;left:1.1rem;top:50%;transform:translateY(-50%);color:var(--slate-400);}

.pos-category-chips{display:flex;gap:.5rem;overflow:auto hidden;scrollbar-width:thin;padding-bottom:.5rem;margin-bottom:1.25rem;}
.pos-category-chip{display:inline-flex;align-items:center;gap:.5rem;padding:.5rem .85rem;border:1.5px solid var(--slate-200);
  border-radius:999px;background:var(--surface-card);font-size:.82rem;font-weight:700;color:var(--slate-600);white-space:nowrap;transition:all .25s ease;}
.pos-category-chip span{font-size:.75rem;color:var(--slate-400);font-weight:600;}
.pos-category-chip:hover{border-color:var(--primary-300);color:var(--primary-600);transform:translateY(-2px);box-shadow:var(--shadow-sm);}
.pos-category-chip.active{background:var(--primary-50);border-color:var(--primary-400);color:var(--primary-700);box-shadow:0 4px 12px rgba(59,130,246,.15);}

.pos-products-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:1rem;}
.pos-product-card{background:var(--surface-card);border:1px solid rgba(255,255,255,.5);border-radius:var(--radius-lg);
  padding:1rem;cursor:pointer;transition:all .3s cubic-bezier(0.16, 1, 0.3, 1);position:relative;overflow:hidden;user-select:none;min-height:135px;
  backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);box-shadow:var(--shadow-card);}
.pos-product-card:hover{border-color:var(--primary-300);transform:translateY(-4px);box-shadow:var(--shadow-card-hover);}
.pos-product-card:active{transform:scale(.97);}
.pos-product-card.out{opacity:.6;filter:grayscale(60%);}
.pos-product-bar{width:100%;height:6px;border-radius:3px;background:var(--gradient-primary);margin-bottom:1rem;opacity:.8;}
.pos-product-bar.out{background:linear-gradient(135deg,#f43f5e,#be123c);}
.pos-product-bar.warning{background:var(--gradient-warning);}
.pos-product-name{font-weight:800;font-size:.9rem;color:var(--slate-800);line-height:1.3;margin-bottom:.4rem;}
.pos-product-category{font-size:.75rem;color:var(--slate-500);margin-bottom:.3rem;}
.pos-product-code{font-size:.7rem;color:var(--slate-400);margin-bottom:.4rem;}
.pos-product-price{font-weight:900;font-size:1rem;color:var(--primary-600);}
.pos-product-stock{font-size:.75rem;color:var(--slate-500);margin-top:.4rem;font-weight:700;}
.pos-product-stock.low{color:var(--amber-600);}
.pos-product-stock.out{color:var(--rose-600);}
.pos-product-cart-badge{position:absolute;top:.75rem;right:.75rem;width:24px;height:24px;border-radius:50%;
  background:var(--gradient-primary);color:white;font-size:.75rem;font-weight:800;display:flex;align-items:center;
  justify-content:center;box-shadow:var(--shadow-primary);animation:popIn .25s cubic-bezier(0.16, 1, 0.3, 1);}
@keyframes popIn{from{transform:scale(0);}to{transform:scale(1);}}

.pos-cart{background:var(--surface-card);border-radius:var(--radius-xl);border:1px solid rgba(255,255,255,.5);
  box-shadow:var(--shadow-card);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);
  display:flex;flex-direction:column;height:min(750px,calc(100vh - 120px));min-height:400px;position:sticky;top:100px;overflow:hidden;}
.pos-cart-header{flex:0 0 auto;padding:1.25rem 1.5rem;border-bottom:1px solid rgba(226,232,240,.4);display:flex;align-items:center;justify-content:space-between;gap:.75rem;}
.pos-cart-header h3{font-size:1.15rem;font-weight:800;color:var(--slate-800);}
.pos-cart-header-right{display:flex;align-items:center;gap:.5rem;}
.pos-cart-title-group{display:flex;align-items:center;gap:.6rem;min-width:0;}
.pos-cart-close{display:none;width:44px;height:44px;border-radius:var(--radius-sm);align-items:center;justify-content:center;color:var(--slate-600);flex:0 0 auto;}
.pos-cart-close:hover{background:var(--slate-100);color:var(--slate-900);}
.pos-cart-count{background:var(--primary-50);color:var(--primary-600);font-size:.8rem;font-weight:800;
  padding:.2rem .6rem;border-radius:var(--radius-full);}
.pos-cart-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;}
.pos-cart-items{min-height:150px;padding:0 1.5rem 1.25rem;}
.pos-cart-items-title{position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;
  padding:1rem 0 .75rem;background:rgba(255,255,255,.9);backdrop-filter:blur(8px);border-bottom:1px solid rgba(226,232,240,.4);
  color:var(--slate-700);font-size:.8rem;font-weight:800;text-transform:uppercase;letter-spacing:.05em;}
.pos-cart-items-title span{color:var(--primary-600);font-size:.7rem;letter-spacing:0;text-transform:none;}
.pos-cart-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:110px;
  color:var(--slate-400);gap:.75rem;opacity:.6;}
.pos-cart-item{display:flex;align-items:center;gap:.75rem;padding:.75rem 0;
  border-bottom:1px solid var(--slate-50);animation:fadeInUp .2s ease;}
.pos-cart-item-info{flex:1;min-width:0;}
.pos-cart-item-name{font-weight:700;font-size:.8rem;color:var(--slate-800);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.pos-cart-item-price{font-size:.72rem;color:var(--slate-500);}
.pos-cart-item-qty{display:flex;align-items:center;gap:.4rem;}
.pos-cart-item-qty button{width:26px;height:26px;border-radius:6px;background:var(--slate-100);color:var(--slate-600);
  display:flex;align-items:center;justify-content:center;font-size:.85rem;font-weight:600;transition:all var(--transition-fast);}
.pos-cart-item-qty button:hover{background:var(--primary-100);color:var(--primary-600);}
.pos-cart-item-qty span{font-weight:700;font-size:.85rem;width:24px;text-align:center;}
.pos-cart-remove{width:24px;height:24px;border-radius:50%;border:1px solid var(--slate-200);font-size:1rem;line-height:1;color:var(--slate-400);}
.pos-cart-remove:hover{background:var(--rose-50);color:var(--rose-500);border-color:var(--rose-200);}
.pos-cart-item-total{font-weight:700;font-size:.82rem;color:var(--slate-800);min-width:65px;text-align:right;}
.pos-cart-checkout-fields{border-top:2px dashed var(--slate-200);padding:1rem 1.25rem .45rem;}
.pos-cart-field{margin-bottom:.8rem;}
.pos-cart-summary-row{display:flex;justify-content:space-between;margin-bottom:.35rem;font-size:.82rem;color:var(--slate-500);}
.pos-cart-total-row{display:flex;justify-content:space-between;font-size:1.15rem;font-weight:800;color:var(--slate-900);
  margin:.75rem 0 1rem;padding-top:.75rem;border-top:1px solid var(--slate-100);}
.pos-cart-actions{flex:0 0 auto;border-top:1px solid var(--slate-100);padding:.8rem 1.25rem calc(.8rem + env(safe-area-inset-bottom));background:var(--surface-card);}
.pos-cart-actions .btn-primary{width:100%;min-height:48px;padding:.75rem 1rem;font-size:.95rem;}
.pos-checkout-spinner{display:none;width:17px;height:17px;border:2px solid rgba(255,255,255,.45);border-top-color:#fff;border-radius:50%;animation:posSpin .75s linear infinite;}
.pos-cart-actions .is-loading > svg{display:none;}
.pos-cart-actions .is-loading .pos-checkout-spinner{display:inline-block;}
@keyframes posSpin{to{transform:rotate(360deg);}}
.pos-discount-input{width:70px;border:1px solid var(--slate-200);border-radius:5px;padding:.2rem .4rem;
  font-size:.78rem;margin-left:.35rem;background:var(--surface-elevated);color:var(--slate-800);}
.pos-discount-input:focus{outline:none;border-color:var(--primary-400);box-shadow:0 0 0 3px var(--primary-50);}

.pos-promo-banner{margin-bottom:.85rem;}
.pos-promo-banner-box{background:linear-gradient(135deg,rgba(37,99,235,.07),rgba(14,165,233,.08));border:1px solid rgba(37,99,235,.2);
  border-radius:var(--radius-md);padding:.65rem .9rem;display:flex;gap:.4rem;align-items:center;flex-wrap:wrap;}
.pos-promo-banner-title{font-size:.78rem;font-weight:700;color:var(--primary-700);margin-right:.25rem;}
.pos-promo-badge{background:#fff;border:1px solid var(--primary-200);color:var(--primary-700);font-size:.7rem;font-weight:700;
  border-radius:999px;padding:.17rem .55rem;}
.pos-promo-applied{display:none;background:linear-gradient(135deg,rgba(16,185,129,.08),rgba(52,211,153,.08));border:1px solid rgba(16,185,129,.25);border-radius:8px;padding:.62rem .8rem;margin-bottom:.7rem;font-size:.76rem;color:var(--emerald-700);}
.pos-promo-applied.show{display:block;}

.pos-cart-toggle,.pos-cart-overlay{display:none;}

/* ─── Invoice ─── */
.invoice-card{max-width:800px;margin:0 auto;}
.invoice-header{display:flex;justify-content:space-between;align-items:flex-start;
  padding-bottom:1.5rem;border-bottom:2px solid var(--slate-100);margin-bottom:2rem;}
.invoice-company h2{font-size:1.5rem;font-weight:800;background:var(--gradient-primary);
  -webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;}
.invoice-company p{color:var(--slate-500);font-size:.85rem;}
.invoice-meta{text-align:right;font-size:.85rem;color:var(--slate-600);}
.invoice-footer{margin-top:3rem;text-align:center;color:var(--slate-400);font-size:.82rem;}
.invoice-modal-panel{background:var(--surface-card);border:1px solid var(--slate-200);border-radius:var(--radius-xl);
  box-shadow:var(--shadow-2xl);max-width:700px;width:94%;max-height:90vh;overflow-y:auto;padding:2.5rem;
  animation:scaleIn .25s ease;}
.invoice-modal-actions{display:flex;gap:.75rem;justify-content:center;margin-top:1.5rem;border-top:1px solid var(--slate-100);padding-top:1.5rem;}

[data-theme="dark"] .pos-product-card:hover{box-shadow:0 12px 28px rgba(0,0,0,.28);}
[data-theme="dark"] .pos-cart{box-shadow:0 16px 34px rgba(0,0,0,.3);}
[data-theme="dark"] .pos-cart-item-qty button{background:var(--slate-100);color:var(--slate-700);}
[data-theme="dark"] .pos-cart-item-qty button:hover{background:var(--primary-900);color:var(--primary-200);}
[data-theme="dark"] .pos-cart-count{background:rgba(99,102,241,.18);color:var(--primary-300);}
[data-theme="dark"] .pos-category-chip{border-color:rgba(255,255,255,.12);color:var(--slate-300);}
[data-theme="dark"] .pos-category-chip.active{background:rgba(99,102,241,.2);border-color:rgba(129,140,248,.4);}

/* ─── Empty States ─── */
.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;
  padding:4rem 2rem;color:var(--slate-400);gap:.75rem;}
.empty-state svg{opacity:.2;margin-bottom:.5rem;}
.empty-state p{font-size:.9rem;}

/* ─── Products ─── */
.products-filter-bar{display:flex;gap:1rem;margin-bottom:1.5rem;align-items:center;flex-wrap:wrap;}
.products-search-wrap{position:relative;flex:1;min-width:180px;max-width:360px;}
.products-category-select{width:200px;}
.products-filter-count{margin-left:auto;color:var(--slate-400);font-size:.82rem;white-space:nowrap;}
.modal-box.wide{max-width:600px;text-align:left;padding:2rem;}
.modal-box.sm{max-width:400px;text-align:left;padding:2rem;}
.modal-box-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1.5rem;gap:1rem;}
.modal-box-close{color:var(--slate-400);width:36px;height:36px;border-radius:var(--radius-sm);display:flex;align-items:center;justify-content:center;transition:all var(--transition-fast);}
.modal-box-close:hover{background:var(--slate-100);color:var(--slate-700);}
.product-code{font-size:.75rem;color:var(--slate-500);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;}

[data-theme="dark"] .modal-box{border:1px solid rgba(255,255,255,.06);}
[data-theme="dark"] .modal-box-close:hover{background:var(--slate-100);color:var(--slate-800);}
[data-theme="dark"] .stock-current-display{border:1px solid rgba(255,255,255,.06);}

/* ─── Losses ─── */
.losses-kpi-grid{grid-template-columns:repeat(4,1fr);margin-bottom:1.5rem;}
.loss-reason-card{border-left:3px solid var(--primary-400);}
.loss-notes-cell{max-width:200px;font-size:.82rem;color:var(--slate-500);}

/* ─── Categories ─── */
.categories-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:1.5rem;margin-bottom:2rem;}
.category-card{background:var(--surface-card);border-radius:var(--radius-lg);padding:1.5rem;
  box-shadow:var(--shadow-card);border:1px solid rgba(226,232,240,.5);display:flex;align-items:flex-start;gap:1rem;}
.category-card-icon{width:48px;height:48px;border-radius:var(--radius-md);background:var(--primary-50);
  color:var(--primary-600);display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.category-card-body{flex:1;min-width:0;}
.category-card-body h3{font-size:.95rem;font-weight:700;color:var(--slate-800);margin-bottom:.25rem;}
.category-card-body p{font-size:.8rem;color:var(--slate-500);margin-bottom:.5rem;}
.category-card-count{font-size:.75rem;color:var(--primary-600);font-weight:600;}
.category-card-actions{display:flex;gap:.5rem;flex-shrink:0;}
.category-form-card{max-width:500px;margin:0 auto;}

/* ─── Profile ─── */
.profile-layout{display:grid;grid-template-columns:280px 1fr;gap:1.5rem;}
.profile-avatar-lg{width:80px;height:80px;border-radius:var(--radius-xl);background:var(--gradient-primary);
  display:flex;align-items:center;justify-content:center;color:white;font-weight:800;font-size:2rem;margin:0 auto;}
.profile-sidebar-card .card-body{text-align:center;}
.profile-tabs{display:flex;gap:.5rem;margin-bottom:1.5rem;}
.profile-tab{padding:.6rem 1.25rem;border-radius:var(--radius-sm);font-size:.85rem;font-weight:600;
  color:var(--slate-500);display:flex;align-items:center;gap:.5rem;transition:all var(--transition-fast);}
.profile-tab:hover{background:var(--slate-100);}
.profile-tab.active{background:var(--primary-50);color:var(--primary-600);}

/* ─── Reports ─── */
.reports-kpi-grid{grid-template-columns:repeat(3,1fr);margin-bottom:2rem;}
.report-legend{padding:0 1.5rem 1.25rem;display:flex;flex-wrap:wrap;gap:.75rem;justify-content:center;}
.report-legend-item{display:flex;align-items:center;gap:.35rem;font-size:.75rem;color:var(--slate-600);}
.report-legend-dot{width:10px;height:10px;border-radius:50%;flex-shrink:0;}
.report-top-products{display:grid;grid-template-columns:1fr 1fr;gap:2rem;align-items:center;}
.report-detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;margin-top:1.5rem;}

/* ─── Form layouts ─── */
.form-card-centered{max-width:800px;margin:0 auto;}
.form-card-sm{max-width:500px;margin:0 auto;}

/* ─── User cell ─── */
.user-cell{display:flex;align-items:center;gap:.75rem;}
.user-avatar-sm{width:36px;height:36px;border-radius:var(--radius-sm);display:flex;align-items:center;
  justify-content:center;color:white;font-weight:700;font-size:.82rem;flex-shrink:0;}
.user-avatar-sm.primary{background:var(--gradient-primary);}
.user-avatar-sm.success{background:var(--gradient-success);}

/* ─── Stock entry ─── */
.stock-current-display{background:var(--slate-50);border-radius:var(--radius-md);padding:1.25rem;
  display:flex;justify-content:space-between;align-items:center;margin-bottom:2rem;}
.stock-current-label{font-size:.78rem;color:var(--slate-500);}
.stock-current-value{font-size:1.75rem;font-weight:800;color:var(--primary-600);}

/* ─── Action Row ─── */
.action-row{display:flex;align-items:center;gap:.5rem;}

/* ─── Toast ─── */
#toast-container{position:fixed;top:1.5rem;right:1.5rem;z-index:2000;display:flex;flex-direction:column;gap:.75rem;}
.toast{background:white;border-radius:var(--radius-md);box-shadow:var(--shadow-xl);padding:1rem 1.25rem;
  display:flex;align-items:center;gap:.75rem;min-width:320px;animation:slideInRight .3s ease;border-left:4px solid var(--emerald-500);}
.toast.error{border-left-color:var(--rose-500);}
.toast.info{border-left-color:var(--primary-500);}
.toast.warning{border-left-color:var(--amber-500);}
@keyframes slideInRight{from{opacity:0;transform:translateX(40px);}to{opacity:1;transform:translateX(0);}}
.toast-message{flex:1;font-size:.85rem;font-weight:500;color:var(--slate-700);}

/* ─── Search bar in header ─── */
.header-search{display:flex;align-items:center;gap:.5rem;background:var(--slate-100);border:1px solid var(--slate-200);
  border-radius:var(--radius-sm);padding:.45rem 1rem;font-size:.82rem;color:var(--slate-400);
  cursor:pointer;transition:all var(--transition-fast);}
.header-search:hover{border-color:var(--primary-300);}
.header-search-text{display:none;}

/* ─── Pagination ─── */
.pagination{display:flex;align-items:center;justify-content:space-between;padding:1rem 1.5rem;
  border-top:1px solid var(--slate-100);}
.pagination-info{font-size:.8rem;color:var(--slate-500);}
.pagination-controls{display:flex;gap:.35rem;align-items:center;}
.page-btn{width:34px;height:34px;border-radius:var(--radius-sm);display:flex;align-items:center;justify-content:center;
  font-size:.82rem;font-weight:600;color:var(--slate-600);transition:all var(--transition-fast);border:1px solid transparent;}
.page-btn:hover{background:var(--slate-100);}
.page-btn.active{background:var(--gradient-primary);color:white;border-color:transparent;box-shadow:var(--shadow-primary);}
.page-btn:disabled{opacity:.3;cursor:not-allowed;}

/* ─── Skeleton ─── */
.skeleton{background:linear-gradient(90deg,var(--slate-100) 25%,var(--slate-50) 50%,var(--slate-100) 75%);
  background-size:400% 100%;animation:shimmer 1.5s infinite;border-radius:var(--radius-sm);}
@keyframes shimmer{0%{background-position:100% 0;}100%{background-position:-100% 0;}}

/* ─── Responsive ─── */
@media(max-width:1200px){
  .stats-grid{grid-template-columns:repeat(2,1fr);}
  .reports-kpi-grid{grid-template-columns:repeat(3,1fr);}
  .losses-kpi-grid{grid-template-columns:repeat(2,1fr);}
  .charts-grid{grid-template-columns:1fr;}
  .pos-layout{grid-template-columns:minmax(0,1fr) 350px;}
  .profile-layout{grid-template-columns:240px 1fr;}
}
@media(max-width:992px){
  body.sidebar-hidden .sidebar{transform:translateX(-100%);pointer-events:auto;}
  .sidebar{position:fixed;left:0;top:0;bottom:0;width:280px!important;
    transform:translateX(-100%);transition:transform .3s cubic-bezier(.4,0,.2,1);z-index:1100;}
  .sidebar.mobile-open{transform:translateX(0);}
  .main-area{margin-left:0!important;}
  .mobile-menu-btn{display:flex;}
  .sidebar-mobile-close{display:flex;}
  .sidebar-mobile-overlay{position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:1099;}
}
@media(max-width:768px){
  .page-content{padding:1.25rem 1rem;}
  .top-header{padding:1rem 1.25rem;}
  .header-search-text,.header-search-kbd{display:none;}
  .stats-grid{grid-template-columns:1fr 1fr;gap:1rem;}
  .form-grid{grid-template-columns:1fr;}
  .form-grid .full-width{grid-column:span 1;}
  .pos-layout{grid-template-columns:1fr;gap:.85rem;}
  .pos-products-meta{display:none;}
  .pos-products-grid{grid-template-columns:repeat(auto-fill,minmax(140px,1fr));}
  .pos-cart-toggle{display:inline-flex;}
  .pos-cart{
    position:fixed;
    right:0;
    top:0;
    bottom:0;
    width:min(92vw,390px);
    z-index:1200;
    transform:translateX(102%);
    transition:transform .25s ease;
    border-radius:0;
    height:100vh;
    max-height:100vh;
  }
  .pos-cart.mobile-open{transform:translateX(0);}
  .pos-cart-close{display:inline-flex;}
  .pos-cart-items{padding:0 1rem .8rem;min-height:145px;}
  .pos-cart-checkout-fields{padding:.85rem 1rem .3rem;}
  .pos-cart-footer .btn-primary{margin:.6rem 1rem .8rem;}
  .report-top-products{grid-template-columns:1fr;}
  .report-detail-grid{grid-template-columns:1fr;}
  .profile-layout{grid-template-columns:1fr;}
  .invoice-header{flex-direction:column;gap:1rem;}
  .data-table{display:block;}
  .data-table thead{display:none;}
  .data-table tbody,.data-table tr,.data-table td{display:block;}
  .data-table td{padding:.5rem 1rem;border-bottom:none;position:relative;padding-left:45%;}
  .data-table td::before{content:attr(data-label);position:absolute;left:1rem;top:.5rem;
    font-size:.72rem;font-weight:600;text-transform:uppercase;color:var(--slate-500);}
  .data-table tr{border-bottom:1px solid var(--slate-100);padding:.25rem 0;}
}
@media(max-width:480px){
  .stats-grid{grid-template-columns:1fr;}
  .categories-grid{grid-template-columns:1fr;}
  .modal-box{padding:1.5rem;}
}

/* ─── Utilities ─── */
.d-none{display:none!important;}
.fw-700{font-weight:700;}
.fw-600{font-weight:600;}
.text-primary{color:var(--primary-600);}
.text-success{color:var(--emerald-600);}
.text-warning{color:var(--amber-600);}
.text-muted{color:var(--slate-400);}
.mt-2{margin-top:1.5rem;}

@media print {
  .no-print { display: none !important; }
}

/* ─── Sidebar User Top (replaces brand logo) ─── */
.sidebar-user-top{
  display:flex;align-items:center;gap:.875rem;
  padding:1.25rem 1.25rem 1.1rem;
  border-bottom:1px solid rgba(255,255,255,.06);
  cursor:pointer;
  position:relative;
  user-select:none;
  transition:background var(--transition-fast);
}
.sidebar-user-top:hover{background:rgba(255,255,255,.04);}
.sidebar-user-top-avatar{
  width:40px;height:40px;border-radius:var(--radius-md);
  background:var(--gradient-primary);
  display:flex;align-items:center;justify-content:center;
  color:white;font-weight:800;font-size:1rem;flex-shrink:0;
  box-shadow:0 4px 12px rgba(99,102,241,.4);
}
.sidebar-user-top-info{flex:1;min-width:0;}
.sidebar-user-top-name{
  color:#fff;font-size:.85rem;font-weight:700;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.sidebar-user-top-role{
  color:var(--slate-400);font-size:.7rem;margin-top:.1rem;
  text-transform:uppercase;letter-spacing:.06em;
}
/* ─── Sidebar User Dropdown Panel ─── */
.sidebar-user-dropdown{
  display:none;
  background:rgba(255,255,255,.04);
  border-bottom:1px solid rgba(255,255,255,.06);
  overflow:hidden;
}
.sidebar-user-dropdown.open{display:block;animation:fadeInUp .18s ease;}
.sidebar-user-dropdown-item{
  display:flex;align-items:center;gap:.75rem;
  padding:.75rem 1.5rem;
  color:var(--slate-300);
  font-size:.84rem;font-weight:500;
  transition:all var(--transition-fast);
  text-decoration:none;
}
.sidebar-user-dropdown-item:hover{
  background:rgba(255,255,255,.06);color:#fff;
}
/* Allow sidebar brand area to show dropdown overflow */
.sidebar{overflow:visible;}
.sidebar-nav{overflow-y:auto;}

/* ─── Responsive refinements ───────────────────────────── */
.sidebar-mobile-close{display:none!important;margin-left:auto;}
.reports-summary-grid{display:grid;grid-template-columns:1fr 1fr;gap:1.5rem;margin-bottom:1.5rem;}
body.nav-open,body.pos-cart-open,body.modal-open{overflow:hidden;}

@media(max-width:1024px){
  .pos-layout{grid-template-columns:minmax(0,1fr);padding-bottom:5.75rem;}
  .pos-layout > section{min-width:0;}
  .pos-cart-toggle{
    position:fixed;left:calc(var(--sidebar-width) + 1rem);right:1rem;bottom:calc(.75rem + env(safe-area-inset-bottom));z-index:1050;
    min-height:58px;padding:.6rem .85rem;border:0;border-radius:15px;background:var(--gradient-dark);color:#fff;
    display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:"icon label total" "icon count total";
    column-gap:.7rem;align-items:center;text-align:left;box-shadow:0 14px 35px rgba(15,23,42,.3);transition:transform .2s ease,opacity .2s ease,box-shadow .2s ease;
  }
  body.sidebar-hidden .pos-cart-toggle{left:1rem;}
  .pos-cart-toggle.has-items{background:var(--gradient-primary);box-shadow:0 14px 35px rgba(79,70,229,.38);}
  .pos-cart-toggle:active{transform:scale(.985);}
  .pos-cart-toggle > svg{grid-area:icon;}
  .pos-cart-toggle-label{grid-area:label;font-size:.85rem;font-weight:800;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  .pos-cart-toggle-count{grid-area:count;font-size:.7rem;line-height:1.15;opacity:.78;}
  .pos-cart-toggle-total{grid-area:total;font-size:.9rem;white-space:nowrap;}
  body.pos-cart-open .pos-cart-toggle{opacity:0;pointer-events:none;transform:translateY(12px);}

  .pos-cart-overlay{display:block;position:fixed;inset:0;z-index:1150;background:rgba(15,23,42,.52);backdrop-filter:blur(3px);
    opacity:0;visibility:hidden;pointer-events:none;transition:opacity .22s ease,visibility .22s ease;}
  .pos-cart-overlay.is-visible{opacity:1;visibility:visible;pointer-events:auto;}
  .pos-cart{
    position:fixed;right:0;top:0;bottom:0;z-index:1200;width:min(100vw,420px);
    height:100vh;height:100dvh;max-height:100vh;max-height:100dvh;border-radius:18px 0 0 18px;
    transform:translateX(105%);transition:transform .26s cubic-bezier(.4,0,.2,1);overscroll-behavior:contain;
  }
  .pos-cart.mobile-open{transform:translateX(0);}
  .pos-cart-close{display:flex;}
  .pos-cart-header{padding:.75rem 1rem;min-height:64px;}
  .pos-cart-title-group{flex-direction:column;align-items:flex-start;gap:.1rem;}
  .pos-cart-header-right{margin-left:auto;}
  .pos-cart-body{overflow-y:auto;-webkit-overflow-scrolling:touch;}
  .pos-cart-items{min-height:170px;padding:0 1rem .85rem;}
  .pos-cart-checkout-fields{padding:.9rem 1rem .35rem;}
  .pos-cart-actions{padding:.7rem 1rem calc(.7rem + env(safe-area-inset-bottom));}
  .pos-cart-actions .btn-primary{min-height:50px;}
  .pos-cart-item{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"info total" "qty remove";gap:.55rem .75rem;align-items:center;padding:.8rem 0;}
  .pos-cart-item-info{grid-area:info;}
  .pos-cart-item-total{grid-area:total;min-width:0;align-self:start;}
  .pos-cart-item-qty{grid-area:qty;justify-self:start;gap:.35rem;}
  .pos-cart-remove{grid-area:remove;justify-self:end;}
  .pos-cart-item-qty button,.pos-cart-remove{width:44px;height:44px;min-width:44px;}
  .pos-cart-item-qty span{width:30px;font-size:.95rem;}
}

@media(max-width:992px){
  #sidebarToggle{display:none!important;}
  .sidebar-mobile-close{display:flex!important;width:44px;height:44px;align-items:center;justify-content:center;color:var(--slate-300);flex:0 0 auto;}
  .sidebar{width:min(86vw,300px)!important;height:100vh;height:100dvh;overflow:hidden;}
  .sidebar-nav{overscroll-behavior:contain;-webkit-overflow-scrolling:touch;}
  .sidebar-mobile-overlay{inset:0;background:rgba(2,6,23,.58);backdrop-filter:blur(2px);}
  .pos-cart-toggle{left:1rem;}
}

@media(max-width:768px){
  .main-area,.page-content,.card,.card-body{min-width:0;}
  .top-header{min-height:58px;padding:.55rem 1rem;}
  .header-left,.header-right{gap:.4rem;min-width:0;}
  .header-date{max-width:190px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  .page-content{padding:1rem .85rem 1.5rem;}
  .page-pos .page-content{padding-bottom:5rem;}
  .page-header{align-items:flex-start;flex-wrap:wrap;gap:.65rem;margin-bottom:1.1rem;}
  .page-header h1{font-size:1.3rem;line-height:1.25;}
  .page-header p{font-size:.78rem;line-height:1.45;}

  .card{border-radius:var(--radius-md);}
  .card-header{padding:.9rem 1rem;gap:.65rem;flex-wrap:wrap;}
  .card-header h3{font-size:.92rem;}
  .card-body{padding:1rem;}
  .stat-card{padding:1rem;min-width:0;}
  .stat-value{font-size:1.35rem;overflow-wrap:anywhere;}
  .stat-icon-box{width:42px;height:42px;}
  .charts-grid,.stats-grid,.categories-grid{gap:.85rem;margin-bottom:1.1rem;}
  .chart-container,.report-chart-container{height:240px;}
  .report-chart-sm{height:220px;}
  .reports-summary-grid{grid-template-columns:1fr;gap:1rem;margin-bottom:1rem;}

  .products-filter-bar{gap:.65rem;margin-bottom:1rem;}
  .products-search-wrap,.products-category-select{width:100%;max-width:none;min-width:0;}
  .products-filter-count{width:100%;margin-left:0;text-align:right;}

  .form-group{margin-bottom:1rem;}
  .form-grid{gap:0 .85rem;}
  .form-grid > .form-group{margin-bottom:1rem;}
  .form-actions{gap:.55rem;flex-wrap:wrap;margin-top:1rem;}
  .form-actions .btn{flex:1 1 130px;min-height:44px;}
  .form-input,.form-select,.form-textarea{min-height:44px;padding:.7rem .8rem;}

  .modal-overlay{padding:.65rem;overflow-y:auto;align-items:center;}
  .modal-box,.modal-box.wide,.modal-box.sm,.invoice-modal-panel{width:100%;max-width:600px;max-height:calc(100vh - 1.3rem);max-height:calc(100dvh - 1.3rem);
    overflow-y:auto;overscroll-behavior:contain;padding:1.15rem!important;margin:auto;border-radius:var(--radius-lg);}
  .modal-box-header{margin-bottom:1rem;}
  .modal-box-close{width:44px;height:44px;flex:0 0 auto;}
  .modal-actions{gap:.55rem;margin-top:.5rem;}
  .modal-actions .btn{min-height:44px;}

  .data-table{display:block;width:100%;background:transparent;}
  .data-table thead{display:none;}
  .data-table tbody{display:grid;gap:.7rem;padding:.75rem;width:100%;}
  .data-table tbody tr{display:block;width:100%;padding:0;background:var(--surface-card);border:1px solid var(--slate-200);border-radius:var(--radius-sm);overflow:hidden;}
  .data-table tbody td{display:flex;align-items:flex-start;justify-content:space-between;gap:.8rem;width:100%;min-height:38px;
    padding:.58rem .7rem!important;border-bottom:1px solid var(--slate-100);text-align:right!important;overflow-wrap:anywhere;}
  .data-table tbody td:last-child{border-bottom:0;}
  .data-table tbody td[data-label]::before{content:attr(data-label);position:static;display:block;flex:0 0 38%;padding:0;
    text-align:left;font-size:.68rem;font-weight:700;line-height:1.5;text-transform:uppercase;color:var(--slate-500);}
  .data-table tbody td:not([data-label]){justify-content:center;padding:1.5rem .75rem!important;text-align:center!important;color:var(--slate-400);}
  .data-table tbody td:not([data-label])::before{display:none;content:none;}
  .data-table td .action-row{justify-content:flex-end!important;flex-wrap:wrap;}
  .data-table td .btn{min-height:38px;}

  .pagination{padding:.75rem;gap:.65rem;flex-wrap:wrap;justify-content:center;}
  .pagination-info{width:100%;text-align:center;}
  .pagination-controls{max-width:100%;overflow-x:auto;padding:.1rem;}
  .page-btn{width:40px;height:40px;min-width:40px;}

  .category-card{padding:1rem;gap:.75rem;flex-wrap:wrap;}
  .category-card-actions{margin-left:auto;}
  .profile-tabs{overflow-x:auto;white-space:nowrap;padding-bottom:.25rem;scrollbar-width:thin;}
  .profile-tab{flex:0 0 auto;padding:.55rem .85rem;}
  .stock-current-display{padding:1rem;margin-bottom:1rem;}
  .invoice-modal-actions{flex-wrap:wrap;}
  .invoice-modal-actions .btn{flex:1 1 140px;}

  #toast-container{top:auto;right:.75rem;bottom:calc(.75rem + env(safe-area-inset-bottom));left:.75rem;}
  .toast{width:100%;min-width:0;padding:.85rem 1rem;}
}

@media(max-width:480px){
  .header-date{display:none;}
  .page-content{padding:.85rem .7rem 1.35rem;}
  .page-pos .page-content{padding-bottom:5.5rem;}
  .page-header{flex-direction:column;align-items:stretch;}
  .page-header > .btn{width:100%;min-height:44px;}
  .page-header .form-select{width:100%!important;}
  .top-header{padding-left:.75rem;padding-right:.75rem;}
  .stats-grid,.reports-kpi-grid,.losses-kpi-grid{grid-template-columns:1fr;}
  .card-body{padding:.85rem;}
  .card-header{padding:.8rem .85rem;}
  .login-page{padding:.75rem;align-items:flex-start;}
  .login-form-container{padding:1.4rem;margin-top:max(1rem,env(safe-area-inset-top));border-radius:var(--radius-lg);}
  .login-logo{margin-bottom:1.25rem;}

  .pos-layout{padding-bottom:5.25rem;}
  .pos-products-card .card-body{padding:.7rem;}
  .pos-products-toolbar{margin-bottom:.65rem;}
  .pos-products-search input{min-height:46px;font-size:16px;}
  .pos-category-chips{margin-bottom:.65rem;}
  .pos-category-chip{min-height:38px;padding:.42rem .65rem;font-size:.78rem;}
  .pos-products-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:.55rem;}
  .pos-product-card{padding:.65rem;min-height:138px;}
  .pos-product-bar{margin-bottom:.6rem;}
  .pos-product-name{font-size:.86rem;}
  .pos-product-category,.pos-product-code,.pos-product-stock{font-size:.72rem;}
  .pos-product-price{font-size:.92rem;}
  .pos-promo-banner-box{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;padding:.55rem .7rem;}
  .pos-promo-banner-box::-webkit-scrollbar{display:none;}
  .pos-promo-banner-title,.pos-promo-badge{flex:0 0 auto;}
  .pos-cart{width:100vw;border-radius:0;}
  .pos-cart-toggle{left:.7rem;right:.7rem;bottom:calc(.6rem + env(safe-area-inset-bottom));min-height:56px;}
  .pos-cart-clear{padding:.45rem .6rem;}
  .pos-cart-items-title{font-size:.69rem;}
  .pos-cart-items-title span{font-size:.66rem;}
  .pos-cart-item-name{font-size:.86rem;white-space:normal;}
  .pos-cart-item-price{font-size:.75rem;}

  .modal-overlay{padding:0;align-items:flex-end;}
  .modal-box,.modal-box.wide,.modal-box.sm,.invoice-modal-panel{max-height:94vh;max-height:94dvh;border-radius:18px 18px 0 0;padding:1rem!important;margin-top:auto;margin-bottom:0;}
  .modal-actions{flex-direction:column-reverse;}
  .modal-actions .btn{width:100%;flex:none;}
  .form-actions{flex-direction:column-reverse;}
  .form-actions .btn{width:100%;flex:none;}
  .products-filter-count{text-align:left;}
  .category-card-icon{width:42px;height:42px;}
  .category-card-actions{width:100%;justify-content:flex-end;}
}

@media(max-width:360px){
  .pos-cart-toggle-total{font-size:.8rem;}
  .pos-cart-toggle{column-gap:.5rem;padding:.55rem .7rem;}
  .pos-product-card{min-height:132px;padding:.58rem;}
  .data-table tbody{padding:.55rem;}
  .data-table tbody td[data-label]::before{flex-basis:42%;}
}

@media(max-width:1024px) and (max-height:600px){
  .pos-cart{width:min(100vw,480px);}
  .pos-cart-header{min-height:56px;padding:.45rem .75rem;}
  .pos-cart-items{min-height:130px;}
  .pos-cart-actions{padding:.5rem .75rem calc(.5rem + env(safe-area-inset-bottom));}
  .pos-cart-actions .btn-primary{min-height:44px;}
}

@media(pointer:coarse){
  .btn-sm{min-height:40px;}
  .btn-icon,.btn-icon.sm{width:42px;height:42px;}
  .header-icon-btn,.mobile-menu-btn{width:44px;height:44px;}
}

/* ─── PWA install banner ─── */
.pwa-install-banner{
  position:fixed;left:1rem;right:1rem;bottom:calc(1rem + env(safe-area-inset-bottom,0px));
  z-index:1200;display:flex;align-items:center;justify-content:space-between;gap:1rem;
  padding:.9rem 1rem;border-radius:var(--radius-lg);background:var(--surface-card);
  border:1px solid var(--slate-200);box-shadow:var(--shadow-xl);
  animation:fadeInUp .35s ease-out;
}
.pwa-install-copy{display:flex;flex-direction:column;gap:.15rem;min-width:0;}
.pwa-install-copy strong{font-size:.92rem;color:var(--slate-900);letter-spacing:-.01em;}
.pwa-install-copy span{font-size:.78rem;color:var(--slate-500);}
.pwa-install-actions{display:flex;align-items:center;gap:.5rem;flex-shrink:0;}
@media(max-width:480px){
  .pwa-install-banner{flex-direction:column;align-items:stretch;left:.75rem;right:.75rem;}
  .pwa-install-actions{justify-content:flex-end;}
}
[data-theme="dark"] .pwa-install-banner{border-color:var(--slate-200);}

/* ─── Network / offline banner ─── */
.kema-network-banner{
  position:fixed;top:0;left:0;right:0;z-index:1300;display:flex;align-items:center;justify-content:center;
  gap:.75rem;flex-wrap:wrap;padding:.55rem 1rem;font-size:.82rem;text-align:center;
}
.kema-network-banner.offline{background:#78350f;color:#fffbeb;}
.kema-network-banner.syncing{background:#1e3a8a;color:#dbeafe;}
.kema-network-banner strong{font-weight:700;}
.kema-network-banner span{opacity:.95;}
.kema-network-banner .btn{color:inherit;border-color:rgba(255,255,255,.35);}
body.is-offline{padding-top:2.5rem;}
.dashboard-offline-note{
  grid-column:1 / -1;margin:0 0 .25rem;padding:.65rem .9rem;border-radius:var(--radius-md);
  background:var(--amber-50);color:var(--amber-600);font-size:.85rem;font-weight:600;
}
[data-theme="dark"] .dashboard-offline-note{background:rgba(245,158,11,.12);color:var(--amber-400);}

