/* ==========================================================================
   Fahan Saprkz — Inventory
   Theme: deep ledger-navy (#1E3C72) + warm receipt-amber accent
   ========================================================================== */

:root{
  --navy-900:#122549;
  --navy-800:#1E3C72;
  --navy-700:#2A4E8C;
  --navy-600:#3A62A8;
  --ink:#16213B;
  --muted:#5C6B8A;
  --muted-soft:#8892AC;
  --paper:#F2F4F9;
  --card:#FFFFFF;
  --line:#E4E8F2;
  --line-strong:#CDD4E6;
  --amber:#E8A33D;
  --amber-deep:#C1791E;
  --green:#1E9E6B;
  --green-soft:#E4F6EE;
  --red:#D6483F;
  --red-soft:#FBEAE8;
  --blue-soft:#E8F0FC;

  --c-7up:#2E9E52;
  --c-olympic:#C1791E;
  --c-fresh:#2E86C1;

  --radius-sm:8px;
  --radius-md:14px;
  --radius-lg:20px;
  --shadow-card:0 1px 2px rgba(18,37,73,0.06), 0 8px 24px -12px rgba(18,37,73,0.16);
  --shadow-pop:0 20px 60px -20px rgba(18,37,73,0.45);

  --font-display:'Manrope', 'Noto Sans Bengali', sans-serif;
  --font-body:'Inter', 'Noto Sans Bengali', sans-serif;
}

*,*::before,*::after{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:var(--font-body);
  background:var(--paper);
  color:var(--ink);
  -webkit-font-smoothing:antialiased;
  font-variant-numeric: tabular-nums;
}
h1,h2,h3,h4{ font-family:var(--font-display); margin:0; color:var(--navy-900); }
p{ margin:0; }
a{ color:inherit; text-decoration:none; }
button{ font-family:inherit; cursor:pointer; }
::-webkit-scrollbar{ height:8px; width:8px; }
::-webkit-scrollbar-thumb{ background:var(--line-strong); border-radius:10px; }
::-webkit-scrollbar-track{ background:transparent; }

/* ================= SHELL ================= */
.app-shell{
  display:grid;
  grid-template-columns:252px 1fr;
  min-height:100vh;
}

/* ================= SIDEBAR ================= */
.sidebar{
  background:linear-gradient(190deg, var(--navy-900) 0%, var(--navy-800) 100%);
  color:#fff;
  padding:22px 16px;
  display:flex;
  flex-direction:column;
  position:sticky;
  top:0;
  height:100vh;
}
.brand{
  display:flex;
  align-items:center;
  gap:12px;
  padding:6px 8px 26px;
}
.brand-mark{
  width:40px; height:40px;
  border-radius:11px;
  background:linear-gradient(155deg, var(--amber) 0%, var(--amber-deep) 100%);
  color:var(--navy-900);
  font-family:var(--font-display);
  font-weight:800;
  font-size:15px;
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0;
  box-shadow:0 6px 16px -4px rgba(0,0,0,0.35);
}
.brand-text{ display:flex; flex-direction:column; line-height:1.25; }
.brand-name{ font-family:var(--font-display); font-weight:700; font-size:15.5px; letter-spacing:0.1px; }
.brand-sub{ font-size:11.5px; color:rgba(255,255,255,0.55); margin-top:2px; }

