:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #1d2733;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #b91c1c;        /* Shah Cement red */
  --brand-dark: #7f1d1d;
  --side: #1e293b;
  --side-ink: #cbd5e1;
  --good: #15803d;
  --bad: #b91c1c;
  --warn: #b45309;
  --blue: #1d4ed8;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 220px; flex-shrink: 0; background: var(--side); color: var(--side-ink);
  padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { padding: 4px 10px 18px; border-bottom: 1px solid #334155; margin-bottom: 12px; }
.brand b { display: block; color: #fff; font-size: 17px; letter-spacing: .2px; }
.brand span { font-size: 11.5px; color: #94a3b8; }
.side a {
  display: block; color: var(--side-ink); padding: 8px 10px; border-radius: 7px;
  margin-bottom: 2px; font-size: 14px;
}
.side a:hover { background: #334155; text-decoration: none; color: #fff; }
.side a.on { background: var(--brand); color: #fff; }
.side .sep { height: 1px; background: #334155; margin: 10px 4px; }
.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.topbar h1 { font-size: 21px; margin: 0; flex: 1; min-width: 200px; }
.menu-btn { display: none; }

/* ---------- panels & grid ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 18px;
}
.panel h2 { font-size: 15.5px; margin: 0 0 12px; }
.panel h2 small { font-weight: 400; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .lbl { color: var(--muted); font-size: 12.5px; }
.kpi .val { font-size: 22px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi.red .val { color: var(--bad); }
.kpi.green .val { color: var(--good); }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); font-weight: 600; background: #f8fafc; white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:hover td { background: #fafbfd; }
tfoot td { font-weight: 650; background: #f8fafc; border-top: 2px solid var(--line); }
tr.opening td { background: #fffbeb; font-style: italic; }
.pos { color: var(--bad); }
.neg { color: var(--good); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tag {
  display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 99px;
  background: #eef2ff; color: #3730a3; white-space: nowrap;
}
.tag.delivery { background: #fee2e2; color: #991b1b; }
.tag.payment { background: #dcfce7; color: #166534; }
.tag.adjustment { background: #fef3c7; color: #92400e; }
.tag.fix { background: #e0f2fe; color: #075985; }
.tag.warn { background: #fef3c7; color: #92400e; }

/* ---------- bars ---------- */
.bar { background: #eef2f7; border-radius: 99px; height: 9px; overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.bar.good i { background: var(--good); }

/* ---------- forms ---------- */
form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.f { display: flex; flex-direction: column; }
input, select, textarea {
  font: inherit; padding: 7px 9px; border: 1px solid #cbd5e1; border-radius: 7px;
  background: #fff; color: var(--ink); min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #93c5fd; border-color: #60a5fa; }
input[type=number] { width: 110px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 12px; margin-bottom: 12px; }
.fields .wide { grid-column: span 2; }
.btn {
  display: inline-block; font: inherit; font-weight: 600; padding: 7px 14px; border-radius: 7px;
  border: 1px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--ink); border-color: #cbd5e1; }
.btn.ghost:hover { background: #f1f5f9; }
.btn.sm { padding: 3px 9px; font-size: 12.5px; font-weight: 500; }
.linkbtn { background: none; border: 0; color: var(--bad); cursor: pointer; font: inherit; font-size: 12.5px; padding: 0; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { font: inherit; padding: 6px 12px; border: 1px solid #cbd5e1; background: #fff; border-radius: 7px; cursor: pointer; }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.hide { display: none !important; }

.flash { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; padding: 9px 13px; border-radius: 8px; margin-bottom: 14px; }
.note { background: #fffbeb; border: 1px solid #fde68a; color: #78350f; padding: 9px 13px; border-radius: 8px; margin-bottom: 14px; }
.right { margin-left: auto; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .g2, .g3 { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 20; left: -240px; transition: left .2s; }
  .side.open { left: 0; }
  .menu-btn { display: inline-block; }
  .main { padding: 14px 16px 50px; }
  .fields .wide { grid-column: auto; }
}

/* ---------- print ---------- */
@media print {
  .side, .no-print, .topbar form, .menu-btn { display: none !important; }
  .main { padding: 0; }
  .panel { border: 0; padding: 0; }
  body { background: #fff; font-size: 12px; }
}

/* Bangla */
html[lang="bn"] body {
  font-family: "Hind Siliguri", "Segoe UI", "Nirmala UI", "Vrinda", system-ui, sans-serif;
  font-size: 15px;
}
/* language switch */
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang-switch a { padding: 5px 10px; font-size: 13px; color: inherit; text-decoration: none; background: #fff; }
.lang-switch a.on { background: #b91c1c; color: #fff; font-weight: 600; }
@media print { .lang-switch { display: none; } }

/* who added / edited */
.by { display: inline-block; font-size: 11px; color: #475569; background: #eef2f7; border-radius: 5px; padding: 0 6px; margin: 1px 2px 1px 0; white-space: nowrap; }
.by.edited { background: #fef3c7; color: #92400e; }
.act-add { background: #dcfce7; color: #166534; }
.act-edit { background: #fef3c7; color: #92400e; }
.act-delete { background: #fee2e2; color: #991b1b; }

/* shops grouped by officer / market area */
.area-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.area-tabs a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: inherit; text-decoration: none; font-size: 14px; }
.area-tabs a span { color: #888; font-size: 12px; margin-left: 4px; }
.area-tabs a.on { background: #b91c1c; border-color: #b91c1c; color: #fff; font-weight: 600; }
.area-tabs a.on span { color: #fde2e2; }
tr.grp-head td { background: #f6f1f1; border-top: 2px solid #e5d5d5; }
