:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1d2430;
  --muted: #687385;
  --line: #d8dde6;
  --brand: #116149;
  --brand-dark: #0b4433;
  --danger: #b42318;
  --warning: #8a5b00;
  --ok: #137333;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.top-actions form {
  margin: 0;
}

.topbar nav,
.actions,
.inline-search,
.tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar form {
  margin: 0;
}

.smart-nav {
  flex: 1;
  justify-content: flex-end;
}

.top-search {
  width: min(340px, 28vw);
}

.top-search input {
  min-height: 34px;
  border-color: #cfd6df;
  background: #f9fafb;
}

.nav-link,
.nav-group summary {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.nav-link:hover,
.nav-group summary:hover {
  background: #eef2f5;
  text-decoration: none;
}

.nav-group {
  position: relative;
}

.nav-group summary {
  list-style: none;
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-group[open] summary {
  background: #eef2f5;
}

.nav-menu {
  min-width: 220px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  display: grid;
  gap: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(29, 36, 48, 0.14);
  padding: 8px;
  z-index: 20;
}

.plus-button {
  min-width: 40px;
  justify-content: center;
  background: #3b82f6;
  border-radius: 6px;
  color: #fff;
  font-size: 24px;
  line-height: 1;
}

.create-menu[open] .plus-button {
  background: #2563eb;
}

.mega-create {
  right: 0;
  width: min(780px, calc(100vw - 360px));
  grid-template-columns: 1fr 1fr;
}

.side-action {
  display: grid;
  grid-template-columns: 1fr 28px;
  align-items: center;
}

.side-action > a:last-child {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 5px;
  color: var(--muted);
  font-size: 18px;
}

.side-action > a:last-child:hover {
  background: #e8f2ef;
  color: var(--brand);
  text-decoration: none;
}

.nav-menu a {
  min-height: 32px;
  display: flex;
  align-items: center;
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--ink);
}

.nav-menu a:hover {
  background: #f3f6f8;
  text-decoration: none;
}

.nav-menu form {
  margin: 0;
}

.nav-menu button {
  width: 100%;
  justify-content: flex-start;
}

.action-tag {
  border-radius: 999px;
  font-weight: 700;
}

.icon-button {
  min-width: 34px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.icon-button svg,
.icon-button [data-lucide],
.user-summary svg,
.user-summary [data-lucide] {
  width: 18px;
  height: 18px;
}

.settings-flyout summary.icon-button {
  padding: 0;
}

.user-summary {
  gap: 8px;
  max-width: 240px;
}

.user-summary span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-button:hover {
  background: #eef2f5;
  text-decoration: none;
}

.nav-group.wide .nav-menu {
  width: min(720px, calc(100vw - 40px));
}

.nav-group.wide .nav-menu.mega-create,
.settings-menu.mega-create {
  width: min(780px, calc(100vw - 360px));
  grid-template-columns: 1fr 1fr 1fr;
}

.settings-menu {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}

.settings-menu section {
  display: grid;
  gap: 4px;
}

.settings-menu strong {
  padding: 7px 9px 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.app-layout {
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr);
  min-height: calc(100vh - 58px);
}

.sidebar {
  position: sticky;
  top: 58px;
  align-self: start;
  height: calc(100vh - 58px);
  overflow: auto;
  background: #1b2238;
  border-right: 1px solid #111827;
  padding: 0 12px 18px;
  color: #fff;
}

.side-brand {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  padding: 14px 6px;
}

.side-brand:hover {
  text-decoration: none;
}

.side-brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

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

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav a,
.side-nav summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  border-radius: 6px;
  padding: 7px 9px;
  color: #eef2ff;
  cursor: pointer;
  list-style: none;
}

.side-nav summary {
  color: #9ca3af;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.side-nav summary::-webkit-details-marker {
  display: none;
}

.side-nav a:hover,
.side-nav summary:hover {
  background: #2d3654;
  text-decoration: none;
}

.side-nav details {
  border-bottom: 1px solid #2c344f;
  padding-bottom: 8px;
}

.side-nav a.active {
  background: #3b82f6;
  color: #fff;
  font-weight: 700;
}

.side-nav details div {
  display: grid;
  gap: 2px;
}

.side-label {
  display: block;
  padding: 16px 7px 5px;
  color: #9ca3af;
  font-size: 12px;
  text-transform: uppercase;
}

.shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px;
}