.nav-list{ display:flex; flex-direction:column; gap:3px; margin-top:6px; }
.nav-item{
  display:flex; align-items:center; gap:12px;
  padding:11px 13px;
  border-radius:10px;
  color:rgba(255,255,255,0.72);
  font-size:14.5px;
  font-weight:500;
  transition:background .15s ease, color .15s ease;
}
.nav-item:hover{ background:rgba(255,255,255,0.07); color:#fff; }
.nav-item.active{
  background:rgba(255,255,255,0.13);
  color:#fff;
  box-shadow:inset 3px 0 0 var(--amber);
}
.nav-section-label{
  font-size:10.5px; font-weight:700; letter-spacing:.5px; text-transform:uppercase;
  color:rgba(255,255,255,0.38); padding:16px 13px 6px;
}
.nav-icon{ width:18px; height:18px; flex-shrink:0; position:relative; opacity:0.9; }
.nav-icon::before, .nav-icon::after{ content:''; position:absolute; }
/* minimal geometric icon set drawn with borders (no external icon lib) */
.nav-icon[data-icon="home"]{ }
.nav-icon[data-icon="home"]::before{ width:18px; height:12px; bottom:0; border:2px solid currentColor; border-top:0; border-radius:0 0 2px 2px; }
.nav-icon[data-icon="home"]::after{ left:2px; top:0; width:0; height:0; border-left:7px solid transparent; border-right:7px solid transparent; border-bottom:8px solid currentColor; }
.nav-icon[data-icon="products"]::before{ width:16px; height:16px; top:1px; left:1px; border:2px solid currentColor; border-radius:3px; }
.nav-icon[data-icon="products"]::after{ width:16px; height:2px; top:8px; left:1px; background:currentColor; }
.nav-icon[data-icon="stock"]::before{ width:16px; height:9px; bottom:1px; left:1px; border:2px solid currentColor; border-radius:2px; }
.nav-icon[data-icon="stock"]::after{ width:16px; height:2px; top:5px; left:1px; background:currentColor; }
.nav-icon[data-icon="orders"]::before{ width:13px; height:16px; top:1px; left:2.5px; border:2px solid currentColor; border-radius:2px; }
.nav-icon[data-icon="orders"]::after{ width:7px; height:2px; top:6px; left:5.5px; background:currentColor; box-shadow:0 4px 0 currentColor; }
.nav-icon[data-icon="damage"]::before{ width:0; height:0; left:1px; top:2px; border-left:8px solid transparent; border-right:8px solid transparent; border-bottom:14px solid currentColor; border-radius:2px; }
.nav-icon[data-icon="damage"]::after{ width:2px; height:2px; left:8px; bottom:2px; background:var(--navy-900); box-shadow:0 -5px 0 var(--navy-900); border-radius:50%; }
.nav-icon[data-icon="invoice"]::before{ width:13px; height:16px; top:1px; left:2.5px; border:2px solid currentColor; border-radius:2px 2px 0 0; }
.nav-icon[data-icon="invoice"]::after{ width:9px; height:2px; top:6px; left:4.5px; background:currentColor; box-shadow:0 4px 0 currentColor, 0 8px 0 currentColor; }

/* ★ new: Expenditure — minus-in-circle */
.nav-icon[data-icon="expenditure"]::before{ width:15px; height:15px; top:1.5px; left:1.5px; border:2px solid currentColor; border-radius:50%; }
.nav-icon[data-icon="expenditure"]::after{ width:8px; height:2px; top:8px; left:5px; background:currentColor; }
/* ★ new: Cash Entry — single-day calendar (box + center dot) */
.nav-icon[data-icon="cashdata"]::before{ width:15px; height:13px; top:2.5px; left:1.5px; border:2px solid currentColor; border-radius:2px; }
.nav-icon[data-icon="cashdata"]::after{ width:4px; height:4px; top:8px; left:7px; background:currentColor; border-radius:50%; }
/* ★ new: Cash Ledger — stacked lines */
.nav-icon[data-icon="cashsummary"]::before{ width:16px; height:2px; top:2px; left:1px; background:currentColor; box-shadow:0 5px 0 currentColor, 0 10px 0 currentColor; }
.nav-icon[data-icon="cashsummary"]::after{ content:none; }
/* ★ new: Withdraw — arrow pointing down */
.nav-icon[data-icon="withdraw"]::before{ width:2px; height:10px; top:0; left:8px; background:currentColor; }
.nav-icon[data-icon="withdraw"]::after{ width:0; height:0; top:8px; left:4px; border-left:5px solid transparent; border-right:5px solid transparent; border-top:6px solid currentColor; }

.sidebar-foot{ margin-top:auto; padding:14px 8px 4px; border-top:1px solid rgba(255,255,255,0.1); }
.foot-ledger{ display:flex; align-items:center; justify-content:space-between; }
.foot-ledger-label{ font-size:12px; color:rgba(255,255,255,0.5); }
.foot-ledger-dot{ width:8px; height:8px; border-radius:50%; background:var(--green); box-shadow:0 0 0 4px rgba(30,158,107,0.25); }

/* ================= MAIN / TOPBAR ================= */
.main-col{ display:flex; flex-direction:column; min-width:0; }
.topbar{
  display:flex; align-items:center; gap:14px;
  padding:20px 32px;
  background:var(--card);
  border-bottom:1px solid var(--line);
  position:sticky; top:0; z-index:20;
}
.hamburger{ display:none; flex-direction:column; gap:4px; background:none; border:0; padding:6px; }
.hamburger span{ width:20px; height:2px; background:var(--navy-900); border-radius:2px; }
.topbar-title h1{ font-size:20px; font-weight:800; }
.topbar-title p{ font-size:12.5px; color:var(--muted); margin-top:2px; }
.topbar-date{ margin-left:auto; font-size:13px; color:var(--muted); font-weight:500; }

.content{ padding:26px 32px 60px; flex:1; }

/* ================= SECTION / CARD PRIMITIVES ================= */
.section-head{ display:flex; align-items:baseline; justify-content:space-between; margin:30px 0 14px; }
.section-head:first-child{ margin-top:0; }
.section-head h2{ font-size:16px; font-weight:700; }
.see-all{ font-size:12.5px; font-weight:600; color:var(--navy-700); display:flex; align-items:center; gap:4px; }
.see-all::after{ content:'→'; font-size:13px; }

.stat-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:14px; }
.stat-card{
  background:var(--card); border:1px solid var(--line); border-radius:var(--radius-md);
  padding:18px 18px 16px; box-shadow:var(--shadow-card);
  position:relative; overflow:hidden;
}
.stat-card::before{
  content:''; position:absolute; right:-18px; top:-18px; width:70px; height:70px;
  border-radius:50%; background:var(--stat-tint, var(--blue-soft)); opacity:0.7;
}
.stat-label{ font-size:12px; color:var(--muted); font-weight:600; position:relative; }
.stat-value{ font-family:var(--font-display); font-size:24px; font-weight:800; margin-top:8px; color:var(--navy-900); position:relative; }
.stat-foot{ font-size:11.5px; color:var(--muted-soft); margin-top:6px; position:relative; }

