﻿:root {
  --bg: #eef2ef;
  --surface: #ffffff;
  --surface-soft: #f8faf7;
  --surface-muted: #f3f6f4;
  --ink: #1f2723;
  --muted: #6f766f;
  --line: #dce3dc;
  --brand: #106b55;
  --brand-dark: #0b4b3e;
  --accent: #b9822b;
  --accent-soft: #fff5df;
  --danger: #b83232;
  --issue: #9a5b00;
  --ok: #087b44;
  --shadow: 0 16px 44px rgba(26, 45, 38, 0.08);
  --shadow-strong: 0 24px 70px rgba(19, 54, 44, 0.16);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  display: block;
}

html,
body {
  overflow-x: hidden;
}

.mobile-menu-button,
.mobile-nav-backdrop {
  display: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.sidebar {
  background: linear-gradient(180deg, #10392f 0%, #0d261f 100%);
  color: #fff;
  position: fixed;
  inset: 0 0 0 auto;
  width: 280px;
  height: 100vh;
  min-height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  padding: 22px 16px;
  box-shadow: 18px 0 50px rgba(12, 38, 31, 0.18);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #f4d18b;
  color: #17352c;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 24px;
}

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

.brand small {
  color: #cad8d2;
  margin-top: 4px;
}

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

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

.nav-group > span {
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 700;
  padding: 0 12px;
}

.nav-subtitle {
  display: block;
  margin: 8px 12px 2px;
  color: rgba(244, 209, 139, 0.86);
  font-size: 11px;
  font-weight: 700;
}

.nav-item {
  border: 0;
  background: transparent;
  color: #dfe9e4;
  text-align: right;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: translateX(-2px);
}

.app {
  margin-right: 280px;
  padding: 24px 28px 36px;
  overflow: visible;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(220, 227, 220, 0.82);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.page-heading {
  min-width: 280px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: 28px;
  margin-bottom: 6px;
}

h2 {
  font-size: 18px;
  margin-bottom: 0;
}

.topbar p,
.hint {
  color: var(--muted);
  margin-bottom: 0;
}

.top-actions,
.inline-actions,
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.top-actions {
  justify-content: flex-end;
}


.compact-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.compact-field input {
  width: 150px;
  min-height: 38px;
}
.connection {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  color: var(--muted);
}

.connection.connected {
  color: var(--ok);
  border-color: rgba(8, 123, 68, 0.35);
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  min-height: 42px;
}

.primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 22px rgba(16, 107, 85, 0.18);
}

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

.ghost {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}

.ghost:hover {
  border-color: var(--brand);
}

.text-button {
  background: transparent;
  color: var(--brand);
  padding: 0;
  min-height: auto;
}

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

.view {
  display: none;
}

.hidden {
  display: none !important;
}

.boot-loader {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 30%, rgba(16, 107, 85, 0.1), transparent 34%),
    rgba(245, 242, 236, 0.96);
  backdrop-filter: blur(8px);
}

.boot-card {
  width: min(460px, 100%);
  display: grid;
  gap: 16px;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-strong);
}

.loader-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.loader-bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #f4d18b);
  animation: loaderSweep 1.15s ease-in-out infinite;
}

@keyframes loaderSweep {
  0% {
    transform: translateX(120%);
  }
  100% {
    transform: translateX(-260%);
  }
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(245, 242, 236, 0.94);
  backdrop-filter: blur(6px);
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(13, 58, 45, 0.16);
}

.login-brand {
  margin-bottom: 4px;
}

body.locked .sidebar,
body.locked .app,
body.storage-blocked .sidebar,
body.storage-blocked .app {
  pointer-events: none;
  user-select: none;
  filter: blur(1px);
}

.view.active {
  display: block;
}

.dashboard-quickstart {
  min-height: 220px;
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(420px, 1.1fr);
  gap: 22px;
  align-items: center;
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid rgba(220, 227, 220, 0.9);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(16, 107, 85, 0.92), rgba(18, 55, 45, 0.96)),
    var(--brand);
  color: #fff;
  box-shadow: var(--shadow-strong);
}

.dashboard-quickstart h2 {
  font-size: 26px;
  line-height: 1.35;
  margin: 8px 0 8px;
}

.dashboard-quickstart p {
  color: rgba(255, 255, 255, 0.78);
  margin: 0;
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #f7d99a;
  font-size: 13px;
  font-weight: 700;
}

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

.quick-card {
  min-height: 142px;
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 22px;
  text-align: right;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #10231d;
  background: #fff;
  box-shadow: 0 18px 44px rgba(6, 22, 17, 0.18);
}

