:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17202e;
  --muted: #6a7485;
  --line: #dce2ea;
  --soft: #eef3f7;
  --nav: #111a24;
  --nav-2: #1a2633;
  --green: #11755c;
  --blue: #2d63d8;
  --red: #b94343;
  --amber: #9a6208;
  --shadow: 0 12px 32px rgba(31, 43, 59, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

code {
  padding: 2px 5px;
  background: var(--soft);
  border-radius: 5px;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(17, 26, 36, 0.92), rgba(18, 65, 72, 0.88)),
    linear-gradient(90deg, #101823, #123f46);
}

.login-panel {
  width: min(100%, 420px);
  padding: 28px;
  background: #fff;
  border: 1px solid #dce2ea;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
}

.login-brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.login-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  padding: 6px;
  background: #111a24;
  border-radius: 8px;
}

.login-brand strong,
.login-brand small {
  display: block;
}

.login-brand strong {
  font-size: 20px;
}

.login-brand small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 750;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: #101827;
  font-size: 13px;
  font-weight: 850;
}

.login-form input {
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
}

.login-form input:focus {
  border-color: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.16);
}

.login-form button {
  min-height: 44px;
  margin-top: 4px;
  color: #fff;
  background: #11755c;
  border: 0;
  border-radius: 7px;
  font-weight: 900;
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  color: #9f2222;
  background: #fff1f1;
  border: 1px solid #ffd1d1;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 800;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  transition: grid-template-columns 0.2s ease;
}

.shell.menu-closed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  color: #e8eef6;
  background: var(--nav);
  border-right: 1px solid #263649;
  overflow: hidden;
  transition: transform 0.2s ease, opacity 0.2s ease, padding 0.2s ease, border-color 0.2s ease;
}

.shell.menu-closed .sidebar {
  padding-right: 0;
  padding-left: 0;
  border-color: transparent;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-100%);
}

.brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  padding: 4px;
  background: #0b1118;
  border: 1px solid #2b3f55;
  border-radius: 8px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: #a5b3c4;
  font-size: 12px;
}

nav {
  display: grid;
  gap: 3px;
}

nav button {
  min-height: 34px;
  color: #c5d0df;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 850;
}

nav button.active,
nav button:hover {
  color: #fff;
  background: var(--nav-2);
  border-color: #32475f;
}

.sidebar-foot {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  color: #9caabd;
  line-height: 1.5;
}