.hscroll{ display:flex; gap:14px; overflow-x:auto; padding-bottom:8px; scroll-snap-type:x proximity; }
.hscroll::-webkit-scrollbar{ height:6px; }

/* mini cards used in home rows */
.mini-card{
  flex:0 0 220px; scroll-snap-align:start;
  background:var(--card); border:1px solid var(--line); border-radius:var(--radius-md);
  padding:14px; box-shadow:var(--shadow-card); cursor:pointer;
  transition:transform .12s ease, box-shadow .12s ease;
}
.mini-card:hover{ transform:translateY(-2px); box-shadow:0 14px 30px -16px rgba(18,37,73,0.3); }
.mini-thumb{
  width:100%; height:96px; border-radius:9px; background:var(--paper);
  display:flex; align-items:center; justify-content:center; overflow:hidden; margin-bottom:10px;
}
.mini-thumb img{ width:100%; height:100%; object-fit:contain; }
.mini-thumb .ph{ font-family:var(--font-display); font-weight:700; color:var(--muted-soft); font-size:12px; }
.mini-name{ font-size:13px; font-weight:600; line-height:1.35; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; min-height:35px; }
.mini-meta{ display:flex; align-items:center; justify-content:space-between; margin-top:8px; }
.chip{ font-size:10.5px; font-weight:700; padding:3px 8px; border-radius:20px; background:var(--blue-soft); color:var(--navy-700); text-transform:uppercase; letter-spacing:.3px; }
.chip.chip-7up{ background:#E7F6EC; color:var(--c-7up); }
.chip.chip-olympic{ background:#FBF0DD; color:var(--c-olympic); }
.chip.chip-fresh{ background:#E7F1FB; color:var(--c-fresh); }
.chip.pending{ background:#FDF1DC; color:var(--amber-deep); }
.chip.completed{ background:var(--green-soft); color:var(--green); }
.chip.rejected{ background:var(--red-soft); color:var(--red); }
.mini-price{ font-family:var(--font-display); font-weight:700; font-size:13.5px; color:var(--navy-900); }

.empty-row{ font-size:13px; color:var(--muted-soft); padding:20px 4px; }
.loading-row{ font-size:13px; color:var(--muted-soft); padding:20px 4px; display:flex; align-items:center; gap:8px; }
.spinner{ width:14px; height:14px; border-radius:50%; border:2px solid var(--line-strong); border-top-color:var(--navy-700); animation:spin .7s linear infinite; }
@keyframes spin{ to{ transform:rotate(360deg); } }

/* ================= COMPANY PICKER ================= */
.company-picker{ display:grid; grid-template-columns:repeat(3,1fr); gap:16px; max-width:820px; margin:6px 0 8px; }
.company-tile{
  background:var(--card); border:1px solid var(--line); border-radius:var(--radius-lg);
  padding:26px 20px; text-align:left; box-shadow:var(--shadow-card);
  display:flex; flex-direction:column; gap:14px; transition:transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.company-tile:hover{ transform:translateY(-3px); box-shadow:0 18px 40px -18px rgba(18,37,73,0.35); }
.company-swatch{ width:44px; height:44px; border-radius:12px; }
.company-tile[data-c="7up"] .company-swatch{ background:linear-gradient(155deg,#3FB86A,var(--c-7up)); }
.company-tile[data-c="olympic"] .company-swatch{ background:linear-gradient(155deg,#E0A23F,var(--c-olympic)); }
.company-tile[data-c="fresh"] .company-swatch{ background:linear-gradient(155deg,#4FA3DC,var(--c-fresh)); }
.company-tile-name{ font-family:var(--font-display); font-weight:800; font-size:17px; }
.company-tile-sub{ font-size:12.5px; color:var(--muted); }

.company-switch{ display:flex; align-items:center; gap:10px; margin-bottom:18px; flex-wrap:wrap; }
.company-pill{
  display:flex; align-items:center; gap:8px; padding:8px 14px; border-radius:24px;
  border:1px solid var(--line-strong); background:var(--card); font-size:13px; font-weight:600; color:var(--muted);
}
.company-pill .dot{ width:8px; height:8px; border-radius:50%; }
.company-pill[data-c="7up"] .dot{ background:var(--c-7up); }
.company-pill[data-c="olympic"] .dot{ background:var(--c-olympic); }
.company-pill[data-c="fresh"] .dot{ background:var(--c-fresh); }
.change-company-btn{ font-size:12.5px; font-weight:600; color:var(--navy-700); background:var(--blue-soft); padding:8px 14px; border-radius:24px; border:0; }

/* ================= TOOLBAR / FILTERS ================= */
.toolbar{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:18px; }
.search-box{
  display:flex; align-items:center; gap:8px; background:var(--card); border:1px solid var(--line-strong);
  border-radius:10px; padding:9px 13px; min-width:230px; flex:1; max-width:340px;
}
.search-box svg{ flex-shrink:0; opacity:.5; }
.search-box input{ border:0; outline:0; font-size:13.5px; width:100%; background:transparent; color:var(--ink); }

.filter-tabs{ display:flex; gap:6px; background:var(--card); border:1px solid var(--line); padding:4px; border-radius:11px; flex-wrap:wrap; }
.filter-tab{ padding:7px 14px; font-size:12.5px; font-weight:600; border-radius:8px; color:var(--muted); border:0; background:transparent; }
.filter-tab.active{ background:var(--navy-800); color:#fff; }

.select-field{
  border:1px solid var(--line-strong); background:var(--card); border-radius:10px;
  padding:9px 12px; font-size:12.5px; font-weight:600; color:var(--ink);
}
.date-field{ border:1px solid var(--line-strong); background:var(--card); border-radius:10px; padding:8px 10px; font-size:12.5px; color:var(--ink); }
.date-range{ display:flex; align-items:center; gap:6px; }

/* ================= GRID / TABLE VIEWS ================= */
.product-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:14px; }

.list-table{ width:100%; border-collapse:collapse; background:var(--card); border:1px solid var(--line); border-radius:var(--radius-md); overflow:hidden; }
.list-table th{ text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:.4px; color:var(--muted-soft); font-weight:700; padding:12px 16px; background:var(--paper); border-bottom:1px solid var(--line); }
.list-table td{ padding:13px 16px; font-size:13.5px; border-bottom:1px solid var(--line); vertical-align:middle; }
.list-table tr:last-child td{ border-bottom:0; }
.list-table tr.clickable:hover{ background:var(--paper); cursor:pointer; }
.row-thumb{ width:38px; height:38px; border-radius:8px; background:var(--paper); display:flex; align-items:center; justify-content:center; overflow:hidden; flex-shrink:0; }
.row-thumb img{ width:100%; height:100%; object-fit:contain; }
.row-name-cell{ display:flex; align-items:center; gap:10px; }
.row-name{ font-weight:600; max-width:260px; }
.num{ font-family:var(--font-display); font-weight:700; }
.text-green{ color:var(--green); }
.text-red{ color:var(--red); }
.text-muted{ color:var(--muted-soft); font-weight:500; }

.card-list{ display:flex; flex-direction:column; gap:10px; }
.list-row-card{
  display:flex; align-items:center; gap:14px; background:var(--card); border:1px solid var(--line);
  border-radius:var(--radius-md); padding:12px 16px; box-shadow:var(--shadow-card);
}
.list-row-card:hover{ border-color:var(--line-strong); }

/* ================= MODAL ================= */
.modal-overlay{
  position:fixed; inset:0; background:rgba(15,25,50,0.5); backdrop-filter:blur(2px);
  display:none; align-items:center; justify-content:center; z-index:100; padding:20px;
}
.modal-overlay.open{ display:flex; }
.modal-box{
  background:var(--card); border-radius:var(--radius-lg); max-width:520px; width:100%;
  max-height:86vh; overflow-y:auto; box-shadow:var(--shadow-pop); animation:pop .16s ease;
}
@keyframes pop{ from{ transform:scale(.97) translateY(6px); opacity:0; } to{ transform:none; opacity:1; } }
.modal-head{ display:flex; align-items:flex-start; gap:14px; padding:22px 22px 16px; border-bottom:1px solid var(--line); }
.modal-thumb{ width:64px; height:64px; border-radius:12px; background:var(--paper); display:flex; align-items:center; justify-content:center; overflow:hidden; flex-shrink:0; }
.modal-thumb img{ width:100%; height:100%; object-fit:contain; }
.modal-head h3{ font-size:16px; font-weight:700; line-height:1.35; }
.modal-close{ margin-left:auto; background:var(--paper); border:0; width:30px; height:30px; border-radius:50%; font-size:15px; color:var(--muted); flex-shrink:0; }
.modal-body{ padding:18px 22px 24px; }
.modal-grid{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.modal-field{ background:var(--paper); border-radius:10px; padding:11px 13px; }
.modal-field-label{ font-size:11px; color:var(--muted); font-weight:600; text-transform:uppercase; letter-spacing:.3px; }
.modal-field-value{ font-family:var(--font-display); font-weight:700; font-size:14.5px; margin-top:4px; color:var(--navy-900); }
.modal-note{ font-size:12px; color:var(--muted); margin-top:16px; line-height:1.6; }

/* ================= INVOICE ================= */
.invoice-card{ background:var(--card); border:1px solid var(--line); border-radius:var(--radius-md); box-shadow:var(--shadow-card); overflow:hidden; }
.invoice-head{ display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px dashed var(--line-strong); }
.invoice-id{ font-family:var(--font-display); font-weight:800; color:var(--navy-900); font-size:14px; }
.invoice-date{ font-size:12px; color:var(--muted); }
.invoice-body{ padding:16px 20px; display:flex; align-items:center; gap:14px; }
.invoice-total{ margin-left:auto; text-align:right; }
.invoice-total-label{ font-size:11px; color:var(--muted); }
.invoice-total-value{ font-family:var(--font-display); font-weight:800; font-size:17px; color:var(--navy-900); }

/* ================= TOAST ================= */
.toast{
  position:fixed; bottom:24px; left:50%; transform:translateX(-50%) translateY(16px);
  background:var(--navy-900); color:#fff; padding:12px 20px; border-radius:10px; font-size:13px;
  box-shadow:var(--shadow-pop); opacity:0; pointer-events:none; transition:opacity .2s ease, transform .2s ease; z-index:200;
}
.toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }

/* ================= EXPORT BUTTONS ================= */
.export-bar{ display:flex; align-items:center; gap:8px; margin-left:auto; }
.export-btn{
  display:flex; align-items:center; gap:6px;
  padding:9px 14px; border-radius:10px; border:1px solid var(--line-strong);
  background:var(--card); font-size:12.5px; font-weight:700; color:var(--navy-800);
  transition:background .12s ease, border-color .12s ease, opacity .12s ease;
}
.export-btn:hover{ background:var(--paper); border-color:var(--navy-600); }
.export-btn:disabled{ opacity:.45; cursor:not-allowed; }
.export-btn-ic{ font-size:12px; }
.export-btn-xlsx{ color:var(--green); border-color:#BFE6D4; }
.export-btn-xlsx:hover{ background:var(--green-soft); }
.export-btn-pdf{ color:var(--red); border-color:#F3C9C5; }
.export-btn-pdf:hover{ background:var(--red-soft); }

/* ================= RESPONSIVE ================= */
@media (max-width: 980px){
  .stat-grid{ grid-template-columns:repeat(2,1fr); }
  .company-picker{ grid-template-columns:1fr; }
  .modal-grid{ grid-template-columns:1fr; }
}
@media (max-width: 760px){
  .app-shell{ grid-template-columns:1fr; }
  .sidebar{
    position:fixed; left:0; top:0; width:240px; z-index:50;
    transform:translateX(-100%); transition:transform .2s ease;
  }
  .sidebar.open{ transform:translateX(0); box-shadow:0 0 0 100vmax rgba(0,0,0,0.35); }
  .hamburger{ display:flex; }
  .topbar{ padding:16px 18px; }
  .content{ padding:18px; }
  .topbar-date{ display:none; }
  .toolbar{ flex-direction:column; align-items:stretch; }
  .export-bar{ margin-left:0; }
}
