/* Fahan Sparkz — steel neutrals with the logo's red as the one accent */
:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --ink: #1d2126;
  --ink-2: #5b636d;
  --line: #dde1e6;
  --line-2: #eceef1;
  --steel: #39414b;
  --red: #c8102e;
  --red-ink: #a50d26;
  --red-soft: #fbe9ec;
  --good: #17784a;
  --good-soft: #e5f4ec;
  --warn: #9a6200;
  --warn-soft: #fff4dc;
  --font: 'Hind Siliguri', 'Noto Sans Bengali', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --r: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); }
a { color: var(--steel); }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; margin: 0 0 .4em; }
h1 { font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; font-weight: 600; }
small, .muted { color: var(--ink-2); }
.wrap { max-width: 1320px; margin: 0 auto; padding-inline: 16px; padding-block: 18px 60px; }
.wrap.narrow { max-width: 520px; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }

/* header */
.top { background: var(--steel); color: #fff; position: sticky; top: 0; z-index: 10; }
.top-in { max-width: 1320px; margin: 0 auto; padding: 6px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 600; letter-spacing: .04em; }
.brand img { height: 30px; background: #fff; border-radius: 4px; padding: 2px; }
.brand b { color: #ff8a9b; font-weight: 700; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; flex: 1; align-items: center; }
.nav a { color: #e7eaee; text-decoration: none; padding: 5px 9px; border-radius: 4px; font-size: .92rem; white-space: nowrap; }
.nav a:hover { background: rgba(255, 255, 255, .1); }
.nav a.on { background: #fff; color: var(--steel); font-weight: 600; }
.nav-sep { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #aab3bd; margin: 0 4px 0 10px; }
.who { display: flex; gap: 10px; align-items: center; font-size: .88rem; }
.who a { color: #fff; }
.who small { color: #c3cad2; }
.menu-btn { display: none; background: none; color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 4px; padding: 4px 10px; font: inherit; cursor: pointer; margin-left: auto; }
.lang { border: 1px solid rgba(255, 255, 255, .4); border-radius: 4px; padding: 2px 8px; text-decoration: none; }

/* basics */
.card { min-width: 0; overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 14px; }
.title-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.title-bar h1, .title-bar h2 { margin: 0; }
.sub { margin: 2px 0 0; color: var(--ink-2); }
.tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--red); color: #fff; border: 1px solid var(--red);
  padding: 7px 14px; border-radius: var(--r); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--red-ink); border-color: var(--red-ink); }
.btn.ghost { background: var(--panel); color: var(--steel); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--steel); }
.btn.big { padding: 10px 22px; font-size: 1.02rem; }
.btn.small { padding: 4px 10px; font-size: .88rem; }
.btn.danger { background: var(--panel); color: var(--red); border-color: var(--red); }
.link-btn { background: none; border: 0; color: var(--red); cursor: pointer; font: inherit; padding: 0 4px; }
input, select { font: inherit; color: var(--ink); background: #fff; border: 1px solid #c9ced5; border-radius: 4px; padding: 6px 8px; min-width: 0; }
input[readonly] { background: var(--line-2); color: var(--ink-2); }
label { display: flex; flex-direction: column; gap: 3px; font-size: .86rem; color: var(--ink-2); font-weight: 500; }
label input, label select { color: var(--ink); font-size: .95rem; }
label.chk { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); }
.form-row { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
.form-row .grow { flex: 1 1 200px; }
.form-row h3 { margin: 0; }
.w100 { flex-basis: 100%; }
.hint { color: var(--ink-2); font-size: .88rem; margin: 0; }
.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin: 12px 0; }
.center { text-align: center; }
.flash { padding: 9px 14px; border-radius: var(--r); margin-bottom: 12px; background: var(--good-soft); color: var(--good); border: 1px solid #b9e0ca; }
.flash.err { background: var(--red-soft); color: var(--red-ink); border-color: #f1c1ca; }
.neg { color: var(--red); }
.pos { color: var(--good); }
.warn { color: var(--warn); }
.danger-zone { margin-top: 18px; text-align: right; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; border-bottom: 2px solid var(--line); }
.tabs a { padding: 7px 14px; text-decoration: none; color: var(--ink-2); border-radius: 4px 4px 0 0; margin-bottom: -2px; border-bottom: 2px solid transparent; font-weight: 500; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--red); font-weight: 600; }
.pill { display: inline-flex; gap: 8px; align-items: center; padding: 3px 10px; border-radius: 99px; background: var(--line-2); font-size: .86rem; }
.pill.pos { background: var(--good-soft); }
.pill.neg { background: var(--red-soft); }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 14px; }

/* tables */
.tbl-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 14px; }
.card .tbl-wrap, .card > .tbl { border: 0; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { background: #f7f8fa; text-align: left; font-weight: 600; font-size: .82rem; color: var(--ink-2); padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 6px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:hover td { background: #fafbfc; }
.tbl tfoot td { font-weight: 700; background: #f7f8fa; border-top: 1px solid var(--line); }
.tbl .r { text-align: right; }
.tbl .c { text-align: center; }
.tbl .empty { text-align: center; color: var(--ink-2); padding: 18px; }
.tbl.small td, .tbl.small th { padding: 5px 6px; font-size: .9rem; }
.tbl.compact td, .tbl.compact th { padding: 5px 6px; font-size: .86rem; }
.tbl tr.b td { font-weight: 700; }
.tbl tr.muted td { opacity: .55; }
.grp-row td { background: #eef0f3 !important; font-weight: 600; font-size: .82rem; letter-spacing: .04em; text-transform: uppercase; color: var(--steel); }

/* grids with inputs */
input.q { width: 52px; text-align: center; padding: 4px 3px; }
input.rate { width: 86px; text-align: right; padding: 4px 6px; }
input.short { width: 70px; }
.inv-grid td, .si-grid td { padding: 3px 5px; }
.inv-grid .pname, .si-grid .pname { min-width: 220px; }
.inv-grid th.grp-sale, .inv-grid tr.line td:nth-child(5), .inv-grid tr.line td:nth-child(6) { background: #f2f7f4; }
.inv-grid th.grp-free, .inv-grid tr.line td:nth-child(7), .inv-grid tr.line td:nth-child(8) { background: #f3f5fa; }
.inv-grid th.grp-dmg, .inv-grid tr.line td:nth-child(9), .inv-grid tr.line td:nth-child(10) { background: #fbf3f4; }
tr.line.filled td.pname { font-weight: 600; }
tr.line.filled td.amt { font-weight: 600; }
tr.line.warn td.stock-cell { color: #fff; background: var(--red) !important; font-weight: 700; }
.only-filled tr.line:not(.filled), .only-filled tr.grp-row { display: none; }
.lot-flag { display: inline-block; margin-left: 6px; font-size: .72rem; background: var(--warn-soft); color: var(--warn); border-radius: 3px; padding: 0 5px; cursor: help; }
.prod-grid input.pn { width: 260px; }
.prod-grid input.grp { width: 110px; }
.prod-grid tr.new-row td { background: #fffbea; }

/* invoice bottom */
.inv-sticky { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--steel); color: #fff; padding: 8px 16px; border-radius: var(--r); margin-bottom: 14px; font-variant-numeric: tabular-nums; }
.inv-sticky b { font-size: 1.15rem; }
.inv-sticky a { color: #fff; }
.inv-bottom > *, .day-grid > *, .two-col > *, .pl-grid > * { min-width: 0; }
.inv-bottom { display: grid; grid-template-columns: 1fr minmax(0, 420px); gap: 14px; align-items: start; }
.cr-row { display: flex; gap: 6px; margin-bottom: 6px; }
.cr-row input:first-child { flex: 1; }
.cr-row input.cr-amt { width: 110px; text-align: right; }
.totals .tr, .net-card .tr { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-variant-numeric: tabular-nums; }
.totals .tr input { width: 130px; text-align: right; }
.totals .tr.big, .net-card .tr.big { font-size: 1.15rem; border-bottom: 2px solid var(--line); }
.totals .btn { width: 100%; margin-top: 12px; }

/* company pick + dashboard */
.co-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.co-card { display: flex; flex-direction: column; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 22px 20px; text-decoration: none; color: var(--ink); border-top: 4px solid var(--steel); }
.co-card:hover { border-top-color: var(--red); }
.co-card b { font-size: 1.3rem; }
.co-card span { color: var(--ink-2); }
.co-card em { font-style: normal; color: var(--red); font-weight: 600; }
.hello { margin-bottom: 10px; }
.big-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 22px; }
.ba { display: flex; flex-direction: column; gap: 4px; padding: 22px 20px; border-radius: var(--r); text-decoration: none; color: #fff; background: var(--steel); min-height: 104px; justify-content: flex-end; }
.ba b { font-size: 1.35rem; }
.ba span { opacity: .85; font-size: .9rem; }
.ba-inv { background: var(--red); }
.ba:hover { filter: brightness(1.08); }
.sec { margin: 6px 0 10px; }
.money { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 4px 0 18px; }
.money-card { display: flex; flex-direction: column; gap: 4px; padding: 14px 18px; border-radius: var(--r); text-decoration: none; color: #fff; min-width: 0; }
.money-card.cash { background: #1d6b38; }
.money-card.stockv { background: var(--steel); }
.money-card .m-lbl { font-size: .9rem; color: rgba(255,255,255,.85); }
.money-card .m-lbl small { font-size: .78rem; color: rgba(255,255,255,.8); }
.money-card .m-val { font-size: 1.9rem; font-variant-numeric: tabular-nums; line-height: 1.15; }
.money-card .m-sub { font-size: .85rem; color: rgba(255,255,255,.9); }
.money-card .m-cos { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.25); font-size: .82rem; color: rgba(255,255,255,.85); }
.money-card .m-cos b { color: #fff; font-variant-numeric: tabular-nums; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 2px; }
.kpi span { font-size: .82rem; color: var(--ink-2); }
.kpi b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.kpi.main { border-color: var(--steel); background: var(--steel); color: #fff; }
.kpi.main span { color: #d5dae0; }
.card.alert { border-left: 4px solid var(--warn); background: var(--warn-soft); }

/* day sheet */
.day-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.day-grid .wide { grid-column: 1 / -1; }
.day-grid .card { margin: 0; }
.calc { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.calc div { background: var(--line-2); border-radius: var(--r); padding: 8px 14px; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.calc span { font-size: .82rem; color: var(--ink-2); }
.calc b { font-size: 1.15rem; }
.calc .eq { background: var(--steel); color: #fff; }
.calc .eq span { color: #d5dae0; }
.day-result { padding: 10px 14px; border-radius: var(--r); margin-bottom: 12px; font-size: 1.05rem; }
.day-result.neg { background: var(--red-soft); }
.day-result.pos { background: var(--good-soft); }
.day-result.ok { background: var(--line-2); }
.live-so { font-weight: 700; font-size: 1.05rem; padding: 6px 4px; }
.so-sum { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tbl.pl td:first-child { white-space: nowrap; }

/* login */
.login { max-width: 400px; margin: 30px auto; display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.login-logo { width: 190px; align-self: center; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.login h3 { margin: 8px 0 0; }

/* voucher (screen + print) */
.voucher { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 20px 24px; }
.v-head { display: flex; gap: 16px; align-items: center; border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 10px; }
.v-head img { width: 84px; }
.v-head h2 { margin: 0; font-size: 1.35rem; letter-spacing: .02em; }
.v-head h2 span { color: var(--ink-2); font-weight: 500; }
.v-head p { margin: 2px 0 0; color: var(--ink-2); font-size: .9rem; }
.v-meta { margin-left: auto; text-align: right; font-size: .92rem; }
.v-title { font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--red); }
.v-sum { display: grid; grid-template-columns: 1fr 340px; gap: 18px; margin-top: 12px; }
.v-totals td { padding: 4px 8px; }
.v-totals tr.b td { border-top: 1px solid var(--ink); }
.v-sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-top: 28px; text-align: center; }
.v-sign .sg-img { height: 56px; display: flex; align-items: flex-end; justify-content: center; }
.v-sign .sg-img img { max-height: 56px; max-width: 100%; object-fit: contain; }
.v-sign .sg-line { border-top: 1px solid var(--ink); padding-top: 4px; display: flex; flex-direction: column; line-height: 1.3; }
.v-sign .sg-line span { font-size: .9rem; }
.v-sign .sg-line small { color: var(--ink-2); font-size: .78rem; }
.chk-pill { display: inline-block; background: var(--good-soft); color: #1d6b38; font-size: .76rem; padding: 1px 8px; border-radius: 99px; font-weight: 600; }
.sign-prev { height: 48px; border: 1px dashed var(--line); border-radius: 6px; padding: 2px 6px; background: #fff; }

@media (max-width: 860px) {
  .menu-btn { display: block; }
  .nav { display: none; flex-basis: 100%; }
  .nav-open .nav { display: flex; }
  .who { flex-basis: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .top { position: static; }
  .inv-bottom, .day-grid, .pl-grid, .v-sum { grid-template-columns: 1fr; }
  .nav a { padding: 4px 7px; font-size: .86rem; }
  .v-head { flex-wrap: wrap; }
  .v-meta { margin-left: 0; text-align: left; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 12px; }
  .no-print, .top, .flash, .tabs, .danger-zone { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .card, .tbl-wrap, .voucher { border: 0; padding: 0; box-shadow: none; }
  .tbl th { background: #fff; border-bottom: 1px solid #000; }
  .tbl td { border-bottom: 1px solid #ccc; }
  input { border: 0; padding: 0; }
  .day-grid, .pl-grid { display: block; }
  .kpi.main, .calc .eq { background: #fff; color: #000; border: 1px solid #000; }
  a { color: #000; text-decoration: none; }
}

/* users & permissions */
.user-list { display: grid; gap: 14px; }
.user-card h3 { margin-bottom: 8px; }
.perm-box { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 6px 14px; margin-top: 8px; }
.perm-grid label.chk { font-size: .92rem; }
.warn-pill { background: var(--warn-soft); color: var(--warn); font-size: .76rem; padding: 1px 8px; font-weight: 600; }
.nav-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: .74rem; text-align: center; }
.nav a.on .nav-badge { color: #fff; }
.pending-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
a.approve-alert { display: block; text-decoration: none; color: var(--ink); }

.qty-pcs { color: var(--ink-2); font-variant-numeric: tabular-nums; }

.with-pending { display: block; font-size: .78rem; color: var(--warn); font-weight: 500; }
.title-bar .with-pending, p .with-pending { display: inline; margin-left: 8px; }

/* product pictures */
img.pimg { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; border: 1px solid var(--line); background: #fff; vertical-align: middle; margin-right: 8px; cursor: zoom-in; flex: none; }
.pic-cell { white-space: nowrap; }
.pic-btn { width: 46px; height: 46px; padding: 0; border: 1px dashed var(--line); border-radius: 8px; background: #fff; cursor: pointer; font-size: .72rem; color: var(--ink-2); line-height: 1.1; vertical-align: middle; }
.pic-btn.has { border-style: solid; }
.pic-btn img.pimg { width: 100%; height: 100%; margin: 0; border: 0; cursor: pointer; }
.pic-del { border: 0; background: none; color: var(--ink-2); cursor: pointer; font-size: .9rem; padding: 2px 4px; vertical-align: middle; }
.pic-view { position: fixed; inset: 0; background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; cursor: zoom-out; }
.pic-view img { max-width: 100%; max-height: 100%; border-radius: 10px; background: #fff; }
@media print { img.pimg { display: none; } }

.free-cell { white-space: nowrap; min-width: 76px; }
.free-cell .calc-free { display: block; font-size: .72rem; color: var(--ink-2); text-align: right; min-height: 1em; }
input.bad { border-color: var(--red) !important; background: var(--red-soft); }

tr.qty-total td { font-weight: 700; background: var(--line-2); border-top: 2px solid var(--line); font-variant-numeric: tabular-nums; }

.pn-cell { white-space: nowrap; }
.hist-link { display: block; font-size: .72rem; margin-top: 2px; color: var(--ink-2); }
tr.cur-price td { background: var(--good-soft); }

.dval-hint { display: block; font-size: .76rem; }
td.dval { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.btn.ok-btn { background: var(--good-soft); color: #1d6b38; border-color: #b9dcc4; }

.sub-h { margin: 10px 0 4px; font-size: .9rem; color: var(--ink-2); }
.calc.calc-break { margin-bottom: 6px; opacity: .9; }
