:root {
  --primary: #12335f;
  --primary-2: #1f4d87;
  --accent: #f47c20;
  --green: #1f9d62;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #182336;
  --muted: #6c778a;
  --border: #dde4ef;
  --shadow: 0 14px 35px rgba(18, 51, 95, 0.09);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input, select, textarea { font: inherit; }
button {
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
}
button:hover { background: var(--primary-2); }
.secondary, .ghost-btn {
  background: #eef3fa;
  color: var(--primary);
  border: 1px solid var(--border);
}
.secondary:hover, .ghost-btn:hover { background: #dfe9f7; }

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 278px;
  background: var(--primary);
  color: #fff;
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px;
  border-bottom: 1px solid rgba(255,255,255,0.14);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--accent);
  font-weight: 700;
}
.brand small, .profile small { display: block; color: #91a1b8; margin-top: 3px; }
.nav { padding: 12px; }
.nav button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  margin-bottom: 4px;
  background: transparent;
  color: #e8eef8;
  text-align: left;
  border-radius: 6px;
}
.nav button.active, .nav button:hover { background: rgba(255,255,255,0.13); }
.nav span { width: 22px; text-align: center; }

.main { width: 100%; margin-left: 278px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 78px;
  background: rgba(255,255,255,0.94);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 24px;
  backdrop-filter: blur(10px);
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 24px; color: var(--primary); }
#pageSubtitle { margin-bottom: 0; color: var(--muted); }
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 280px;
  background: #f1f5fa;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}
.search input { width: 100%; border: 0; outline: 0; background: transparent; }
.icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  background: #eef3fa;
  color: var(--primary);
}
.mobile-toggle { display: none; }
.profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.profile > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-weight: 700;
}

