:root {
  --navy: #1E2A5A; --navy-2: #2B3A73; --navy-soft: #E7E9F2;
  --bg: #F6F1E7; --card: #FFFFFF; --ink: #22201C; --muted: #6E695F; --faint: #9A9488;
  --line: #E7E0D2; --line-2: #F0EBE0;
  --green: #3E7B55; --green-soft: #E5F0E8; --red: #B5452B; --red-soft: #F7E6E0;
  --gold: #C98A2E; --gold-soft: #F8EEDC; --blue-soft: #E8ECF7;
  --radius: 12px; --shadow: 0 1px 2px rgba(34,32,28,.05), 0 2px 10px rgba(34,32,28,.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hind Siliguri", "Noto Sans Bengali", "Bangla Sangam MN", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13.5px; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; }
.pos { color: var(--green); } .neg { color: var(--red); }
.boot { padding: 80px; text-align: center; color: var(--muted); }

/* Layout */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #DCE0EE; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; }
.brand img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; clip-path: circle(44%); background: #F9F1E2; }
.brand b { display: block; font-size: 15px; } .brand span { font-size: 11.5px; color: #AEB5D0; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #D5DAEA; font-size: 13.5px; margin-bottom: 1px; }
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.nav a.active { background: #fff; color: var(--navy); font-weight: 600; }
.nav a .bn { margin-left: auto; font-size: 11px; opacity: .6; }
.nav a.active .bn { opacity: .75; }
.nav svg { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side .foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; color: #AEB5D0; }
.side .foot button { background: none; border: 0; color: #DCE0EE; padding: 0; cursor: pointer; font: inherit; text-decoration: underline; }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 16px 28px; border-bottom: 1px solid var(--line); background: rgba(246,241,231,.92); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(6px); }
.top h1 { font-size: 19px; }
.top .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.menu-btn { display: none; background: none; border: 0; padding: 4px; cursor: pointer; }
.page { padding: 22px 28px 60px; max-width: 1320px; }
.demo-banner { background: var(--gold); color: #fff; text-align: center; font-size: 12.5px; padding: 5px; font-weight: 600; }

/* Buttons & inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 7px 13px; font: inherit; font-weight: 560; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #CFC6B3; text-decoration: none; }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.primary:hover { background: var(--navy-2); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); border-color: #E7C3B8; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--navy); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #DCD4C3; border-radius: 8px; padding: 7px 10px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(30,42,90,.25); border-color: var(--navy); }
input[type=checkbox], input[type=radio] { width: auto; }
textarea { min-height: 64px; resize: vertical; }
label.f { display: block; font-size: 12.5px; color: var(--muted); font-weight: 560; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.seg { display: inline-flex; background: #EDE6D7; border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button, .seg a { border: 0; background: transparent; padding: 5px 11px; border-radius: 7px; font: inherit; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button.on, .seg a.on { background: #fff; color: var(--navy); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

/* Cards & tables */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-h .r { margin-left: auto; }
.grid-cards { display: grid; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; }
.kpi .t { font-size: 12.5px; color: var(--muted); font-weight: 560; display: flex; gap: 6px; align-items: center; }
.kpi .v { font-size: 22px; font-weight: 680; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.hero { background: var(--navy); color: #fff; border-color: var(--navy); }
.kpi.hero .t, .kpi.hero .s { color: #C3C9E0; }
.kpi .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FBF9F4; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #FBF8F1; }
table.t tr.void td { color: var(--faint); text-decoration: line-through; }
table.t tr.total td { font-weight: 650; border-top: 1.5px solid var(--ink); border-bottom: 0; }
table.t tr.sub td { font-weight: 600; background: #FBF9F4; }
.tablewrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.chip { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: #EEE8DB; color: var(--muted); white-space: nowrap; }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.gold { background: var(--gold-soft); color: #9A6516; }
.chip.navy { background: var(--navy-soft); color: var(--navy); }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; font-size: 14.5px; }
.explain { background: var(--blue-soft); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: #33406D; margin-bottom: 16px; }
.explain b { color: var(--navy); }
.warnbox { background: var(--gold-soft); border-radius: 10px; padding: 10px 14px; font-size: 13px; color: #7C5310; margin-bottom: 14px; }
.errbox { background: var(--red-soft); border-radius: 10px; padding: 10px 14px; font-size: 13px; color: var(--red); margin-bottom: 14px; }
.okbox { background: var(--green-soft); border-radius: 10px; padding: 10px 14px; font-size: 13px; color: var(--green); margin-bottom: 14px; }

/* Dashboard */
.summary-line { font-size: 15px; color: #3B3830; margin: 0 0 16px; max-width: 900px; }
.summary-line b { color: var(--ink); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.alert { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.alert:last-child { border-bottom: 0; }
.alert .ic { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; }
.alert .ic.bad { background: var(--red); } .alert .ic.warn { background: var(--gold); } .alert .ic.good { background: var(--green); } .alert .ic.info { background: var(--navy); }
.alert b { display: block; font-size: 13.5px; }
.alert p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 7px; white-space: nowrap; transform: translate(-50%, -100%); opacity: 0; transition: opacity .1s; z-index: 5; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.getting-started ol { margin: 8px 0 0; padding-left: 20px; }
.getting-started li { margin-bottom: 6px; }

/* Forms with line items */
.lines { width: 100%; border-collapse: collapse; }
.lines th { font-size: 12px; color: var(--muted); text-align: left; padding: 6px 6px; font-weight: 600; }
.lines td { padding: 4px 6px; vertical-align: top; }
.lines td.x { width: 30px; }
.lines .rm { border: 0; background: none; color: var(--faint); cursor: pointer; font-size: 18px; line-height: 1; padding: 6px 4px; }
.lines .rm:hover { color: var(--red); }
.totals { margin-left: auto; max-width: 380px; }
.totals .tr { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; align-items: center; }
.totals .tr input { max-width: 140px; text-align: right; }
.totals .grand { font-size: 18px; font-weight: 700; border-top: 1.5px solid var(--ink); padding-top: 8px; margin-top: 4px; }
.form-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.paybox { background: #FBF9F4; border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-top: 14px; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(20,22,35,.42); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal.wide { max-width: 820px; }
.modal-h { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-h .x { margin-left: auto; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.modal-b { padding: 18px 20px; }
.modal-f { padding: 12px 20px 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13.5px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 200; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red); }

/* Login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--navy); }
.auth .box { background: #fff; border-radius: 16px; padding: 30px; width: 100%; max-width: 400px; }
.auth .logo { width: 64px; height: 64px; border-radius: 50%; clip-path: circle(44%); display: block; margin: 0 auto 12px; }
.auth h1 { text-align: center; margin-bottom: 4px; }
.auth p.sub { text-align: center; color: var(--muted); margin: 0 0 20px; }

/* Invoice document */
.doc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 36px 40px; max-width: 860px; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.doc-head img { width: 64px; height: 64px; border-radius: 50%; clip-path: circle(44%); }
.doc-title { font-size: 26px; font-weight: 750; color: var(--navy); text-align: right; }
.doc-meta { display: grid; grid-template-columns: auto auto; gap: 2px 14px; font-size: 13px; justify-content: end; margin-top: 6px; }
.doc-meta span:nth-child(odd) { color: var(--muted); }
.doc table.t th { background: var(--navy); color: #fff; }
.doc .stamp { display: inline-block; border: 2px solid; border-radius: 6px; padding: 2px 10px; font-weight: 700; font-size: 13px; letter-spacing: .04em; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 560; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--navy); border-color: var(--navy); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.report-cards a { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; color: var(--ink); }
.report-cards a:hover { border-color: var(--navy); text-decoration: none; }
.report-cards a p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.stmt td:first-child { padding-left: 10px; }
.stmt td.ind { padding-left: 28px; }
.metric { padding: 14px 0; border-bottom: 1px solid var(--line-2); display: flex; gap: 16px; align-items: baseline; }
.metric:last-child { border-bottom: 0; }
.metric .mv { font-size: 20px; font-weight: 700; min-width: 130px; font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
  .grid4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .menu-btn { display: block; }
  .top { padding: 12px 16px; flex-wrap: wrap; }
  .top .actions { margin-left: 0; width: 100%; }
  .page { padding: 16px 16px 60px; }
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .doc { padding: 20px 16px; }
  .doc-head { flex-direction: column; }
  .doc-title, .doc-meta { text-align: left; justify-content: start; }
  .lines thead { display: none; }
  .lines tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; border-bottom: 1px solid var(--line); padding: 6px 0; }
  .lines td:first-child { grid-column: 1 / -1; }
  .kpi .v { font-size: 19px; }
}
@media print {
  body { background: #fff; }
  .side, .top, .no-print, .demo-banner, #toast { display: none !important; }
  .shell { display: block; }
  .page { padding: 0; max-width: none; }
  .card, .doc, .kpi { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .doc { border: 0; padding: 0; }
  .print-only { display: block !important; }
  a { color: inherit; }
}
.print-only { display: none; }
a.kpi { color: var(--ink); text-decoration: none; display: block; }
a.kpi:hover { border-color: #CFC6B3; text-decoration: none; }
a.kpi.hero { color: #fff; }
a.kpi.hero:hover { border-color: var(--navy-2); background: var(--navy-2); }
.menu-btn svg { width: 24px; height: 24px; stroke: var(--ink); fill: none; stroke-width: 2; stroke-linecap: round; display: block; }
@media (max-width: 860px) { .kpis { grid-template-columns: 1fr 1fr; gap: 10px; } .kpi { padding: 12px; } .kpi .v { font-size: 17px; } .kpi.hero { grid-column: 1 / -1; } }

/* Simple mode hides extra options (line discounts, batches, due dates…) until "Show extra options" is clicked. */
body.simple .adv { display: none !important; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-bottom: 26px; }
.tile { display: block; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; font: inherit; color: var(--ink); cursor: pointer; box-shadow: var(--shadow); }
.tile:hover { border-color: var(--navy); text-decoration: none; }
.tile b { display: block; font-size: 15px; margin-bottom: 3px; }
.tile span { color: var(--muted); font-size: 13px; }
.group-h { font-size: 15px; margin: 4px 0 10px; color: var(--muted); font-weight: 600; }
.mean { font-size: 12px; color: var(--muted); margin-top: 6px; border-top: 1px dashed var(--line); padding-top: 6px; }
.kpi.hero .mean { color: #C3C9E0; border-color: rgba(255,255,255,.18); }

/* Quick Sale */
.quick-wrap { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.qtile { position: relative; text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 14px 12px; font: inherit; cursor: pointer; min-height: 96px; display: flex; flex-direction: column; gap: 3px; }
.qtile b { font-size: 14px; line-height: 1.25; }
.qtile span { font-size: 15px; font-weight: 700; color: var(--navy); }
.qtile small { font-size: 11.5px; }
.qtile:hover { border-color: var(--navy); }
.qtile.on { border-color: var(--green); background: var(--green-soft); }
.qtile:disabled { opacity: .45; cursor: not-allowed; }
.qbadge { position: absolute; top: 8px; right: 8px; background: var(--green); color: #fff !important; font-size: 12px !important; border-radius: 99px; padding: 1px 8px; }
.qcart { position: sticky; top: 76px; }
@media (max-width: 960px) { .quick-wrap { grid-template-columns: 1fr; } .qcart { position: static; } .qgrid { grid-template-columns: repeat(2, 1fr); } }

/* Quick Sale: website menu groups, − / + stepper, custom price */
.qgroup { margin: 14px 0 8px; font-size: 14px; }
.qgroup:first-child { margin-top: 0; }
.qtile .qsize { font-style: normal; font-size: 11px; color: var(--muted, #777); line-height: 1.3; }
.qtile s { font-size: 12px; font-weight: 400; }
.qrow { gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.stepper button { width: 34px; border: 0; background: #f4f4f4; font: inherit; font-size: 18px; font-weight: 700; cursor: pointer; color: var(--navy); }
.stepper button:hover { background: var(--green-soft); }
.stepper input { width: 52px; border: 0 !important; border-radius: 0 !important; text-align: center; font-weight: 700; padding: 6px 2px; box-shadow: none !important; }
.qprice { width: 88px; }
.qprice.changed { border-color: #C98A2E !important; background: #FFF7EA; }
