/* InventPro v2 — base styles copied verbatim from app/index.html so the look is identical, plus additions at the bottom. */
* { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f0f2f5; color: #1a1a2e; font-size: 14px; }
  
  /* Skeleton loading overlay */
  #skeleton-overlay { display:none; position:fixed; inset:0; background:#fff; z-index:50; flex-direction:column; align-items:center; justify-content:center; gap:20px; }
  .sk-logo { font-size:22px; font-weight:700; color:#7c3aed; margin-bottom:4px; }
  .sk-msg  { font-size:13px; color:#94a3b8; }
  .sk-bar  { width:220px; height:4px; background:#e2e8f0; border-radius:2px; overflow:hidden; }
  .sk-bar-inner { height:100%; width:40%; background:#7c3aed; border-radius:2px; animation:sk-slide 1.2s ease-in-out infinite; }
  @keyframes sk-slide { 0%{transform:translateX(-100%)} 100%{transform:translateX(350%)} }
  .sk-cards { display:flex; gap:12px; margin-top:24px; }
  .sk-card  { width:140px; height:72px; background:#f1f5f9; border-radius:10px; animation:sk-pulse 1.4s ease-in-out infinite; }
  .sk-card:nth-child(2){ animation-delay:.15s } .sk-card:nth-child(3){ animation-delay:.3s } .sk-card:nth-child(4){ animation-delay:.45s }
  @keyframes sk-pulse { 0%,100%{opacity:.6} 50%{opacity:1} }
  /* Layout — sidebar and topbar fixed; only #content scrolls */
  html, body { height: 100%; overflow: hidden; }
  #app { display: flex; height: 100vh; }
  #sidebar { width: 210px; background: #1a1a2e; color: #fff; flex-shrink: 0; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 50; }
  #main { flex: 1; display: flex; flex-direction: column; margin-left: 210px; height: 100vh; overflow: hidden; }
  #topbar { background: #fff; border-bottom: 1px solid #ddd; padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; position: sticky; top: 0; z-index: 40; }
  #content { flex: 1; overflow: hidden; }

  /* Sidebar */
  #sidebar .logo { padding: 20px 16px 16px; font-size: 17px; font-weight: 700; border-bottom: 1px solid #2d2d4e; letter-spacing: 0.3px; }
  #sidebar .logo span { color: #4fc3f7; }
  #sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 11px 16px; color: #b0bec5; text-decoration: none; cursor: pointer; transition: background 0.15s, color 0.15s; font-size: 13.5px; }
  #sidebar nav a:hover { background: #2d2d4e; color: #fff; }
  #sidebar nav a.active { background: #0d47a1; color: #fff; }
  #sidebar nav a .icon { font-size: 16px; width: 20px; text-align: center; }
  #sidebar .nav-group { padding: 12px 16px 4px; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #546e7a; }

  /* Topbar */
  #topbar h2 { font-size: 17px; font-weight: 600; }
  #topbar .actions { display: flex; gap: 8px; align-items: center; }

  /* Buttons */
  .btn { padding: 7px 14px; border: none; border-radius: 5px; cursor: pointer; font-size: 13px; font-weight: 500; transition: opacity 0.15s; }
  .btn:hover { opacity: 0.85; }
  .btn-primary { background: #0d47a1; color: #fff; }
  .btn-success { background: #2e7d32; color: #fff; }
  .btn-danger { background: #c62828; color: #fff; }
  .btn-warning { background: #e65100; color: #fff; }
  .btn-secondary { background: #546e7a; color: #fff; }
  .btn-sm { padding: 4px 10px; font-size: 12px; }
  .btn-outline { background: transparent; border: 1px solid #0d47a1; color: #0d47a1; }

  /* Cards */
  .card { background: #fff; border-radius: 8px; border: 1px solid #e0e0e0; padding: 16px; margin-bottom: 16px; }
  .card-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: #37474f; }

  /* Stats row */
  .stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
  .stat-card { background: #fff; border-radius: 8px; border: 1px solid #e0e0e0; padding: 14px 16px; }
  .stat-card .label { font-size: 11px; color: #78909c; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
  .stat-card .value { font-size: 24px; font-weight: 700; color: #1a1a2e; }
  .stat-card .sub { font-size: 11px; color: #78909c; margin-top: 2px; }
  .stat-card.alert .value { color: #c62828; }
  .stat-card.ok .value { color: #2e7d32; }

  /* Table */
  .table-wrap { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; font-size: 13px; }
  th { background: #eceff1; padding: 9px 10px; text-align: left; font-weight: 600; color: #455a64; border-bottom: 2px solid #cfd8dc; white-space: nowrap; }
  td { padding: 8px 10px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
  tr:hover td { background: #fafafa; }
  .badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
  .badge-green { background: #e8f5e9; color: #2e7d32; }
  .badge-red { background: #ffebee; color: #c62828; }
  .badge-orange { background: #fff3e0; color: #e65100; }
  .badge-blue { background: #e3f2fd; color: #0d47a1; }
  .badge-grey { background: #f5f5f5; color: #546e7a; }

  /* Forms / Modal */
  .overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 100; align-items: center; justify-content: center; }
  .overlay.show { display: flex; }
  .modal { background: #fff; border-radius: 10px; padding: 24px; width: 480px; max-width: 95vw; max-height: 90vh; overflow-y: auto; }
  .modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .form-group { margin-bottom: 12px; }
  .form-group label { display: block; font-size: 12px; font-weight: 600; color: #546e7a; margin-bottom: 4px; }
  .form-group input, .form-group select, .form-group textarea { width: 100%; padding: 8px 10px; border: 1px solid #cfd8dc; border-radius: 5px; font-size: 13px; font-family: inherit; }
  .form-group input:focus, .form-group select:focus { outline: none; border-color: #0d47a1; }
  .form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
  .full-width { grid-column: 1/-1; }

  /* Alert row highlight */
  tr.low-stock td { background: #fff8e1 !important; }
  tr.out-of-stock td { background: #ffebee !important; }

  /* Charts */
  .chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
  .chart-card { background: #fff; border-radius: 8px; border: 1px solid #e0e0e0; padding: 16px; }
  .chart-card h4 { font-size: 13px; font-weight: 600; color: #455a64; margin-bottom: 12px; }
  canvas { max-height: 240px; }

  /* Search/filter bar */
  .filter-bar { display: flex; gap: 8px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
  .filter-bar input, .filter-bar select { padding: 7px 10px; border: 1px solid #cfd8dc; border-radius: 5px; font-size: 13px; }
  .filter-bar input { min-width: 200px; }

  /* Allocation table color coding */
  .alloc-bar { height: 6px; background: #e0e0e0; border-radius: 3px; margin-top: 3px; }
  .alloc-bar-fill { height: 6px; background: #0d47a1; border-radius: 3px; }

  /* Responsive */
  @media (max-width: 700px) {
    #sidebar { display: none; }
    #main { margin-left: 0; }
    .chart-row { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
  }

  /* Toast */
  #toast { position: fixed; bottom: 24px; right: 24px; background: #1a1a2e; color: #fff; padding: 10px 18px; border-radius: 6px; font-size: 13px; display: none; z-index: 200; }

  .page { display: none; }
  .page.active { display: block; height: 100%; overflow-y: auto; padding: 20px; }
  .page-scroll { flex: 1; overflow-y: auto; padding: 20px; }
  .page-static { padding: 20px; }
  /* Pages that are just content with no special table: scroll the whole thing */

  
  .section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
  .section-header h3 { font-size: 15px; font-weight: 600; }

  .empty-state { text-align: center; padding: 40px; color: #90a4ae; }
  .empty-state .icon { font-size: 48px; margin-bottom: 8px; }
  /* Print styles */
  @media print {
    body > * { display: none !important; }
    #print-overlay { display: block !important; position: static !important; background: white; z-index: auto; }
    #print-overlay .no-print { display: none !important; }
    @page { margin: 6mm 8mm; size: A4; }
  }
  .print-bill { font-family: Arial, sans-serif; font-size: 10px; color: #000; background: #fff; line-height: 1.3; }
  .print-bill table { width: 100%; border-collapse: collapse; }
  .print-bill .bdr { border: 1px solid #555; }
  .print-bill .bdr td, .print-bill .bdr th { border: 1px solid #555; padding: 2px 4px; }
  .print-bill .num { text-align: right; }
  .print-bill .lbl { color: #555; font-size: 9px; }


/* ── SKU Picker ──────────────────────────────────────────────── */
.skp-wrap{display:flex;flex-direction:column;gap:3px;}
.skp-row1{display:flex;gap:4px;}
.skp-row1 select{flex:1;font-size:13px;padding:6px 8px;border:1px solid #cfd8dc;border-radius:5px;font-family:inherit;}
.skp-search{width:100%;font-size:13px;padding:6px 10px;border:1px solid #cfd8dc;border-radius:5px;font-family:inherit;box-sizing:border-box;}
.skp-search:focus{outline:none;border-color:#0d47a1;}
.skp-item{padding:8px 12px;font-size:13px;cursor:pointer;border-bottom:1px solid #f0f0f0;color:#1a1a2e;}
.skp-item:hover{background:#e3f2fd;}
.skp-code{font-weight:700;color:#1565c0;}
.skp-stk{font-size:10px;margin-left:6px;}
.skp-stk.low{color:#c62828;} .skp-stk.ok{color:#2e7d32;}
.skp-none{padding:10px 12px;font-size:12px;color:#90a4ae;}
.skp-chip{font-size:12px;padding:3px 8px;background:#e8f5e9;border:1px solid #a5d6a7;border-radius:12px;color:#1b5e20;display:inline-flex;align-items:center;gap:6px;white-space:nowrap;max-width:100%;overflow:hidden;}
.skp-chip-x{cursor:pointer;color:#a5d6a7;font-size:15px;line-height:1;}
.skp-chip-x:hover{color:#c62828;}
.skp-more{padding:6px 10px;font-size:11px;color:#90a4ae;font-style:italic;}


/* ═════════ InventPro v2 additions (module sidebar, counter screen, document views) ═════════ */
#content { overflow-y: auto; }
#view { padding: 20px; min-height: 100%; }
#sidebar nav .nav-group.module { color: #90a4ae; font-weight: 700; padding-top: 16px; }
#sidebar .who { margin-top: auto; padding: 12px 16px; border-top: 1px solid #2d2d4e; font-size: 12px; color: #90a4ae; }
#sidebar .who b { display: block; color: #fff; font-size: 13px; }
#sidebar .who a { padding: 6px 0 0; font-size: 12px; color: #4fc3f7; display: inline-block; }
.crumbs { font-size: 12px; color: #78909c; margin-bottom: 4px; }
.crumbs b { color: #1a1a2e; font-weight: 600; }
.muted { color: #78909c; } .small { font-size: 12px; } .right { text-align: right; } .center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; } .nowrap { white-space: nowrap; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-lg { padding: 11px 18px; font-size: 15px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.banner { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; }
.banner.warn { background: #fff3e0; color: #8a4b00; border: 1px solid #ffcc80; }
.banner.err { background: #ffebee; color: #b71c1c; border: 1px solid #ef9a9a; }
.banner.ok { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }
.banner a { color: inherit; font-weight: 700; }
.loading { padding: 40px; text-align: center; color: #90a4ae; }
.table-wrap tr.click { cursor: pointer; }
.pager { display: flex; justify-content: center; padding: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid #cfd8dc; margin-bottom: 14px; }
.tabs a { padding: 8px 14px; cursor: pointer; font-size: 13px; color: #546e7a; border-bottom: 2px solid transparent; text-decoration: none; }
.tabs a.on { color: #0d47a1; border-bottom-color: #0d47a1; font-weight: 600; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; font-size: 13px; }
.kv dt { color: #78909c; } .kv dd { margin: 0; }
.modal.wide { width: 720px; } .modal.xwide { width: 920px; }
.field-error { color: #c62828; font-size: 12px; margin-top: 3px; }

/* counter screen */
.qs { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.qs .search-box { position: relative; }
.qs .search-box input { width: 100%; padding: 12px 14px; font-size: 16px; border: 2px solid #cfd8dc; border-radius: 8px; }
.qs .search-box input:focus { outline: none; border-color: #0d47a1; }
.results { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; background: #fff; border: 1px solid #cfd8dc; border-radius: 0 0 8px 8px; max-height: 340px; overflow-y: auto; box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.results .item { padding: 9px 14px; cursor: pointer; border-bottom: 1px solid #f0f0f0; display: flex; gap: 10px; align-items: baseline; }
.results .item:hover, .results .item.sel { background: #e3f2fd; }
.results .item .code { font-weight: 700; color: #1565c0; min-width: 78px; }
.results .item .nm { flex: 1; } .results .item .pr { font-weight: 600; } .results .item .st { font-size: 11px; min-width: 56px; text-align: right; }
.st.low { color: #c62828; } .st.ok { color: #2e7d32; }
.cart td input { width: 76px; padding: 5px 6px; border: 1px solid #cfd8dc; border-radius: 4px; font-size: 13px; text-align: right; }
.cart td input.qty { width: 62px; }
.cart td input:focus { outline: none; border-color: #0d47a1; }
.cart .rm { cursor: pointer; color: #b0bec5; font-size: 18px; border: none; background: none; }
.cart .rm:hover { color: #c62828; }
.cart-empty { padding: 36px; text-align: center; color: #90a4ae; }
.totals { font-size: 13px; } .totals .r { display: flex; justify-content: space-between; padding: 3px 0; }
.totals .grand { font-size: 24px; font-weight: 700; border-top: 2px solid #1a1a2e; margin-top: 6px; padding-top: 8px; }
.tender { display: grid; grid-template-columns: 1fr 110px 28px; gap: 6px; margin-bottom: 6px; }
.tender select, .tender input { padding: 6px 8px; border: 1px solid #cfd8dc; border-radius: 5px; font-size: 13px; }
.cust-chip { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #e8f5e9; border: 1px solid #a5d6a7; border-radius: 6px; font-size: 13px; }
.hint { font-size: 11px; color: #90a4ae; margin-top: 4px; }
kbd { background: #eceff1; border: 1px solid #cfd8dc; border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; font-size: 11px; font-family: inherit; }
@media (max-width: 900px) { .qs { grid-template-columns: 1fr; } }

/* printed invoice (shown only when printing) */
#print-root { display: none; }
@media print {
  body > *:not(#print-root) { display: none !important; }
  html, body { height: auto !important; overflow: visible !important; background: #fff !important; }
  #print-root { display: block !important; }
  @page { margin: 6mm 8mm; size: A4; }
}