.quick-card span {
  font-size: 28px;
  font-weight: 800;
  color: var(--brand-dark);
}

.quick-card strong {
  color: var(--muted);
  font-size: 14px;
}

.quick-card.sale {
  background: linear-gradient(180deg, #ffffff, #eef8f3);
}

.quick-card.purchase {
  background: linear-gradient(180deg, #ffffff, var(--accent-soft));
}

.quick-card:hover {
  transform: translateY(-2px);
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tab-button {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}

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

.supplier-tab,
.inventory-tab,
.report-tab-panel {
  display: none;
}

.supplier-tab.active,
.inventory-tab.active,
.report-tab-panel.active {
  display: block;
}

.report-tabs {
  margin-top: 14px;
}

.report-tabs .tab-button {
  min-height: 42px;
  padding-inline: 14px;
}

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

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--brand);
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  font-size: 24px;
  margin: 8px 0;
}

.compact-metrics {
  grid-template-columns: repeat(6, minmax(130px, 1fr));
}

.modon-live-panel {
  border-color: rgba(16, 107, 85, 0.22);
}

.modon-live-metrics {
  grid-template-columns: 1.35fr repeat(3, minmax(150px, 1fr));
}

.modon-live-metrics .metric:first-child {
  background: linear-gradient(135deg, rgba(16, 107, 85, 0.08), #fff);
  border-color: rgba(16, 107, 85, 0.28);
}

.modon-live-metrics .metric:first-child strong {
  font-size: 32px;
}

.modon-account-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(16, 107, 85, 0.18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(26, 45, 38, 0.06);
}

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

.modon-account-head strong,
.modon-account-head span {
  display: block;
}

.modon-account-head > div:first-child strong {
  font-size: 18px;
}

.modon-account-head span,
.modon-account-kpis span,
.modon-status-item span {
  color: var(--muted);
}

.modon-account-total {
  min-width: 150px;
  text-align: center;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--surface-muted);
}

.modon-account-total strong {
  font-size: 30px;
  color: var(--brand-dark);
}

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

.modon-account-kpis > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.modon-account-kpis strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.modon-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.modon-status-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid #e9e2d5;
  border-radius: 8px;
  background: #fbfaf7;
}

.modon-status-item strong {
  color: var(--brand-dark);
}

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

.grid > *,
.panel {
  min-width: 0;
}

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

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

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

.form-grid {
  grid-template-columns: minmax(420px, 1.1fr) minmax(320px, 0.9fr);
}

.sales-workspace {
  display: grid;
  gap: 16px;
}

.sales-history,
.compact-invoice-preview {
  margin-top: 14px;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
  white-space: nowrap;
}

.danger-button {
  background: #b42318;
  color: #fff;
}

.danger-button:hover {
  background: #931b12;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.report-toolbar {
  position: sticky;
  top: 16px;
  z-index: 9;
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.report-metrics {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
}

.panel:hover {
  border-color: rgba(16, 107, 85, 0.24);
  box-shadow: 0 18px 50px rgba(26, 45, 38, 0.1);
}

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

.panel-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

.form-section {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(16, 107, 85, 0.14);
  border-radius: 8px;
  background: var(--surface-soft);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.compact {
  min-width: 210px;
  color: var(--muted);
}

.compact select {
  margin-top: 6px;
  background: var(--surface);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  border-radius: 6px;
  padding: 10px 12px;
  min-height: 42px;
}

.compact select,
.report-filters select,
.report-filters input {
  min-height: 40px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(16, 107, 85, 0.18);
  border-color: var(--brand);
}

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

.search-combo {
  position: relative;
}

.search-combo input[type="hidden"] {
  display: none;
}

.suggestions {
  display: none;
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 6px;
}

.suggestions.active {
  display: grid;
  gap: 4px;
}

.suggestion-item {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  background: transparent;
  color: var(--ink);
  text-align: right;
  border-radius: 5px;
}

.product-picker {
  margin: 10px 0 12px;
}

.product-suggestion {
  display: grid;
  gap: 3px;
}

.product-suggestion small {
  color: var(--muted);
  font-size: 12px;
}

.suggestion-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}

.purchase-lines .table-wrap {
  overflow: visible;
}

.purchase-product-cell {
  min-width: 260px;
}

.line-product-suggestions {
  min-width: 280px;
}

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

.logo-preview-box {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
}

.logo-preview-box img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}

.suggestion-item:hover {
  background: var(--surface-soft);
}

.suggestion-empty {
  padding: 10px;
  color: var(--muted);
}

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