.app-layout > .shell {
  width: 100%;
  max-width: none;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.smart-head {
  align-items: flex-end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

h1,
h2 {
  margin: 0 0 10px;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

h3 {
  margin: 0 0 10px;
  font-size: 15px;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.panel,
.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.login-panel {
  max-width: 420px;
  margin: 80px auto;
}

.grid {
  display: grid;
  gap: 18px;
}

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

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

.grid.compact {
  gap: 10px;
}

.settings-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.settings-map > div {
  display: grid;
  align-content: start;
  gap: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.settings-map h2 {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.settings-map a {
  min-height: 30px;
  display: flex;
  align-items: center;
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--ink);
}

.settings-map a:hover {
  background: #f3f6f8;
  text-decoration: none;
}

.settings-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.settings-feature-grid a {
  display: grid;
  gap: 7px;
  min-height: 116px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--ink);
}

.settings-feature-grid a:hover {
  border-color: #9bb7ef;
  box-shadow: 0 10px 24px rgba(29, 36, 48, 0.08);
  text-decoration: none;
}

.settings-feature-grid span {
  color: var(--muted);
  font-size: 13px;
}

.logo-preview {
  width: 140px;
  height: 90px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.logo-preview img {
  max-width: 120px;
  max-height: 70px;
  object-fit: contain;
}

.logo-preview span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}

.settings-toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.toggle-row {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fbfcfd;
}

.span-two {
  grid-column: 1 / -1;
}

.stack {
  display: grid;
  gap: 12px;
}

.wide-form {
  margin-bottom: 24px;
}

.record-page {
  display: grid;
  gap: 14px;
}

.record-toolbar {
  position: sticky;
  top: 58px;
  z-index: 4;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  background: rgba(246, 247, 249, 0.96);
  border-bottom: 1px solid var(--line);
  padding: 10px 0 12px;
}

.record-toolbar h1,
.record-toolbar h2 {
  margin-bottom: 0;
}

.compact-toolbar {
  position: static;
  margin: -4px 0 4px;
  padding: 0 0 14px;
  background: #fff;
}

.customer-head {
  margin-bottom: 10px;
}

.record-tabs {
  display: flex;
  align-items: center;
  gap: 30px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: #fff;
  margin: 0 -28px 22px;
  padding: 0 28px;
}

.record-tabs a {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  border-bottom: 3px solid transparent;
  color: #334155;
  font-weight: 500;
  white-space: nowrap;
}

.record-tabs a:hover {
  color: var(--ink);
  text-decoration: none;
}

.record-tabs a.active {
  border-bottom-color: #3b82f6;
  color: var(--ink);
  font-weight: 800;
}

.record-card {
  align-self: start;
}

.form-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.form-tags a,
.tag {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.form-tags a:hover {
  background: #eef2f5;
  color: var(--ink);
  text-decoration: none;
}

.section-title,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sub-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.switch-stack {
  display: grid;
  align-content: end;
  gap: 8px;
  min-height: 64px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.segmented label {
  display: inline-flex;
  color: var(--ink);
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-left-width: 0;
  background: #fff;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
}

.segmented label:first-child span {
  border-left-width: 1px;
  border-radius: 6px 0 0 6px;
}

.segmented label:last-child span {
  border-radius: 0 6px 6px 0;
}

.segmented input:checked + span {
  border-color: var(--brand);
  background: #eaf6f0;
  color: var(--brand-dark);
}

.required-field > input,
.required-field > select,
.required-field > textarea {
  border-left: 3px solid var(--brand);
}

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

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

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

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

.inline-check {
  align-content: end;
  min-height: 64px;
}

input,
select,
textarea,
button,
.button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 86px;
  resize: vertical;
}

textarea.tall {
  min-height: 170px;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}

.primary,
button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.primary:hover {
  background: var(--brand-dark);
}

.secondary {
  background: #f3f6f8;
  color: var(--ink);
}

.ghost-primary {
  background: #eaf6f0;
  border-color: #a8d8c2;
  color: var(--brand-dark);
}

.ghost-primary:hover {
  background: #d9efe5;
}

.small {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 13px;
}

.link-button {
  border: 0;
  padding: 0;
  min-height: 0;
  color: var(--brand);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.metrics div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.metrics strong {
  display: block;
  font-size: 22px;
  margin-bottom: 4px;
}

.metrics span {
  color: var(--muted);
  font-size: 13px;
}

.smart-dashboard {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.dashboard-hero {
  min-height: 146px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255,255,255,0.94), rgba(255,255,255,0.86)),
    repeating-linear-gradient(45deg, #f2f5fb 0 14px, #ffffff 14px 28px);
  margin: -28px -28px 0;
  padding: 28px;
}

.dashboard-hero h1 {
  margin-bottom: 4px;
}

.dashboard-hero p {
  margin: 0;
  color: var(--muted);
}

.hero-logo {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.hero-logo img {
  max-width: 50px;
  max-height: 50px;
  object-fit: contain;
}

.hero-logo span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.dashboard-tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  margin: 0 -28px 22px;
  padding: 0 28px;
  background: #fff;
}

.dashboard-tabs a {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  border-bottom: 3px solid transparent;
  color: var(--ink);
  font-size: 16px;
}

.dashboard-tabs a.active {
  border-bottom-color: #3b82f6;
  color: #1d4ed8;
  font-weight: 700;
}

.dashboard-tabs a:hover {
  text-decoration: none;
}

.billing-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 22px;
  padding: 22px 24px;
}

.receivables-card {
  max-width: 1250px;
}

.aging-bar {
  height: 14px;
  display: flex;
  overflow: hidden;
  border-radius: 3px;
  background: #eef2f7;
  margin: 12px 0 14px;
}

.aging-bar span:nth-child(1) { background: #3b82f6; }
.aging-bar span:nth-child(2) { background: #f59e0b; }
.aging-bar span:nth-child(3) { background: #f97316; }
.aging-bar span:nth-child(4) { background: #ef4444; }
.aging-bar span:nth-child(5) { background: #991b1b; }

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

.aging-grid div {
  border-right: 1px solid var(--line);
  padding: 8px 10px 8px 0;
}

.aging-grid div:last-child {
  border-right: 0;
}

.aging-grid span {
  display: block;
  color: #5267ff;
  font-size: 12px;
  text-transform: uppercase;
}

.aging-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.sales-chart-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 22px;
}

.bar-chart {
  min-height: 230px;
  display: grid;
  grid-template-columns: repeat(6, minmax(54px, 1fr));
  align-items: end;
  gap: 18px;
  border-right: 1px solid var(--line);
  padding: 18px 22px 8px 0;
  background: linear-gradient(to bottom, transparent 0 24%, #e3e8f0 24% 24.5%, transparent 24.5% 49%, #e3e8f0 49% 49.5%, transparent 49.5% 74%, #e3e8f0 74% 74.5%, transparent 74.5%);
}

.bar-month {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.bars {
  height: 170px;
  display: flex;
  align-items: end;
  gap: 6px;
}

.bars span {
  width: 11px;
  border-radius: 3px 3px 0 0;
}

.bar-sales { background: #2f80ed; }
.bar-receipts { background: #22c55e; }
.bar-expenses { background: #ef4444; }

.chart-summary {
  display: grid;
  align-content: start;
  gap: 26px;
  padding-top: 34px;
}

.chart-summary span {
  display: block;
  color: #3478ff;
  font-size: 14px;
}

.chart-summary div:nth-child(2) span { color: #16a34a; }
.chart-summary div:nth-child(3) span { color: #ef4444; }

.chart-summary strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.score-card {
  display: grid;
  gap: 8px;
  min-height: 132px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.score-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.score-card strong {
  font-size: 26px;
}

.score-card a {
  align-self: end;
  font-size: 13px;
  font-weight: 700;
}

.primary-score {
  background: #0f513f;
  border-color: #0f513f;
  color: #fff;
}

.primary-score span,
.primary-score a {
  color: #dcefe8;
}

.dashboard-grid {
  margin-bottom: 18px;
}

.smart-panel {
  padding: 16px;
}

.panel-head {
  margin-bottom: 12px;
}

.panel-head h2 {
  margin-bottom: 0;
}

.queue-list,
.metric-strip {
  display: grid;
  gap: 8px;
}

.queue-item {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfd;
  color: var(--ink);
}

.queue-item:hover {
  background: #eef2f5;
  text-decoration: none;
}

.queue-item strong {
  font-size: 18px;
}

.queue-item.danger strong {
  color: var(--danger);
}

.queue-item.warning strong {
  color: var(--warning);
}

.queue-item.ok strong {
  color: var(--ok);
}

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

.metric-strip div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.metric-strip strong {
  display: block;
  font-size: 20px;
}

.metric-strip span {
  color: var(--muted);
  font-size: 12px;
}

.report-head {
  align-items: flex-end;
}

.report-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.report-search input {
  width: min(360px, 48vw);
}

.report-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  padding-bottom: 12px;
}

.report-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.report-tabs a {
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 10px;
}

.report-tabs a.active {
  background: var(--brand);
  color: #fff;
}

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

.report-actions i,
.report-exports i,
.report-search i,
.report-link i,
.report-group-title i {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.report-metrics div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.report-metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.report-metrics strong {
  display: block;
  font-size: 24px;
  margin-top: 4px;
}

.report-exports {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 18px;
  padding: 10px;
}

.report-exports a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 9px;
}

.report-exports a:hover {
  background: #eef2f5;
  text-decoration: none;
}

.report-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.report-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.report-group header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.report-group-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.report-group-title > span {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: #eef2f5;
  color: var(--brand);
}

.report-group h2 {
  margin-bottom: 3px;
}

.report-group p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.report-group.blue .report-group-title > span { background: #eaf2ff; color: #2563eb; }
.report-group.amber .report-group-title > span { background: #fff7e6; color: #b45309; }
.report-group.green .report-group-title > span { background: #eaf8ef; color: #15803d; }
.report-group.rose .report-group-title > span { background: #fff1f2; color: #be123c; }
.report-group.violet .report-group-title > span { background: #f3e8ff; color: #7e22ce; }
.report-group.slate .report-group-title > span { background: #f1f5f9; color: #475569; }
.report-group.cyan .report-group-title > span { background: #ecfeff; color: #0e7490; }

.report-list {
  display: grid;
}

.report-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  padding: 11px 14px;
}

.report-link:last-child {
  border-bottom: 0;
}

.report-link:hover {
  background: #f8fafc;
  text-decoration: none;
}

.report-link strong,
.report-link small {
  display: block;
}

.report-link small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.export-menu {
  position: relative;
}

.export-menu summary {
  list-style: none;
  cursor: pointer;
}

.export-menu summary::-webkit-details-marker {
  display: none;
}

.export-menu div {
  position: absolute;
  z-index: 5;
  right: 0;
  top: calc(100% + 6px);
  display: grid;
  min-width: 170px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .13);
  padding: 6px;
}

.export-menu a,
.export-menu button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  text-align: left;
}

.export-menu a:hover,
.export-menu button:hover {
  background: #eef2f5;
  text-decoration: none;
}

.report-filter-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 16px;
  padding: 14px;
}

.report-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto;
  align-items: end;
  gap: 10px;
  margin: 0;
}

.report-filter-grid label {
  margin: 0;
}

.report-filter-grid button {
  min-height: 39px;
}

.advanced-filters {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 12px;
}

.advanced-filters summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--brand);
  font-weight: 800;
}

.advanced-filters summary::-webkit-details-marker {
  display: none;
}

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

.advanced-filter-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.advanced-filter-grid p {
  margin: 5px 0 0;
}

.report-result-head {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.report-result-head div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.report-result-head strong,
.report-result-head span {
  display: block;
}

.report-result-head strong {
  font-size: 20px;
  text-transform: capitalize;
}

.report-result-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-top: 2px;
  text-transform: uppercase;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 22px;
}

.dense-table {
  margin-bottom: 0;
}

.dense-table th,
.dense-table td {
  padding: 9px 10px;
}

.compact-table {
  margin-top: 16px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  background: #fafbfc;
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.badge.paid {
  color: var(--ok);
  border-color: #b8dfc2;
  background: #effaf2;
}

.badge.sent {
  color: var(--warning);
  border-color: #ecd7a5;
  background: #fff8e8;
}

.badge.partially_paid,
.badge.pending_approval,
.badge.approved {
  color: var(--warning);
  border-color: #ecd7a5;
  background: #fff8e8;
}

.badge.received,
.badge.recorded,
.badge.applied,
.badge.active {
  color: var(--ok);
  border-color: #b8dfc2;
  background: #effaf2;
}

.badge.draft,
.badge.queued,
.badge.open {
  color: #475569;
  border-color: #cbd5e1;
  background: #f8fafc;
}

.badge.failed,
.badge.error,
.badge.overdue,
.badge.void {
  color: var(--danger);
  border-color: #f2beb9;
  background: #fff0ef;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.inline-form select,
.inline-form input {
  min-width: 140px;
}

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

.notice.success {
  color: var(--ok);
  border-color: #b8dfc2;
  background: #effaf2;
}

.notice.error {
  color: var(--danger);
  border-color: #f2beb9;
  background: #fff0ef;
}

.tabs a {
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--muted);
}

.tabs a.active {
  color: #fff;
  background: var(--brand);
}

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

.details div {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 7px 0;
}

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

.details dt {
  color: var(--muted);
  font-size: 13px;
}

.details dd {
  margin: 0;
}

.note-block {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.note-block p {
  margin: 0;
}

.timeline-list {
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.timeline-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.timeline-item div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.timeline-item p,
.empty-state {
  margin: 0;
  color: var(--ink);
  white-space: pre-wrap;
}

.empty-state {
  color: var(--muted);
}

@media (max-width: 800px) {
  .topbar,
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .smart-nav,
  .top-search {
    width: 100%;
  }

  .record-toolbar {
    position: static;
    grid-template-columns: 1fr;
  }

  .record-toolbar .actions,
  .form-actions,
  .panel-head,
  .report-toolbar,
  .report-group header,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid.two,
  .grid.three,
  .settings-map,
  .settings-feature-grid,
  .settings-toggle-grid,
  .aging-grid,
  .sales-chart-wrap,
  .metrics,
  .smart-dashboard,
  .metric-strip,
  .report-metrics,
  .report-groups,
  .report-filter-grid,
  .advanced-filter-grid,
  .report-result-head {
    grid-template-columns: 1fr;
  }

  .report-search,
  .report-search input,
  .report-actions,
  .report-exports {
    width: 100%;
  }

  .report-search {
    align-items: stretch;
    flex-direction: column;
  }

  .report-tabs {
    overflow-x: auto;
    width: 100%;
  }

  .export-menu div {
    left: 0;
    right: auto;
  }

  .dashboard-hero,
  .dashboard-tabs {
    margin-left: -18px;
    margin-right: -18px;
    padding-left: 18px;
    padding-right: 18px;
  }

  .dashboard-tabs {
    overflow-x: auto;
  }

  .bar-chart {
    grid-template-columns: repeat(3, minmax(54px, 1fr));
    border-right: 0;
    padding-right: 0;
  }

  .mega-create {
    width: min(92vw, 420px);
    grid-template-columns: 1fr;
  }

  .nav-menu {
    left: 0;
    right: auto;
  }

  .settings-menu {
    grid-template-columns: 1fr;
  }

  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .shell {
    padding: 18px;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
/* Customer portal */
.portal-hero { display:flex; align-items:center; justify-content:space-between; gap:24px; padding:24px 0 18px; border-bottom:1px solid #d9dee7; }
.portal-hero h1 { margin:2px 0 6px; font-size:28px; letter-spacing:0; }
.portal-hero p { margin:0; }
.portal-tabs { display:flex; gap:4px; overflow-x:auto; padding:14px 0; border-bottom:1px solid #d9dee7; margin-bottom:20px; }
.portal-tabs a { color:#344054; padding:9px 13px; text-decoration:none; border-bottom:2px solid transparent; white-space:nowrap; }
.portal-tabs a.active { color:#1565c0; border-bottom-color:#1565c0; font-weight:600; }
.portal-metrics { margin-top:0; }
.portal-row { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px 0; border-bottom:1px solid #eaecf0; color:inherit; text-decoration:none; }
.portal-row:last-child { border-bottom:0; }
.portal-row span { display:flex; flex-direction:column; gap:3px; }
.portal-row span:last-child { text-align:right; }
.portal-row small { color:#667085; }
.comment { padding:12px 0; border-bottom:1px solid #eaecf0; }
.comment p { margin:6px 0; white-space:pre-wrap; }
.comment small { color:#667085; }
@media (max-width: 720px) { .portal-hero { align-items:flex-start; flex-direction:column; } .portal-tabs { margin-left:-12px; margin-right:-12px; padding-left:12px; } }

/* Dedicated customer portal */
.customer-portal-body { background:#f4f7f9; color:#17232d; }
.customer-portal-topbar { height:68px; position:sticky; top:0; z-index:30; display:flex; align-items:center; justify-content:space-between; padding:0 28px; background:#fff; border-bottom:1px solid #dce4e8; }
.customer-portal-brand { display:flex; align-items:center; gap:11px; color:#17232d; font-size:17px; }
.customer-portal-brand:hover { text-decoration:none; }
.portal-account-menu { position:relative; }
.portal-account-menu summary { display:flex; align-items:center; gap:10px; cursor:pointer; list-style:none; }
.portal-account-menu summary::-webkit-details-marker { display:none; }
.portal-account-menu summary > span:nth-child(2) { display:flex; flex-direction:column; line-height:1.25; }
.portal-account-menu summary small { color:#697782; }
.portal-account-menu summary svg { width:16px; }
.portal-account-menu > div { position:absolute; right:0; top:48px; min-width:190px; display:grid; padding:7px; border:1px solid #dce4e8; border-radius:7px; background:#fff; box-shadow:0 14px 35px rgba(23,35,45,.14); }
.portal-account-menu > div a { padding:9px 10px; border-radius:5px; }
.portal-account-menu > div a:hover { background:#eef6f3; text-decoration:none; }
.portal-avatar { width:36px; height:36px; display:grid; place-items:center; border-radius:50%; background:#dff1eb; color:#0c6248; font-weight:800; }
.customer-portal-layout { min-height:calc(100vh - 68px); display:grid; grid-template-columns:228px minmax(0,1fr); }
.customer-portal-sidebar { position:sticky; top:68px; height:calc(100vh - 68px); display:flex; flex-direction:column; justify-content:space-between; padding:22px 14px; background:#fff; border-right:1px solid #dce4e8; }
.customer-portal-sidebar nav { display:grid; gap:3px; }
.customer-portal-sidebar nav a { min-height:42px; display:grid; grid-template-columns:22px 1fr auto; align-items:center; gap:10px; padding:9px 12px; border-radius:6px; color:#46545e; font-weight:600; }
.customer-portal-sidebar nav a:hover { background:#f0f5f3; text-decoration:none; }
.customer-portal-sidebar nav a.active { color:#0c6248; background:#e4f3ee; }
.customer-portal-sidebar nav svg { width:18px; height:18px; }
.customer-portal-sidebar nav span { min-width:22px; padding:2px 6px; border-radius:10px; background:#cde8df; text-align:center; font-size:11px; }
.portal-help { padding:14px; border:1px solid #dce4e8; border-left:3px solid #0c6248; border-radius:6px; background:#f8fbfa; }
.portal-help p { margin:6px 0 10px; color:#697782; font-size:12px; line-height:1.45; }
.customer-portal-main { min-width:0; width:100%; max-width:1440px; padding:34px clamp(24px,4vw,58px) 60px; }
.portal-welcome,.portal-page-head { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin-bottom:24px; }
.portal-welcome h1,.portal-page-head h1 { margin:4px 0 7px; font-size:30px; letter-spacing:0; }
.portal-welcome p,.portal-page-head p { margin:0; color:#697782; }
.portal-balance-card { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); margin-bottom:24px; border:1px solid #d6e0e4; border-top:3px solid #0c6248; border-radius:7px; background:#fff; box-shadow:0 6px 18px rgba(23,35,45,.05); }
.portal-balance-card > div { display:flex; flex-direction:column; gap:6px; padding:24px 26px; border-right:1px solid #e2e8eb; }
.portal-balance-card > div:last-child { border-right:0; }
.portal-balance-card p { margin:0; color:#697782; font-size:13px; }
.portal-balance-card strong { font-size:24px; letter-spacing:0; }
.portal-balance-card small { color:#697782; }
.portal-content-grid { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(300px,.8fr); gap:22px; margin-bottom:22px; }
.portal-section,.portal-statement { padding:22px; border:1px solid #dce4e8; border-radius:7px; background:#fff; box-shadow:0 4px 14px rgba(23,35,45,.04); }
.portal-section h2 { margin:0 0 17px; font-size:17px; }
.portal-section .panel-head h2 { margin:0; }
.portal-empty { min-height:145px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:7px; color:#697782; text-align:center; }
.portal-empty svg { width:30px; height:30px; color:#2d8269; }
.portal-empty p { margin:0; font-size:13px; }
.portal-company-address { min-height:45px; color:#697782; line-height:1.55; }
.portal-upload { display:flex; gap:8px; align-items:center; margin:-4px 0 14px; padding-bottom:14px; border-bottom:1px solid #e2e8eb; }
.portal-upload label { cursor:pointer; }
.portal-search { width:min(320px,100%); position:relative; }
.portal-search svg { width:17px; position:absolute; left:11px; top:10px; color:#697782; }
.portal-search input { padding-left:36px; background:#fff; }
.portal-filter-tabs { display:flex; gap:20px; margin-bottom:14px; border-bottom:1px solid #dce4e8; }
.portal-filter-tabs button { padding:10px 2px; border:0; border-bottom:2px solid transparent; border-radius:0; background:transparent; color:#697782; }
.portal-filter-tabs button.active { color:#0c6248; border-bottom-color:#0c6248; }
.portal-table-wrap { padding:0; overflow:hidden; }
.portal-table-wrap table { margin:0; }
.portal-table-wrap th { background:#f7f9fa; }
.portal-statement { padding:32px; }
.portal-statement-toolbar { display:flex; align-items:flex-end; gap:12px; flex-wrap:wrap; margin-bottom:14px; padding:14px 16px; border:1px solid #dce4e8; border-radius:7px; background:#fff; }
.portal-statement-toolbar label { display:grid; gap:5px; color:#697782; font-size:12px; }
.portal-statement-toolbar select,.portal-statement-toolbar input { min-width:150px; background:#fff; }
.portal-statement-toolbar > div { display:flex; align-items:flex-end; gap:10px; }
.portal-statement-heading { display:flex; justify-content:space-between; gap:30px; padding-bottom:24px; border-bottom:1px solid #dce4e8; }
.portal-statement-heading > div { display:flex; align-items:center; gap:10px; }
.portal-statement-heading > div:last-child { align-items:flex-end; flex-direction:column; gap:3px; text-align:right; }
.portal-statement-heading small,.portal-statement-heading span { color:#697782; }
.portal-statement-summary { display:grid; grid-template-columns:repeat(4,1fr); margin:26px 0; border:1px solid #dce4e8; }
.portal-statement-summary div { display:flex; flex-direction:column; gap:7px; padding:18px; border-right:1px solid #dce4e8; }
.portal-statement-summary div:last-child { border-right:0; background:#edf7f3; }
.portal-statement-summary span { color:#697782; font-size:12px; }
.portal-statement-total { display:flex; justify-content:flex-end; gap:28px; margin-top:18px; padding:16px 0; border-top:2px solid #17232d; font-size:18px; }
.customer-portal-main .button svg { width:16px; height:16px; vertical-align:middle; margin-right:5px; }
@media print { .customer-portal-topbar,.customer-portal-sidebar,.portal-page-head .actions { display:none!important; } .customer-portal-layout { display:block; } .customer-portal-main { max-width:none; padding:0; } .portal-statement { border:0; box-shadow:none; } }
@media (max-width:900px) { .customer-portal-layout { grid-template-columns:1fr; } .customer-portal-sidebar { position:sticky; top:68px; z-index:20; width:100%; height:auto; padding:0 14px; border-right:0; border-bottom:1px solid #dce4e8; overflow-x:auto; } .customer-portal-sidebar nav { display:flex; min-width:max-content; } .customer-portal-sidebar nav a { grid-template-columns:18px auto auto; border-radius:0; border-bottom:2px solid transparent; } .customer-portal-sidebar nav a.active { background:transparent; border-bottom-color:#0c6248; } .portal-help { display:none; } .portal-content-grid { grid-template-columns:1fr; } }
@media (max-width:650px) { .customer-portal-topbar { padding:0 14px; } .customer-portal-brand strong { display:none; } .portal-account-menu summary > span:nth-child(2) { display:none; } .customer-portal-main { padding:24px 14px 44px; } .portal-welcome,.portal-page-head { align-items:flex-start; flex-direction:column; } .portal-balance-card { grid-template-columns:1fr; } .portal-balance-card > div { border-right:0; border-bottom:1px solid #e2e8eb; } .portal-statement { padding:18px; } .portal-statement-heading { flex-direction:column; } .portal-statement-heading > div:last-child { align-items:flex-start; text-align:left; } .portal-statement-summary { grid-template-columns:1fr 1fr; } .portal-statement-summary div:nth-child(2) { border-right:0; } .portal-statement-summary div { border-bottom:1px solid #dce4e8; } }
.customer-list-head { align-items: center; }
.saved-view select { border: 0; background: transparent; font-size: 18px; font-weight: 700; padding: 8px 28px 8px 4px; }
.table-scroll { overflow: auto; border: 1px solid var(--border); background: #fff; }
.dense-table { margin: 0; min-width: 1180px; }
.dense-table th, .dense-table td { padding: 10px 12px; white-space: nowrap; }
.dense-table th { position: sticky; top: 0; z-index: 1; background: #f7f9fb; }
.dense-table th a { color: inherit; text-decoration: none; }
.row-actions { position: relative; }
.row-actions > summary { list-style: none; cursor: pointer; }
.row-actions > div { position: absolute; right: 0; z-index: 20; min-width: 170px; padding: 6px; border: 1px solid var(--border); background: #fff; box-shadow: 0 10px 28px rgba(20,35,50,.15); }
.row-actions > div a, .row-actions > div button { display: block; width: 100%; padding: 8px 10px; border: 0; background: transparent; color: inherit; text-align: left; text-decoration: none; }
.row-actions > div a:hover, .row-actions > div button:hover { background: #f2f6f8; }
.list-footer { display: flex; justify-content: space-between; padding: 12px 4px; color: var(--muted); font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