.content { padding: 24px; }
.view { display: none; }
.view.active { display: block; }
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.metric-card, .panel, .form-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.metric-card {
  padding: 18px;
  min-height: 116px;
}
.metric-card small { color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 11px; }
.metric-card strong { display: block; margin: 12px 0 8px; font-size: 25px; color: var(--primary); }
.metric-card span { color: var(--green); font-size: 13px; }
.panel, .form-panel { padding: 18px; margin-bottom: 20px; }
.panel h2, .form-panel h2 { font-size: 18px; color: var(--primary); margin-bottom: 14px; }
.panel-head, .toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.split, .chart-grid, .india-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.chart-grid canvas { max-height: 260px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th {
  color: var(--primary);
  background: #f7f9fc;
  font-size: 13px;
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
}
.badge.green { background: #e5f7ee; color: #137446; }
.badge.orange { background: #fff0e3; color: #a84d00; }
.badge.blue { background: #e8f1ff; color: #1f4d87; }
.badge.red { background: #ffe9e9; color: #ae2424; }
.badge.gray { background: #eef1f5; color: #576170; }

.grid-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  padding: 11px 12px;
  color: var(--text);
}
textarea { min-height: 92px; resize: vertical; grid-column: span 2; }
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  grid-column: 1 / -1;
}
.total-output {
  display: flex;
  align-items: center;
  border-radius: 6px;
  background: #eef8f2;
  color: #12633d;
  padding: 11px 12px;
  font-weight: 700;
}

.tracking-list { display: grid; gap: 12px; }
.track-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
.track-card header { display: flex; justify-content: space-between; gap: 10px; }
.progress {
  height: 9px;
  background: #e8eef6;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
}
.progress span { display: block; height: 100%; background: var(--accent); }
.route-map {
  min-height: 330px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(18,51,95,0.08), rgba(31,157,98,0.12)),
    #fff;
  margin-bottom: 20px;
}
.map-label {
  position: absolute;
  left: 18px;
  top: 18px;
  color: var(--primary);
  font-weight: 700;
}
.route-line {
  position: absolute;
  left: 18%;
  right: 18%;
  top: 48%;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--green));
  transform: rotate(18deg);
}
.pin {
  position: absolute;
  padding: 7px 9px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  box-shadow: var(--shadow);
}
.delhi { top: 20%; left: 34%; }
.indore { top: 46%; left: 45%; }
.mumbai { top: 62%; left: 31%; }
.chennai { top: 76%; left: 57%; }
.kolkata { top: 44%; left: 72%; }
.bengaluru { top: 70%; left: 49%; }

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.tab {
  background: #eef3fa;
  color: var(--primary);
  border: 1px solid var(--border);
}
.tab.active { background: var(--primary); color: #fff; }
.tab-content { display: none; }
.tab-content.active { display: block; }

.modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(9, 19, 36, 0.54);
  z-index: 50;
  padding: 18px;
}
.modal.open { display: grid; }
.modal-card {
  width: min(780px, 100%);
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  position: relative;
}
.close-modal {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 34px;
  height: 34px;
  padding: 0;
  background: #eef3fa;
  color: var(--primary);
}
.modal-map { min-height: 280px; margin: 0; }

.print-invoice {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.invoice-head, .invoice-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 16px;
}
.signature {
  margin-top: 40px;
  text-align: right;
  color: var(--primary);
  font-weight: 700;
}

@media (max-width: 1180px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { align-items: flex-start; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .mobile-toggle { display: grid; }
  .topbar { padding: 12px 14px; }
  .content { padding: 14px; }
  .top-actions { width: 100%; justify-content: flex-start; }
  .search { min-width: 0; flex: 1 1 220px; }
  .split, .chart-grid, .india-layout { grid-template-columns: 1fr; }
  .grid-form { grid-template-columns: 1fr; }
  textarea, .form-actions { grid-column: auto; }
}

@media (max-width: 560px) {
  .card-grid { grid-template-columns: 1fr; }
  .profile div { display: none; }
  h1 { font-size: 20px; }
  .panel-head, .toolbar, .invoice-head, .invoice-row { align-items: flex-start; flex-direction: column; }
}

@media print {
  .sidebar, .topbar, .nav, .form-panel, .panel:not(:has(.print-invoice)) { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  .view { display: none !important; }
  #taxInvoice { display: block !important; }
  .print-invoice { box-shadow: none; border: 0; }
}

/* Client demo polish layer */
body.dark {
  --primary: #8abaff;
  --primary-2: #a8ccff;
  --accent: #ff9a4d;
  --green: #54d38e;
  --bg: #101722;
  --panel: #172232;
  --text: #eef4ff;
  --muted: #aab7ca;
  --border: #2b3a4f;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}
body.dark .topbar { background: rgba(23, 34, 50, 0.95); }
body.dark input, body.dark select, body.dark textarea { background: #172232; color: var(--text); }
body.dark th { background: #202d3e; }
body.dark .search, body.dark .icon-btn, body.dark .secondary, body.dark .ghost-btn { background: #202d3e; }

.client-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr);
  gap: 20px;
  padding: 24px;
  margin-bottom: 20px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, #12335f, #1f4d87 58%, #176144);
  box-shadow: var(--shadow);
}
.client-hero h2 { margin: 0 0 10px; font-size: 30px; line-height: 1.18; color: #fff; }
.client-hero p { max-width: 760px; color: #dbe7f5; }
.client-eyebrow { display: inline-block; margin-bottom: 8px; color: #ffd2ad; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hero-actions button { background: #fff; color: #12335f; }
.hero-actions .secondary { background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.3); }
.hero-board { display: grid; gap: 12px; }
.hero-board div { padding: 16px; border-radius: 8px; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18); }
.hero-board small { display: block; color: #bfd0e6; text-transform: uppercase; font-size: 11px; font-weight: 800; }
.hero-board strong { display: block; margin: 8px 0; font-size: 28px; }
.hero-board span { color: #dce8f5; }
.metric-card { position: relative; overflow: hidden; transition: transform 0.16s ease, box-shadow 0.16s ease; }
.metric-card:before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent); }
.metric-card:hover, .panel:hover, .form-panel:hover { transform: translateY(-1px); box-shadow: 0 18px 42px rgba(18, 51, 95, 0.13); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(244,124,32,0.12); outline: none; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: rgba(244, 124, 32, 0.07); }
.reports-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.report-card { padding: 15px; border: 1px solid var(--border); border-radius: 8px; background: #f7f9fc; }
body.dark .report-card { background: #202d3e; }
.report-card strong { display: block; margin-bottom: 7px; color: var(--primary); }
.preview-box { margin-top: 16px; min-height: 220px; display: grid; place-items: center; border: 1px dashed var(--border); border-radius: 8px; color: var(--muted); background: #f7f9fc; overflow: hidden; }
body.dark .preview-box { background: #202d3e; }
.preview-box img, .preview-box iframe { width: 100%; height: 320px; object-fit: contain; border: 0; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 80; max-width: 360px; padding: 13px 15px; border-radius: 8px; background: #12335f; color: #fff; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity 0.2s ease, transform 0.2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
body.dark .badge.green { background: rgba(84,211,142,0.16); color: #8ef0b9; }
body.dark .badge.orange { background: rgba(255,154,77,0.16); color: #ffc397; }
body.dark .badge.blue { background: rgba(125,180,255,0.16); color: #abd0ff; }
body.dark .badge.red { background: rgba(255,100,100,0.16); color: #ffb0b0; }
@media (max-width: 1180px) { .client-hero { grid-template-columns: 1fr; } .reports-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .client-hero { padding: 18px; } .client-hero h2 { font-size: 24px; } .reports-grid { grid-template-columns: 1fr; } }

/* Client presentation upgrade */
body {
  background:
    linear-gradient(180deg, rgba(18, 51, 95, 0.04), transparent 280px),
    var(--bg);
}
button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  font-weight: 800;
  line-height: 1.1;
  box-shadow: 0 8px 18px rgba(18, 51, 95, 0.12);
}
button:active { transform: translateY(0); box-shadow: none; }
button.secondary, button.ghost-btn, .icon-btn, .tab {
  box-shadow: none;
}
button[data-view-jump], #generateInvoice, form button[type="submit"] {
  background: linear-gradient(135deg, #12335f, #1f4d87);
}
.hero-actions button[data-view-jump] {
  background: #ffffff;
  color: #12335f;
}
.hero-actions .secondary {
  background: rgba(255,255,255,0.14);
  color: #fff;
}
.secondary:before, .ghost-btn:before { content: ""; }
.demo-action:after, .print-btn:after, #generateInvoice:after { content: ""; }

.sidebar { box-shadow: 14px 0 35px rgba(10, 25, 48, 0.14); }
.brand { position: sticky; top: 0; z-index: 2; background: rgba(16, 43, 80, 0.96); backdrop-filter: blur(10px); }
.nav button { border: 1px solid transparent; }
.nav button.active { border-color: rgba(255,255,255,0.15); box-shadow: inset 3px 0 0 #f47c20; }
.nav button span { font-weight: 800; letter-spacing: 0; }
.topbar { box-shadow: 0 8px 30px rgba(18, 51, 95, 0.06); }
.search span { color: var(--primary); }
.icon-btn { min-width: 54px; border-radius: 8px; }
.profile { box-shadow: 0 8px 18px rgba(18, 51, 95, 0.06); }

.client-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.18);
}
.client-hero:after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -90px;
  top: -100px;
  border: 44px solid rgba(255,255,255,0.07);
  border-radius: 50%;
}
.client-hero > * { position: relative; z-index: 1; }
.hero-board div { transition: transform 0.16s ease, background 0.16s ease; }
.hero-board div:hover { transform: translateY(-2px); background: rgba(255,255,255,0.17); }

.demo-strip, .demo-toolbar, .module-insight {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--shadow);
}
.demo-strip {
  display: grid;
  grid-template-columns: 1.1fr repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  margin-bottom: 20px;
}
.demo-strip h3 { margin: 0 0 4px; color: var(--primary); font-size: 17px; }
.demo-strip p { margin: 0; color: var(--muted); font-size: 13px; }
.workflow-step {
  border: 1px solid var(--border);
  background: var(--soft);
  color: var(--text);
  box-shadow: none;
  min-height: 64px;
  align-items: flex-start;
  flex-direction: column;
  text-align: left;
}
.workflow-step small { color: var(--muted); font-weight: 700; }
.workflow-step strong { color: var(--primary); }
.workflow-step:hover { border-color: var(--accent); background: #fff8f1; }
body.dark .workflow-step:hover { background: #26364b; }

.demo-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
  margin-bottom: 18px;
}
.demo-toolbar div:first-child strong { display: block; color: var(--primary); }
.demo-toolbar div:first-child span { color: var(--muted); font-size: 13px; }
.demo-toolbar-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.demo-toolbar-actions button { min-height: 36px; padding: 9px 11px; font-size: 13px; }

.module-insight {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  margin-bottom: 18px;
}
.module-insight div {
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid var(--border);
}
.module-insight small { display: block; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.module-insight strong { display: block; margin-top: 7px; color: var(--primary); font-size: 18px; }

.metric-card { border-top: 1px solid rgba(255,255,255,0.4); }
.metric-card strong { letter-spacing: 0; }
.panel, .form-panel { transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease; }
.panel:hover, .form-panel:hover { border-color: rgba(244, 124, 32, 0.35); }
.panel-head h2:before, .form-panel h2:before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

.table-wrap { box-shadow: inset 0 1px 0 rgba(255,255,255,0.5); }
th { position: sticky; top: 0; z-index: 1; }
td button { min-height: 31px; padding: 7px 9px; font-size: 12px; box-shadow: none; }
.row-actions { display: flex; gap: 7px; }
.badge { border: 1px solid rgba(255,255,255,0.35); }
.badge.pulse { animation: badgePulse 0.7s ease; }
@keyframes badgePulse { 0% { transform: scale(1); } 45% { transform: scale(1.08); } 100% { transform: scale(1); } }

.route-map:before {
  content: "";
  position: absolute;
  inset: 56px 34px 34px;
  border: 1px dashed rgba(18, 51, 95, 0.16);
  border-radius: 42% 58% 50% 48%;
}
.pin { border: 2px solid #fff; }
.progress span { position: relative; }
.progress span:after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  animation: progressShine 1.8s linear infinite;
}
@keyframes progressShine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.modal-card { border: 1px solid var(--border); }
.toast { border-left: 5px solid #f47c20; }
.demo-checklist { display: grid; gap: 10px; margin-top: 12px; }
.demo-checklist label { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--soft); }
.demo-checklist input { width: auto; }
.demo-success { color: var(--green); font-weight: 800; }

@media (max-width: 1180px) {
  .demo-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .module-insight { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .demo-strip { grid-template-columns: 1fr; }
  .demo-toolbar { align-items: flex-start; flex-direction: column; }
  .demo-toolbar-actions { width: 100%; }
  .demo-toolbar-actions button { flex: 1 1 130px; }
}

/* Sidebar overlap fix: keep module code badges and labels in separate stable columns */
.nav button {
  display: grid !important;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  column-gap: 9px;
  min-height: 42px;
  padding: 9px 10px;
  white-space: normal;
  overflow: hidden;
}
.nav button span {
  width: 46px !important;
  min-width: 46px;
  max-width: 46px;
  height: 25px;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  background: rgba(255,255,255,0.11);
}
.nav button {
  font-size: 13px;
  line-height: 1.18;
  word-break: normal;
}
.nav button.active span {
  background: #f47c20;
  color: #fff;
}
@media (max-width: 860px) {
  .sidebar { width: min(286px, 86vw); }
  .nav button { grid-template-columns: 44px minmax(0, 1fr); }
  .nav button span { width: 44px !important; min-width: 44px; max-width: 44px; }
}
@media (max-width: 360px) {
  .nav button { grid-template-columns: 40px minmax(0, 1fr); font-size: 12px; }
  .nav button span { width: 40px !important; min-width: 40px; max-width: 40px; font-size: 9px; }
}

/* Final navigation robustness: readable labels on narrow screenshots and mobile widths */
.nav {
  padding: 10px 8px 18px;
}
.nav button {
  justify-content: stretch !important;
  justify-items: start;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
  font-weight: 750;
}
.nav button span + * { min-width: 0; }
.nav button::after { display: none; }
.sidebar { max-width: 100vw; }
@media (max-width: 420px) {
  .sidebar { width: 240px; }
  .nav { padding-left: 7px; padding-right: 7px; }
  .nav button { grid-template-columns: 39px minmax(0, 1fr); column-gap: 7px; padding-left: 8px; padding-right: 8px; font-size: 12px; }
  .nav button span { width: 39px !important; min-width: 39px; max-width: 39px; font-size: 8.5px; }
}

/* Interactive route map upgrade */
.interactive-map {
  position: relative;
  overflow: hidden;
  min-height: 430px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(18,51,95,0.08), rgba(31,157,98,0.12)),
    radial-gradient(circle at 22% 20%, rgba(244,124,32,0.18), transparent 24%),
    var(--panel);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.map-topbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.45);
  border-radius: 10px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(10px);
}
body.dark .map-topbar { background: rgba(23,34,50,0.88); border-color: var(--border); }
.map-topbar strong { display: block; color: var(--primary); }
.map-topbar span { color: var(--muted); font-size: 13px; }
.route-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.route-chip {
  min-height: 34px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  background: var(--soft);
  color: var(--primary);
  box-shadow: none;
  font-size: 12px;
}
.route-chip.active { background: #12335f; color: #fff; border-color: #12335f; }
.map-canvas {
  position: absolute;
  inset: 92px 16px 86px 16px;
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(18,51,95,0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(18,51,95,0.06) 1px, transparent 1px);
  background-size: 42px 42px;
}
.map-canvas svg { width: 100%; height: 100%; overflow: visible; }
.india-outline { fill: rgba(255,255,255,0.56); stroke: rgba(18,51,95,0.18); stroke-width: 2; }
body.dark .india-outline { fill: rgba(255,255,255,0.04); stroke: rgba(138,186,255,0.25); }
.route-path-bg { fill: none; stroke: rgba(18,51,95,0.16); stroke-width: 8; stroke-linecap: round; }
.route-path-active { fill: none; stroke: url(#routeGradient); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 900; stroke-dashoffset: 900; animation: drawRoute 1.2s ease forwards; }
@keyframes drawRoute { to { stroke-dashoffset: 0; } }
.route-vehicle {
  offset-path: path('M 145 88 C 226 126, 296 174, 386 246');
  offset-distance: 0%;
  animation: vehicleMove 7s ease-in-out infinite;
  position: absolute;
  z-index: 3;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f47c20;
  color: #fff;
  box-shadow: 0 12px 25px rgba(244,124,32,0.35);
  font-size: 18px;
}
@keyframes vehicleMove { 0%, 8% { offset-distance: 0%; } 78%, 100% { offset-distance: var(--route-progress, 68%); } }
.map-city {
  position: absolute;
  z-index: 4;
  transform: translate(-50%, -50%);
  display: grid;
  gap: 5px;
  justify-items: center;
}
.map-city .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #12335f;
  border: 3px solid #fff;
  box-shadow: 0 0 0 5px rgba(18,51,95,0.12);
}
.map-city.active .dot { background: #f47c20; box-shadow: 0 0 0 7px rgba(244,124,32,0.18); }
.map-city label {
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(18,51,95,0.10);
}
body.dark .map-city label { background: #202d3e; }
.map-bottom {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 4;
  display: grid;
  grid-template-columns: 1.3fr repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.route-stat {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.9);
  box-shadow: 0 10px 24px rgba(18,51,95,0.08);
}
body.dark .route-stat { background: rgba(23,34,50,0.9); }
.route-stat small { display: block; color: var(--muted); font-weight: 800; text-transform: uppercase; font-size: 10px; }
.route-stat strong { display: block; margin-top: 6px; color: var(--primary); font-size: 16px; }
.live-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  font-weight: 800;
}
.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(31,157,98,0.4);
  animation: livePulse 1.5s infinite;
}
@keyframes livePulse { 70% { box-shadow: 0 0 0 10px rgba(31,157,98,0); } 100% { box-shadow: 0 0 0 0 rgba(31,157,98,0); } }
@media (max-width: 900px) {
  .interactive-map { min-height: 560px; }
  .map-topbar { align-items: flex-start; flex-direction: column; }
  .map-canvas { inset: 150px 12px 150px 12px; }
  .map-bottom { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .interactive-map { min-height: 640px; }
  .route-controls { width: 100%; }
  .route-chip { flex: 1 1 130px; }
  .map-bottom { grid-template-columns: 1fr; }
}

/* Final navigation and button polish */
.sidebar {
  background: linear-gradient(180deg, #102d54 0%, #0e2748 48%, #0b1f3a 100%);
}
.brand {
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  box-shadow: 0 10px 22px rgba(244,124,32,0.25);
}
.nav {
  padding: 12px 10px 22px;
}
.nav button {
  grid-template-columns: 14px minmax(0, 1fr) !important;
  column-gap: 10px;
  min-height: 39px;
  padding: 9px 12px;
  margin: 2px 0;
  border-radius: 8px;
  color: rgba(255,255,255,0.82);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none !important;
  transform: none !important;
}
.nav button span {
  width: 8px !important;
  min-width: 8px !important;
  max-width: 8px !important;
  height: 8px !important;
  padding: 0;
  overflow: hidden;
  border-radius: 999px;
  font-size: 0 !important;
  background: rgba(255,255,255,0.34);
  box-shadow: none;
}
.nav button:hover {
  color: #fff;
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.10);
}
.nav button.active {
  color: #fff;
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.14);
  box-shadow: inset 3px 0 0 #f47c20 !important;
}
.nav button.active span {
  width: 9px !important;
  min-width: 9px !important;
  max-width: 9px !important;
  height: 9px !important;
  background: #f47c20;
  box-shadow: 0 0 0 4px rgba(244,124,32,0.16);
}

button {
  min-height: 38px;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  border: 1px solid transparent;
  box-shadow: 0 8px 18px rgba(18,51,95,0.12);
}
button:not(.secondary):not(.ghost-btn):not(.icon-btn):not(.tab):not(.route-chip):not(.workflow-step) {
  background: linear-gradient(135deg, #12335f, #1f4d87);
  color: #fff;
}
button:not(.secondary):not(.ghost-btn):not(.icon-btn):not(.tab):not(.route-chip):not(.workflow-step):hover {
  background: linear-gradient(135deg, #1a4175, #25609f);
}
.secondary, .ghost-btn, .tab, .route-chip {
  background: #f3f7fc;
  color: #12335f;
  border-color: #d8e2ef;
  box-shadow: none;
}
.secondary:hover, .ghost-btn:hover, .tab:hover, .route-chip:hover {
  background: #e8f0fa;
  border-color: #c7d6e8;
  color: #0f2f58;
}
.icon-btn {
  min-width: 48px;
  height: 38px;
  border-radius: 8px;
  background: #f3f7fc;
  color: #12335f;
  border: 1px solid #d8e2ef;
  box-shadow: none;
}
.icon-btn:hover {
  background: #e8f0fa;
}
.form-actions button, .toolbar button, .demo-toolbar-actions button, .hero-actions button {
  white-space: nowrap;
}
.hero-actions button {
  min-height: 40px;
  padding: 11px 15px;
}
.hero-actions button[data-view-jump] {
  background: #fff !important;
  color: #12335f !important;
  border-color: rgba(255,255,255,0.5);
}
.hero-actions .secondary {
  background: rgba(255,255,255,0.15) !important;
  color: #fff !important;
  border-color: rgba(255,255,255,0.28) !important;
}
.workflow-step {
  border-radius: 9px;
  padding: 12px;
}
.workflow-step strong {
  font-size: 13px;
}
td .row-actions button, td button {
  min-height: 30px;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 12px;
}
body.dark .secondary,
body.dark .ghost-btn,
body.dark .tab,
body.dark .route-chip,
body.dark .icon-btn {
  background: #202d3e;
  color: #dbeaff;
  border-color: #2b3a4f;
}
body.dark .secondary:hover,
body.dark .ghost-btn:hover,
body.dark .tab:hover,
body.dark .route-chip:hover,
body.dark .icon-btn:hover {
  background: #26364b;
}
@media (max-width: 860px) {
  .nav button { grid-template-columns: 12px minmax(0, 1fr) !important; font-size: 13px; }
  .nav button span { width: 8px !important; min-width: 8px !important; max-width: 8px !important; }
}

/* Header, search, alert, mode, and sidebar final correction */
.topbar {
  min-height: 76px;
  align-items: center;
  gap: 18px;
  padding: 12px 22px;
}
.topbar > div:first-of-type {
  min-width: 220px;
}
.top-actions {
  flex: 1;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}
.search {
  position: relative;
  flex: 0 1 380px;
  min-width: 260px;
  height: 42px;
  padding: 0 12px 0 14px;
  gap: 10px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #d8e2ef;
  box-shadow: 0 8px 18px rgba(18,51,95,0.06);
}
.search span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 7px;
  background: #eef4fb;
  color: transparent !important;
  font-size: 0;
}
.search span:before {
  content: "";
  width: 11px;
  height: 11px;
  border: 2px solid #12335f;
  border-radius: 50%;
  box-sizing: border-box;
}
.search span:after {
  content: "";
  width: 7px;
  height: 2px;
  margin-left: -3px;
  margin-top: 12px;
  background: #12335f;
  transform: rotate(45deg);
  border-radius: 999px;
}
.search input {
  height: 40px;
  font-size: 14px;
  color: var(--text);
}
.search:focus-within {
  border-color: #f47c20;
  box-shadow: 0 0 0 3px rgba(244,124,32,0.12), 0 10px 24px rgba(18,51,95,0.08);
}
.header-btn,
.top-actions .icon-btn {
  min-width: auto;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  color: #12335f;
  border: 1px solid #d8e2ef;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(18,51,95,0.06);
}
.header-btn:hover,
.top-actions .icon-btn:hover {
  background: #f3f7fc;
  border-color: #c7d6e8;
  transform: translateY(-1px);
}
.header-btn .btn-symbol,
.top-actions .icon-btn .btn-symbol {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: inline-grid;
  place-items: center;
  background: #eef4fb;
  color: #12335f;
  font-size: 11px;
  line-height: 1;
}
.alert-btn {
  position: relative;
  padding-right: 14px;
}
.alert-btn .alert-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #f47c20;
  color: #fff;
  border: 2px solid #fff;
  font-size: 10px;
  font-weight: 900;
}
.mode-btn.active-mode .btn-symbol {
  background: #12335f;
  color: #fff;
}
.mobile-toggle {
  min-width: 42px;
  width: 42px;
  padding: 0;
  font-size: 0;
}
.mobile-toggle:before {
  content: "";
  width: 18px;
  height: 12px;
  border-top: 2px solid #12335f;
  border-bottom: 2px solid #12335f;
  box-shadow: 0 5px 0 #12335f;
}
.profile {
  height: 42px;
  border-radius: 10px;
  padding: 5px 10px 5px 6px;
  background: #fff;
}
.profile > span {
  width: 32px;
  height: 32px;
  font-size: 12px;
}
.profile strong { font-size: 13px; }
.profile small { font-size: 11px; }

.nav button {
  grid-template-columns: 10px minmax(0, 1fr) !important;
  min-height: 38px;
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.15;
}
.nav button span {
  width: 7px !important;
  min-width: 7px !important;
  max-width: 7px !important;
  height: 7px !important;
}
.nav button.active {
  background: rgba(255,255,255,0.15);
}
.nav button.active span {
  width: 8px !important;
  min-width: 8px !important;
  max-width: 8px !important;
  height: 8px !important;
}
body.dark .search,
body.dark .header-btn,
body.dark .top-actions .icon-btn,
body.dark .profile {
  background: #172232;
  color: #eef4ff;
  border-color: #2b3a4f;
}
body.dark .search span,
body.dark .header-btn .btn-symbol,
body.dark .top-actions .icon-btn .btn-symbol {
  background: #202d3e;
}
body.dark .search span:before { border-color: #dbeaff; }
body.dark .search span:after { background: #dbeaff; }
body.dark .mobile-toggle:before {
  border-top-color: #dbeaff;
  border-bottom-color: #dbeaff;
  box-shadow: 0 5px 0 #dbeaff;
}
@media (max-width: 1180px) {
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .top-actions { width: 100%; justify-content: flex-start; }
  .search { flex: 1 1 360px; }
}
@media (max-width: 680px) {
  .topbar { gap: 10px; }
  .topbar > div:first-of-type { min-width: 0; flex: 1; }
  .search { order: 5; flex: 1 1 100%; min-width: 100%; }
  .header-btn, .top-actions .icon-btn { flex: 1 1 auto; justify-content: center; }
  .profile { margin-left: auto; }
}

/* Stable chart sizing fix: prevents Profit & Loss chart from growing on resize/repaint */
.panel canvas,
.chart-grid canvas,
#plChart,
#warehouseChart,
#financeChart,
#paymentChart,
#invoiceChart {
  display: block;
  width: 100% !important;
  height: 260px !important;
  max-height: 260px !important;
}
#accounting .panel:has(#plChart) {
  min-height: 340px;
  overflow: hidden;
}
#accounting #plChart {
  min-height: 0 !important;
}
.chart-grid .panel {
  min-height: 332px;
  overflow: hidden;
}
@media (max-width: 860px) {
  .panel canvas,
  .chart-grid canvas,
  #plChart,
  #warehouseChart,
  #financeChart,
  #paymentChart,
  #invoiceChart {
    height: 230px !important;
    max-height: 230px !important;
  }
  #accounting .panel:has(#plChart),
  .chart-grid .panel {
    min-height: 300px;
  }
}

/* Guided walkthrough contrast fix */
.demo-strip .workflow-step {
  background: #ffffff !important;
  color: #182336 !important;
  border: 1px solid #d8e2ef !important;
  box-shadow: 0 8px 18px rgba(18,51,95,0.06) !important;
}
.demo-strip .workflow-step small {
  color: #68758a !important;
}
.demo-strip .workflow-step strong {
  color: #12335f !important;
  font-weight: 900;
}
.demo-strip .workflow-step:hover {
  background: #fff8f1 !important;
  border-color: #f47c20 !important;
}
.demo-strip .workflow-step:hover small {
  color: #9a5a1f !important;
}
.demo-strip .workflow-step:hover strong {
  color: #0f2f58 !important;
}
body.dark .demo-strip .workflow-step {
  background: #172232 !important;
  color: #eef4ff !important;
  border-color: #2b3a4f !important;
}
body.dark .demo-strip .workflow-step small {
  color: #aab7ca !important;
}
body.dark .demo-strip .workflow-step strong {
  color: #dbeaff !important;
}
body.dark .demo-strip .workflow-step:hover {
  background: #26364b !important;
  border-color: #ff9a4d !important;
}