.delivery-fields {
  display: none;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.delivery-fields.active {
  display: block;
}

.section-title {
  font-weight: 700;
  margin-bottom: 12px;
}

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

.permission-group {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(16, 107, 85, 0.14);
  border-radius: 8px;
  background: #fff;
}

.permission-group-title {
  color: var(--brand-dark);
  font-weight: 800;
}

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

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--ink);
}

.check-line input {
  width: 18px;
  min-height: 18px;
}

.actions {
  margin-top: 18px;
}

.invoice-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(16, 107, 85, 0.18);
  border-radius: 8px;
  background: #f7fbf8;
}

.invoice-summary div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.invoice-summary div:nth-child(3),
.invoice-summary div:nth-child(5),
.invoice-summary div:nth-child(6) {
  background: #fff;
  border-color: rgba(16, 107, 85, 0.3);
}

.invoice-summary strong {
  font-size: 16px;
}

.invoice-summary span {
  color: var(--muted);
}

.invoice-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.checkbox-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--ink);
}

.checkbox-control input {
  width: 18px;
  min-height: 18px;
}

.installment-box {
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(185, 130, 43, 0.35);
  border-radius: 6px;
  background: rgba(185, 130, 43, 0.07);
}

.installment-box.active {
  display: grid;
}

.installment-preview {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

#saleLines input,
#saleLines select,
#purchaseLines input {
  background: #fff;
}

#saleLines .line-total {
  font-weight: 800;
  color: var(--brand);
  white-space: nowrap;
}

.locked-line select:disabled,
.locked-line input[readonly] {
  color: var(--ink);
  background: #f3f7f5;
  border-color: rgba(16, 107, 85, 0.28);
  opacity: 1;
}

.selected-product {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  color: var(--ink);
}

.form .table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.form .table-wrap table {
  min-width: 840px;
}

.return-scan-actions {
  margin: 12px 0;
}

.return-scanner {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(16, 107, 85, 0.24);
  border-radius: 10px;
  background: #071711;
  min-height: 260px;
}

.return-scanner video {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
}

.scanner-frame {
  position: absolute;
  inset: 16%;
  border: 3px solid rgba(246, 196, 103, 0.95);
  border-radius: 12px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.32);
  pointer-events: none;
}

.return-scanner .hint {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  text-align: center;
}

.return-preview {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(16, 107, 85, 0.24);
  border-radius: 10px;
  background: #fff;
}

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

.return-preview-head strong {
  display: block;
  font-size: 1.2rem;
  margin-bottom: 6px;
}

.return-preview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.return-preview-grid div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.return-preview-grid span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

.return-preview-grid strong {
  word-break: break-word;
}

.table-wrap {
  overflow: auto;
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 760px;
}

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

th {
  background: var(--surface-muted);
  color: var(--muted);
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr {
  background: #fff;
}

tbody tr:hover {
  background: #fbfcfb;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #ece7db;
  color: var(--muted);
  white-space: nowrap;
}

.badge.ok {
  background: rgba(8, 123, 68, 0.12);
  color: var(--ok);
}

.badge.issue {
  background: rgba(154, 91, 0, 0.14);
  color: var(--issue);
}

.badge.danger {
  background: rgba(184, 50, 50, 0.13);
  color: var(--danger);
}

.badge.external {
  background: rgba(82, 95, 89, 0.12);
  color: #43514b;
}

.modon-external-table table {
  min-width: 980px;
}

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

.reconciliation-strip > div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.reconciliation-strip span,
.reconciliation-strip small {
  color: var(--muted);
}

.reconciliation-strip strong {
  font-size: 22px;
  color: var(--brand-dark);
}

.filters-bar {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

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

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

.card-line,
.ledger-row,
.report-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.carrier-return-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(16, 107, 85, 0.18);
  border-radius: 8px;
  background: #fff;
}

.carrier-return-card .table-wrap table {
  min-width: 820px;
}

.compact-report {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
}

.compact-report .report-row {
  background: #fff;
}

.card-line {
  align-items: flex-start;
}

.card-line.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(16, 107, 85, 0.12);
}

.card-line.featured-line {
  border-color: rgba(16, 107, 85, 0.38);
  background: linear-gradient(135deg, rgba(16, 107, 85, 0.08), rgba(248, 197, 99, 0.12));
}

.card-line strong,
.ledger-row strong,
.report-row strong {
  color: var(--ink);
}

.ledger,
.report {
  display: grid;
  gap: 10px;
}