.content {
  min-width: 0;
  padding: 22px 24px 34px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-toggle {
  min-height: 32px;
  color: #344156;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.menu-toggle:hover {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.topbar h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0;
}

.topbar p {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.actions input {
  width: 270px;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
}

.actions button,
.link-btn {
  min-height: 38px;
  color: #fff;
  background: var(--green);
  border: 1px solid var(--green);
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 850;
}

.link-btn {
  min-height: 30px;
  color: var(--green);
  background: #fff;
}

.convert-btn {
  color: #fff;
  background: var(--green);
}

.order-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.order-actions .icon-btn,
.bill-action-bar .icon-btn {
  margin-left: auto;
}

.danger-btn {
  min-height: 30px;
  color: var(--red);
  background: #fff7f7;
  border: 1px solid #efc4c4;
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 850;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  padding: 6px;
}

.icon-btn svg {
  display: block;
}

.quick-views {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.quick-views button {
  min-height: 32px;
  color: #344156;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 850;
}

.quick-views button.active,
.quick-views button:hover {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.filters {
  margin-bottom: 14px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.dashboard-filter-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.filters-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.filters-head > div {
  display: grid;
  gap: 2px;
}

.filters-head strong {
  font-size: 13px;
}

.filters-head small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.filters-head button {
  min-height: 28px;
  color: var(--red);
  background: #fff7f7;
  border: 1px solid #efc4c4;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 850;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
}

.filter-grid label {
  display: grid;
  gap: 5px;
}

.filter-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.filter-grid input,
.filter-grid select {
  min-height: 34px;
  width: 100%;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 8px;
  outline: none;
}

.filter-grid input:focus,
.filter-grid select:focus,
.actions input:focus,
.customer-search input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(17, 117, 92, 0.12);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat {
  min-height: 98px;
  padding: 16px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.stat strong {
  display: block;
  margin-top: 9px;
  font-size: 27px;
  line-height: 1.05;
}

.stat.green strong {
  color: var(--green);
}

.stat.red strong {
  color: var(--red);
}

.stat.blue strong {
  color: var(--blue);
}

.year-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.year-card {
  min-height: 78px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.year-card span,
.year-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.year-card strong {
  display: block;
  margin: 6px 0 3px;
  color: var(--green);
  font-size: 19px;
  line-height: 1.1;
}

.two-col,
.split {
  display: grid;
  gap: 16px;
  align-items: start;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.split {
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
}

.orders-layout {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(320px, 3fr);
  gap: 16px;
  align-items: start;
}

.order-preview-stack {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.bill-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
}

.bill-action-bar > div {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bill-action-bar > div:last-child {
  flex: 1;
  justify-content: flex-start;
}

.bill-action-bar strong {
  font-size: 13px;
}

.bill-action-bar span {
  color: var(--muted);
  font-size: 11px;
}

.orders-layout .bill-action-bar {
  display: grid;
}

.orders-layout .bill-action-bar > div {
  justify-content: flex-start;
}

.orders-layout .bill-action-bar > div:last-child {
  justify-content: flex-start;
}

.orders-layout .bill-action-bar button {
  min-height: 30px;
  padding: 5px 7px;
  font-size: 11px;
}

.panel {
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.panel-head h2 {
  margin: 0;
  font-size: 17px;
}

.panel-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.panel-select {
  min-height: 34px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 800;
  outline: none;
}

.panel-select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(17, 117, 92, 0.12);
}

.monthly-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(74px, 1fr);
  align-items: end;
  gap: 10px;
  min-height: 280px;
  overflow-x: auto;
  padding: 18px 16px 16px;
}

.month-bar {
  display: grid;
  grid-template-rows: 34px 180px 18px;
  align-items: end;
  gap: 8px;
  min-width: 74px;
}

.month-bar strong {
  align-self: start;
  color: #0f766e;
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}

.month-bar span {
  display: block;
  width: 100%;
  min-height: 4px;
  background: linear-gradient(180deg, #14b8a6 0%, #0f766e 100%);
  border-radius: 7px 7px 3px 3px;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.18);
}

.month-bar small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-align: center;
  white-space: nowrap;
}

.product-revenue-chart {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.product-revenue-row {
  display: grid;
  grid-template-columns: 110px minmax(120px, 1fr) 120px 70px;
  align-items: center;
  gap: 12px;
}

.state-sales-table {
  display: grid;
  padding: 16px;
  overflow-x: auto;
}

.state-sales-head,
.state-sales-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) 128px 80px 80px 124px minmax(120px, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 760px;
}

.state-sales-head {
  padding: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  border-bottom: 1px solid var(--line);
}

.state-sales-row {
  width: 100%;
  padding: 12px 0;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #edf2f7;
  cursor: pointer;
}

.state-sales-row:last-child {
  border-bottom: 0;
}

.state-sales-row:hover,
.state-sales-row.active {
  background: #f8fbfd;
}

.product-revenue-row span {
  color: #101827;
  font-size: 13px;
  font-weight: 850;
}

.state-name {
  color: #101827;
  font-size: 13px;
  font-weight: 900;
}

.product-revenue-row div {
  height: 12px;
  overflow: hidden;
  background: #e8eef5;
  border-radius: 999px;
}

.product-revenue-row i {
  display: block;
  height: 100%;
  min-width: 4px;
  background: linear-gradient(90deg, #2563eb 0%, #14b8a6 100%);
  border-radius: inherit;
}

.product-revenue-row strong {
  color: #0f766e;
  font-size: 15px;
  text-align: right;
}

.state-sales-row strong {
  color: #0f766e;
  font-size: 14px;
  text-align: right;
}

.product-revenue-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-align: right;
}

.state-sales-row small {
  color: #344156;
  font-size: 12px;
  font-weight: 850;
  text-align: right;
}

.state-share {
  display: grid;
  grid-template-columns: minmax(60px, 1fr) 42px;
  align-items: center;
  gap: 8px;
}

.state-share i {
  display: block;
  height: 10px;
  min-width: 4px;
  background: linear-gradient(90deg, #f59e0b 0%, #10b981 100%);
  border-radius: 999px;
}

.state-share b {
  color: #101827;
  font-size: 12px;
  text-align: right;
}

.city-drilldown {
  margin: 0 16px 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.city-drilldown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.city-drilldown-head h3 {
  margin: 0;
  color: #101827;
  font-size: 14px;
}

.city-drilldown-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.city-sales-list {
  display: grid;
  gap: 8px;
}

.city-sales-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 120px 82px 80px minmax(80px, 0.8fr);
  align-items: center;
  gap: 10px;
}

.city-sales-row span {
  color: #101827;
  font-size: 12px;
  font-weight: 900;
}

.city-sales-row strong {
  color: #0f766e;
  font-size: 13px;
  text-align: right;
}

.city-sales-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-align: right;
}

.city-sales-row i {
  display: block;
  height: 9px;
  min-width: 4px;
  background: linear-gradient(90deg, #2563eb 0%, #14b8a6 100%);
  border-radius: 999px;
}

.list-row,
.tr {
  width: 100%;
  color: inherit;
  text-align: left;
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
}

.list-row:hover,
.tr:hover,
.tr.active {
  background: #f7fafc;
}

.list-row strong,
.list-row small,
.tr b,
.tr small {
  display: block;
}

.list-row small,
.tr small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.table {
  max-height: calc(100vh - 168px);
  overflow: auto;
}

.customer-search {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.customer-search input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
}

.customer-search small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.thead,
.tr {
  display: grid;
  gap: 12px;
  align-items: center;
  min-width: 760px;
}

.thead {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 11px 14px;
  color: var(--muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 900;
}

.tr {
  padding: 12px 14px;
}

.orders-grid {
  grid-template-columns: 1fr 1.25fr 0.8fr 0.62fr 0.68fr;
}

.customers-grid {
  grid-template-columns: 1.45fr 0.85fr 0.85fr 0.75fr;
}

.leads-grid {
  grid-template-columns: 1.15fr 0.75fr 0.9fr 0.9fr 0.8fr;
}

.lead-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.lead-stats .stat {
  min-height: 76px;
  padding: 11px 12px;
}

.lead-stats .stat strong {
  margin-top: 6px;
  font-size: 22px;
}

.lead-layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.75fr) minmax(0, 1.25fr);
  gap: 14px;
  align-items: start;
}

.lead-form {
  grid-row: span 2;
}

.lead-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 16px;
}

.lead-form-grid label {
  display: grid;
  gap: 6px;
}

.lead-form-grid .wide {
  grid-column: 1 / -1;
}

.lead-form-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.lead-form-grid input,
.lead-form-grid select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
}

.lead-detail {
  padding: 16px;
}

.lead-note {
  margin: 12px 0;
  padding: 11px 12px;
  color: var(--ink);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 750;
}

.lead-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inventory-grid {
  grid-template-columns: 1.3fr 0.7fr 0.65fr 0.9fr;
}

.expenses-grid,
.purchases-grid {
  grid-template-columns: 0.75fr 1fr 1.3fr 0.65fr;
}

.accounts-grid {
  grid-template-columns: 1fr 1fr 1fr 0.75fr;
}

.incentive-grid {
  grid-template-columns: 0.9fr 1.25fr 0.55fr 0.65fr 0.75fr;
}

.incentive-panel .panel-head {
  align-items: flex-start;
}

.month-filter {
  display: grid;
  gap: 5px;
  min-width: 165px;
}

.month-filter span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.month-filter input {
  min-height: 36px;
  padding: 7px 9px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-weight: 800;
}

.incentive-summary {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.incentive-summary .stat {
  min-height: 74px;
  padding: 10px 11px;
}

.incentive-summary .stat span {
  font-size: 10px;
  line-height: 1.15;
}

.incentive-summary .stat strong {
  margin-top: 6px;
  font-size: 21px;
}

.incentive-breakdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.incentive-breakdown div {
  display: grid;
  gap: 3px;
  padding: 13px 16px;
  background: #fff;
}

.incentive-breakdown span,
.incentive-breakdown small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.incentive-breakdown strong {
  color: var(--green);
  font-size: 18px;
}

.tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.tag.success {
  color: #09634f;
  background: #dff7ef;
}

.tag.warn {
  color: var(--amber);
  background: #fff4d6;
}

.tag.neutral {
  color: #506078;
  background: #edf2f7;
}

.detail {
  padding: 16px;
}

.detail-top h2 {
  margin: 9px 0 4px;
  font-size: 24px;
}

.detail-top p {
  margin: 0;
  color: var(--muted);
}

.facts {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.facts div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.facts dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.detail h3 {
  margin: 18px 0 8px;
  font-size: 15px;
}

.customer-history-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  margin: 16px 0 4px;
}

.customer-history-summary div {
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
}

.customer-history-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.customer-history-summary strong {
  display: block;
  margin-top: 5px;
  color: #101827;
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.customer-info-card {
  margin-top: 18px;
  padding-top: 2px;
}

.customer-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
}

.customer-info-grid div,
.customer-address {
  padding: 10px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.customer-info-grid span,
.customer-address span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.customer-info-grid strong {
  display: block;
  margin-top: 5px;
  color: #101827;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.customer-address {
  margin-top: 2px;
}

.customer-address p {
  margin: 6px 0 0;
  color: #101827;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.mini-table {
  display: grid;
  gap: 7px;
}

.mini-table div,
.mini-table button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px;
  color: inherit;
  text-align: left;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.mini-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.customer-order-history {
  display: grid;
  gap: 8px;
}

.customer-order-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px 94px auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.customer-order-row strong,
.customer-order-row span {
  display: block;
}

.customer-order-row strong {
  color: #101827;
  font-size: 13px;
}

.customer-order-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.customer-order-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-align: right;
}

.customer-order-row b {
  color: #0f766e;
  font-size: 13px;
  text-align: right;
}

.customer-order-actions {
  display: flex;
  gap: 6px;
}

.customer-order-actions button {
  min-height: 28px;
  color: var(--green);
  background: #fff;
  border: 1px solid var(--green);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 850;
}

.sku-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.sku-card {
  display: flex;
  flex: 0 0 150px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 78px;
  padding: 14px;
  color: #101827;
  background: linear-gradient(135deg, #ffffff 0%, #f5f8fb 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
  scroll-snap-align: start;
}

.sku-card:hover {
  border-color: #c4d4e6;
  transform: translateY(-1px);
}

.sku-card span {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0;
}

.sku-card strong {
  flex-shrink: 0;
  color: #0f766e;
  font-size: 26px;
  line-height: 1;
}

details {
  margin-top: 16px;
}

summary {
  color: var(--blue);
  font-weight: 850;
  cursor: pointer;
}

pre {
  max-height: 340px;
  overflow: auto;
  padding: 12px;
  color: #e9eef5;
  background: #101823;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.45;
}

.chart {
  display: flex;
  align-items: end;
  gap: 3px;
  height: 260px;
  padding: 18px;
}

.chart span {
  flex: 1;
  min-width: 4px;
  background: var(--green);
  border-radius: 4px 4px 0 0;
}

.loading,
.error,
.empty {
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
}

.error {
  color: var(--red);
  background: #fff7f7;
  border: 1px solid #f0c4c4;
  border-radius: 8px;
}

.order-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 16px;
  align-items: start;
}

.order-form {
  overflow: visible;
}

.form-section {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.form-section:last-child {
  border-bottom: 0;
}

.form-section h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.form-grid.compact-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-grid label,
.items-entry label {
  display: grid;
  gap: 5px;
}

.form-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.form-grid input,
.form-grid select,
.item-entry input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
}

.form-grid input:focus,
.form-grid select:focus,
.item-entry input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(17, 117, 92, 0.12);
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.items-entry {
  display: grid;
  gap: 8px;
}

.items-head,
.item-entry {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 120px 82px 120px;
  gap: 8px;
  align-items: center;
}

.items-head {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.add-item-btn {
  min-height: 36px;
  color: var(--green);
  background: #fff;
  border: 1px solid var(--green);
  border-radius: 7px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 850;
}

.complementary-btn {
  color: var(--blue);
  border-color: var(--blue);
}

.complementary-row {
  padding: 8px;
  background: #f7fafc;
  border: 1px dashed var(--blue);
  border-radius: 7px;
}

.complementary-label {
  display: flex;
  align-items: center;
  min-height: 38px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.final-section {
  display: grid;
  gap: 14px;
}

.final-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.final-summary div {
  padding: 14px;
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.final-summary span,
.final-summary strong {
  display: block;
}

.final-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.final-summary strong {
  margin-top: 6px;
  font-size: 22px;
}

.save-order-btn {
  min-height: 44px;
  color: #fff;
  background: var(--green);
  border: 1px solid var(--green);
  border-radius: 7px;
  padding: 10px 14px;
  font-weight: 900;
}

.add-order-preview {
  position: sticky;
  top: 18px;
}

.draft-bill {
  padding: 14px;
}

.preview-bill-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.preview-bill-card header,
.preview-bill-card footer div,
.preview-items div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.preview-bill-card header {
  padding-bottom: 12px;
  border-bottom: 2px solid #17202e;
}

.preview-bill-card header strong,
.preview-bill-card header span,
.preview-bill-card section small,
.preview-items small {
  display: block;
}

.preview-bill-card header strong {
  font-size: 20px;
  font-weight: 950;
}

.preview-bill-card header span,
.preview-bill-card section small,
.preview-items small {
  color: var(--muted);
  font-size: 12px;
}

.preview-bill-card h3 {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.preview-bill-card p {
  margin: 0 0 4px;
  font-weight: 850;
}

.preview-items {
  display: grid;
  gap: 8px;
}

.preview-items div {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.preview-empty {
  color: var(--muted);
  font-size: 13px;
}

.preview-bill-card footer {
  display: grid;
  gap: 7px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.preview-bill-card footer div {
  padding: 4px 0;
}

.preview-grand {
  color: var(--green);
  font-size: 18px;
  font-weight: 950;
}

.bill-layout {
  display: grid;
  grid-template-columns: minmax(330px, 0.45fr) minmax(0, 0.9fr);
  gap: 16px;
  align-items: start;
}

.bill-picker {
  position: sticky;
  top: 18px;
}

.bill-tools {
  padding: 12px 16px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.45;
}

.bill-tools p {
  margin: 0;
}

.bill-order-list {
  max-height: calc(100vh - 260px);
}

.bill-order-row {
  grid-template-columns: 1fr 1.1fr 0.72fr;
  min-width: 620px;
}

.invoice-wrap {
  padding: 18px;
  background: #eef2f6;
}

.invoice {
  max-width: 920px;
  margin: 0 auto;
  padding: 0;
  color: #151c28;
  background: #fff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.orders-layout .invoice-wrap {
  overflow: hidden;
  min-height: min(720px, calc(100vh - 190px));
  padding: 8px;
}

.orders-layout .invoice {
  width: 920px;
  max-width: none;
  transform: scale(0.38);
  transform-origin: top left;
}

.bill-preview-click {
  cursor: zoom-in;
}

.bill-preview-click .invoice-wrap {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bill-preview-click:hover .invoice-wrap {
  border-color: #9fb5ce;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
}

.bill-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}

.bill-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 14, 23, 0.68);
  border: 0;
}

.bill-modal-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 1040px);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
}

.bill-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.bill-modal-head strong,
.bill-modal-head span {
  display: block;
}

.bill-modal-head span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.bill-modal-head button {
  min-height: 34px;
  padding: 7px 11px;
  color: #fff;
  background: #111a24;
  border: 0;
  border-radius: 7px;
  font-weight: 850;
}

.bill-modal-body {
  max-height: calc(100vh - 108px);
  overflow: auto;
  background: #eef2f6;
}

.bill-modal-body .invoice-wrap {
  padding: 18px;
  background: #eef2f6;
  border: 0;
  box-shadow: none;
}

.invoice-head,
.invoice-bottom,
.invoice-foot {
  display: grid;
  gap: 18px;
}

.invoice-head {
  grid-template-columns: 1fr;
  gap: 22px;
  padding: 28px 32px;
  color: #151c28;
  background: #fff;
  border-bottom: 2px solid #151c28;
}

.invoice-party-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 18px;
  align-items: stretch;
}

.invoice-party {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.invoice-party-to {
  text-align: right;
}

.invoice-party-label {
  margin-bottom: 10px;
  color: #147a5c;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 1.1px;
  text-transform: uppercase;
}

.invoice-party-head {
  display: block;
}

.invoice-brand {
  font-size: 20px;
  font-weight: 950;
  letter-spacing: 0;
  white-space: nowrap;
}

.invoice-party strong {
  display: block;
  margin-bottom: 8px;
  font-size: 22px;
}

.invoice-head p,
.invoice-note p {
  margin: 4px 0 0;
  color: #566275;
  line-height: 1.45;
}

.invoice-head p {
  color: #566275;
}

.sender-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.sender-lines span {
  padding: 0;
  color: #566275;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 11px;
}

.sender-lines b {
  margin-right: 4px;
  color: #151c28;
}

.invoice-title {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 16px;
  text-align: left;
}

.invoice-type-block {
  align-self: start;
  justify-self: center;
  color: #101827;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.invoice-number-block {
  text-align: right;
}

.invoice-title h2 {
  margin: 2px 0 8px;
  font-size: 34px;
  line-height: 1;
}

.invoice-title strong,
.invoice-title > span {
  color: #147a5c;
  font-weight: 900;
}

.invoice-kicker {
  color: #607086 !important;
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.invoice-note h3 {
  margin: 0 0 8px;
  color: #607086;
  font-size: 12px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.invoice-section-title {
  margin: 24px 32px 0;
  padding-bottom: 10px;
  color: #151c28;
  border-bottom: 1px solid #dde5ef;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 950;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.invoice-table {
  width: calc(100% - 64px);
  border-collapse: collapse;
  margin: 24px 32px 26px;
  font-size: 13px;
  overflow: hidden;
  border-radius: 0;
}

.invoice-table th,
.invoice-table td {
  padding: 12px 11px;
  border: 0;
  border-bottom: 1px solid #e4eaf1;
  text-align: left;
  vertical-align: top;
}

.invoice-table th {
  color: #fff;
  background: #151c28;
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.invoice-table tbody tr:nth-child(even) {
  background: transparent;
}

.invoice-table tbody tr:last-child td {
  border-bottom: 0;
}

.invoice-table th:nth-child(4),
.invoice-table th:nth-child(5),
.invoice-table th:nth-child(6),
.invoice-table td:nth-child(4),
.invoice-table td:nth-child(5),
.invoice-table td:nth-child(6) {
  text-align: right;
}

.invoice-bottom {
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
  padding: 0 32px 30px;
}

.invoice-note {
  min-height: 132px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.invoice-totals {
  display: grid;
  background: #fff;
  border: 0;
  border-top: 2px solid #151c28;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
}

.invoice-totals div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 12px;
  border-bottom: 1px solid #e4eaf1;
  font-size: 12px;
}

.invoice-totals div:last-child {
  border-bottom: 0;
}

.invoice-totals .grand {
  color: #151c28;
  background: transparent;
  border-top: 2px solid #151c28;
  font-size: 14px;
  font-weight: 950;
}

.invoice-foot {
  grid-template-columns: 1fr;
  padding: 16px 32px;
  color: #607086;
  background: #fff;
  border-top: 1px solid #dde5ef;
  font-size: 12px;
  text-align: center;
}

@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-grid {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }

  .incentive-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lead-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .two-col,
  .split,
  .orders-layout,
  .lead-layout,
  .order-form-layout,
  .bill-layout {
    grid-template-columns: 1fr;
  }

  .bill-picker,
  .add-order-preview {
    position: static;
  }

  .table {
    max-height: none;
  }
}

@media (max-width: 820px) {
  .shell,
  .shell.menu-closed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .sidebar-foot {
    position: static;
    margin-top: 14px;
  }

  .shell.menu-closed .sidebar {
    display: none;
  }

  .content {
    padding: 16px;
  }

  .topbar,
  .actions {
    display: grid;
  }

  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .incentive-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lead-stats,
  .lead-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid.compact-grid,
  .final-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .items-head,
  .item-entry {
    grid-template-columns: minmax(180px, 1fr) 100px 72px 100px;
  }

  .actions input {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .stats {
    grid-template-columns: 1fr;
  }

  .stat strong {
    font-size: 24px;
  }

  .facts div {
    grid-template-columns: 1fr;
  }

  .filter-grid {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .form-grid.compact-grid,
  .lead-stats,
  .lead-form-grid,
  .items-head,
  .item-entry,
  .final-summary,
  .customer-info-grid {
    grid-template-columns: 1fr;
  }

  .customer-history-summary,
  .customer-order-row {
    grid-template-columns: 1fr;
  }

  .customer-order-row small,
  .customer-order-row b {
    text-align: left;
  }

  .product-revenue-row {
    grid-template-columns: 1fr auto;
  }

  .product-revenue-row div {
    grid-column: 1 / -1;
    order: 3;
  }

  .product-revenue-row small {
    grid-column: 1 / -1;
    text-align: left;
  }

  .city-sales-row {
    grid-template-columns: 1fr auto;
  }

  .city-sales-row small,
  .city-sales-row i {
    grid-column: 1 / -1;
    text-align: left;
  }

  .items-head {
    display: none;
  }

  .invoice {
    padding: 20px;
  }

  .invoice-head,
  .invoice-party-row,
  .invoice-bottom,
  .invoice-foot {
    grid-template-columns: 1fr;
  }

  .invoice-head {
    padding: 22px;
  }

  .invoice-bottom {
    padding-left: 18px;
    padding-right: 18px;
  }

  .invoice-title {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .invoice-number-block {
    text-align: left;
  }

  .invoice-party-to {
    text-align: left;
  }

  .invoice-section-title {
    margin-left: 18px;
    margin-right: 18px;
  }

  .invoice-table {
    width: calc(100% - 36px);
    margin: 24px 18px 26px;
  }

  .bill-modal {
    padding: 10px;
  }

  .bill-modal-panel {
    max-height: calc(100vh - 20px);
  }
}

@media print {
  @page {
    size: A4;
    margin: 8mm;
  }

  html,
  body {
    width: 210mm;
    min-height: 297mm;
    background: #fff;
  }

  .sidebar,
  .topbar,
  .quick-views,
  .filters,
  .bill-picker,
  .orders-layout > .panel,
  .bill-action-bar {
    display: none !important;
  }

  .shell,
  .content,
  .bill-layout,
  .orders-layout,
  .order-preview-stack,
  .invoice-wrap {
    display: block;
    min-height: 0;
    padding: 0;
    margin: 0;
    background: #fff;
    box-shadow: none;
    border: 0;
  }

  .invoice {
    width: 100% !important;
    max-width: none !important;
    min-height: calc(297mm - 16mm);
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    transform: none !important;
    transform-origin: initial !important;
  }

  .orders-layout .invoice {
    width: 100% !important;
    max-width: none !important;
    transform: none !important;
  }

  .invoice-head {
    padding-top: 18px;
  }

  .invoice-foot {
    margin-top: auto;
  }

  .invoice-table th {
    color: #fff !important;
    background: #151c28 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