.modon-timeline {
  position: relative;
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: -14px;
  right: 8px;
  width: 2px;
  background: var(--line);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-dot {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  margin-top: 4px;
  border: 3px solid #d8e4df;
  border-radius: 50%;
  background: #fff;
}

.timeline-body {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.timeline-body strong {
  display: block;
  color: var(--ink);
}

.timeline-body p {
  margin: 6px 0;
  color: var(--ink);
}

.timeline-body small {
  color: var(--muted);
}

.timeline-item.created .timeline-dot,
.timeline-item.modon .timeline-dot {
  border-color: var(--brand);
}

.timeline-item.status .timeline-dot,
.timeline-item.invoice .timeline-dot {
  border-color: #2f80ed;
}

.timeline-item.cash .timeline-dot {
  border-color: #1f9d6a;
}

.timeline-item.stock .timeline-dot,
.timeline-item.return .timeline-dot {
  border-color: #d98c20;
}

.timeline-item.issue .timeline-dot {
  border-color: #c0392b;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(13, 31, 27, 0.38);
}

.modal-layer.hidden {
  display: none;
}

.modal-card {
  width: min(980px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.audit-details {
  display: grid;
  gap: 14px;
}

.audit-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.audit-meta div,
.audit-change {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 10px;
}

.audit-meta span,
.audit-change span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.audit-change-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.audit-empty-state {
  padding: 18px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
}

.invoice-preview dl {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px;
}

.invoice-preview dt {
  color: var(--muted);
}

.invoice-preview dd {
  margin: 0;
}

.empty {
  color: var(--muted);
  padding: 24px;
  background: var(--surface-soft);
  border-radius: 6px;
  text-align: center;
}

.docs ul {
  margin-bottom: 0;
}

.print-layer {
  display: none;
}

.compact-actions {
  justify-content: flex-start;
  margin: 0 0 14px;
}

.print-document {
  background: #fff;
  color: #111;
  padding: 28px;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

.print-header,
.print-party,
.print-meta,
.print-totals {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.print-header {
  border-bottom: 2px solid #111;
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.print-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.print-logo {
  width: 74px;
  height: 74px;
  object-fit: contain;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 5px;
}

.print-header h1 {
  margin-bottom: 4px;
}

.print-title {
  text-align: left;
  display: grid;
  gap: 6px;
  align-content: start;
}

.print-title strong {
  font-size: 24px;
}

.print-title small {
  display: inline-block;
  justify-self: end;
  padding: 4px 10px;
  border: 1px solid #999;
  border-radius: 999px;
  font-weight: 700;
}

.print-party {
  border-bottom: 1px solid #bbb;
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.print-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.print-meta div,
.print-totals div {
  border: 1px solid #ddd;
  padding: 9px 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 18px;
}

.print-table th,
.print-table td {
  border: 1px solid #bbb;
  padding: 10px;
  text-align: right;
}

.print-table th {
  background: #f2f2f2;
}

.print-totals {
  display: grid;
  grid-template-columns: minmax(260px, 380px);
  justify-content: end;
}

.print-notes {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #ddd;
  background: #fafafa;
}

.print-notes p {
  margin: 8px 0 0;
}

.print-signatures {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 24px;
  margin-top: 34px;
}

.print-signatures div {
  min-height: 72px;
  border-top: 1px solid #111;
  padding-top: 8px;
  text-align: center;
}

.print-footer {
  margin-top: 26px;
  text-align: center;
  border-top: 1px solid #bbb;
  padding-top: 14px;
}

.print-extra {
  margin-top: 18px;
}

.print-extra h2 {
  font-size: 18px;
  margin-bottom: 10px;
}

.modon-work-card {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(150px, 0.7fr) minmax(150px, 0.8fr) minmax(260px, auto);
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.modon-work-main,
.modon-work-money,
.modon-work-status,
.modon-work-actions {
  display: grid;
  gap: 5px;
}

.modon-work-main strong {
  color: var(--brand);
  font-size: 17px;
}

.modon-work-main small,
.modon-work-money small {
  color: var(--muted);
  line-height: 1.5;
}

.modon-work-status {
  justify-items: start;
}

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

.print-batch-card {
  break-inside: avoid;
  page-break-inside: avoid;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed #aaa;
}

.print-batch-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 18px;
}

@media (max-width: 1100px) {
  body {
    grid-template-columns: 1fr;
  }

  .app {
    margin-right: 0;
  }

  .sidebar {
    position: static;
    min-height: auto;
    max-height: none;
  }

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

  .metrics,
  .report-metrics,
  .report-filters,
  .compact-report,
  .grid.two,
  .grid.three,
  .dashboard-quickstart,
  .audit-meta,
  .audit-change-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    display: block;
    min-width: 0;
  }

  .mobile-menu-button {
    display: grid;
    place-items: center;
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 70;
    width: 46px;
    height: 46px;
    padding: 0;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    box-shadow: var(--shadow-strong);
  }

  body.locked .mobile-menu-button,
  body.storage-blocked .mobile-menu-button {
    display: none;
  }

  .mobile-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(9, 25, 21, 0.42);
  }

  body.mobile-nav-open .mobile-nav-backdrop {
    display: block;
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  body.mobile-nav-open .mobile-menu-button {
    background: #ffffff;
    color: var(--brand-dark);
    border-color: rgba(255, 255, 255, 0.9);
  }

  .app {
    padding: 70px 10px 18px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    width: min(86vw, 310px);
    min-height: 100vh;
    max-height: 100vh;
    padding: 18px 14px 28px;
    transform: translateX(105%);
    transition: transform 0.22s ease;
    border-radius: 0;
    box-shadow: -18px 0 54px rgba(12, 38, 31, 0.25);
  }

  body.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .brand {
    margin: 50px 0 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }

  .brand small {
    display: block;
  }

  .nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    overflow: visible;
    padding-bottom: 20px;
  }

  .nav-group {
    min-width: 0;
    gap: 4px;
    padding: 8px 0 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .nav-group > span {
    padding: 0 10px 4px;
    font-size: 11px;
    color: rgba(244, 209, 139, 0.9);
  }

  .nav-subtitle {
    margin: 6px 10px 2px;
    font-size: 10px;
  }

  .nav-item {
    min-height: 42px;
    padding: 10px 12px;
    white-space: normal;
    width: 100%;
    text-align: right;
    line-height: 1.35;
  }

  .topbar,
  .panel-head,
  .card-line,
  .ledger-row,
  .report-row {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar {
    gap: 10px;
    padding: 12px;
    margin-bottom: 12px;
  }

  .page-heading {
    min-width: 0;
  }

  .page-heading h1 {
    font-size: 22px;
  }

  .page-heading p {
    display: none;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .inline-actions,
  .actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .inline-actions > *,
  .actions > * {
    flex: 1 1 100%;
  }

  .top-actions > * {
    min-width: 0;
    width: 100%;
  }

  .top-actions .connection,
  .top-actions .compact {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .top-actions .compact,
  .top-actions .page-action {
    grid-column: 1 / -1;
  }

  .top-actions select {
    min-height: 38px;
  }

  .panel {
    padding: 12px;
    border-radius: 8px;
  }

  button {
    width: 100%;
  }

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

  .fields,
  .invoice-controls,
  .installment-box,
  .invoice-summary,
  .permissions-grid,
  .report-filters,
  .filters-bar,
  .compact-report,
  .grid,
  .grid.two,
  .grid.three,
  .grid.one {
    grid-template-columns: 1fr;
  }

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

  .compact-metrics,
  .modon-live-metrics,
  .modon-account-kpis,
  .modon-status-grid,
  .reconciliation-strip {
    grid-template-columns: 1fr;
  }

  .modon-work-card {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .modon-work-actions {
    grid-template-columns: 1fr;
  }

  .modon-account-head {
    flex-direction: column;
  }

  .modon-account-total {
    width: 100%;
  }

  .pagination-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .pagination-actions {
    justify-content: space-between;
  }

  .dashboard-quickstart {
    padding: 18px;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .quick-card span {
    font-size: 24px;
  }

  .form .table-wrap table {
    min-width: 640px;
  }

  .return-scanner {
    min-height: 320px;
  }

  .return-scanner video {
    min-height: 320px;
  }

  .scanner-frame {
    inset: 20% 10%;
  }

  .return-preview-head {
    flex-direction: column;
    align-items: stretch;
  }

  .return-preview-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    border: 1px solid var(--line);
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  .purchase-lines .table-wrap {
    overflow: auto;
    max-width: 100%;
  }

  table {
    min-width: 680px;
  }

  th,
  td {
    padding: 10px 8px;
  }

  .modal-layer {
    padding: 10px;
    align-items: stretch;
  }

  .modal-card {
    width: 100%;
    max-height: calc(100vh - 20px);
  }
}

@media print {
  body.printing {
    background: #fff;
  }

  body.printing .sidebar,
  body.printing .topbar,
  body.printing .app {
    display: none !important;
  }

  body.printing .print-layer {
    display: block !important;
  }

  body.printing {
    display: block;
  }

  body.printing .print-document {
    padding: 0;
  }
}

