:root {
  --bg: #f4f7fb;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-strong: #ffffff;
  --line: rgba(15, 23, 42, 0.1);
  --ink: #0f172a;
  --muted: #64748b;
  --sidebar: #0b1526;
  --sidebar-2: #11213a;
  --sidebar-ink: rgba(244, 248, 252, 0.88);
  --accent: #1d4ed8;
  --accent-2: #0f766e;
  --success: #15803d;
  --warning: #b45309;
  --danger: #b91c1c;
  --shadow: 0 20px 46px rgba(15, 23, 42, 0.12);
  --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;
  --header-grad: linear-gradient(90deg, rgba(21, 111, 82, 0.1), rgba(29, 78, 216, 0.1));
}

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgba(14, 116, 144, 0.12), transparent 34%),
    linear-gradient(135deg, #eef6f8, #f4f6fb);
}

.boot-card {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: min(420px, 90vw);
  padding: 24px 28px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.14);
}

.boot-card strong,
.boot-card span {
  display: block;
}

.boot-card strong {
  color: #0f172a;
  font-size: 21px;
}

.boot-card span {
  margin-top: 5px;
  color: #52647d;
  font-size: 14px;
}

.boot-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border-radius: 17px;
  color: #fff;
  background: linear-gradient(135deg, #155e75, #0f766e);
  font-weight: 900;
  font-size: 20px;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", Aptos, system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.1), transparent 28%),
    radial-gradient(circle at top right, rgba(29, 78, 216, 0.08), transparent 25%),
    linear-gradient(180deg, #fbfdff 0%, var(--bg) 100%);
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 288px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: #f4f8fc;
}

.brand-block {
  padding: 8px 10px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #1e8f69, #143f33);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.brand-title {
  margin-top: 14px;
  font-size: 24px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(244, 248, 252, 0.7);
}

.nav-group-title {
  margin: 18px 10px 8px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(244, 248, 252, 0.42);
}

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

.nav-module {
  display: grid;
  gap: 8px;
}

.nav-button,
.nav-subbutton {
  width: 100%;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.nav-button {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-radius: 16px;
  padding: 14px;
  background: transparent;
  color: var(--sidebar-ink);
}

.nav-button:hover,
.nav-button.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-title {
  display: block;
  font-size: 14px;
  font-weight: 800;
}

.nav-copy {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: rgba(244, 248, 252, 0.62);
}

.nav-chevron {
  color: rgba(244, 248, 252, 0.56);
  transition: transform 0.16s ease;
}

.nav-module.expanded .nav-chevron {
  transform: rotate(90deg);
}

.nav-submenu {
  display: none;
  gap: 6px;
  margin-left: 16px;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-module.expanded .nav-submenu {
  display: grid;
}

.reference-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent, #0f766e);
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 3px;
}

.reference-link:hover,
.reference-link:focus-visible {
  color: var(--brand-strong, #1d4ed8);
  text-decoration-color: currentColor;
}

.material-bill {
  display: grid;
  gap: 18px;
}

.material-bill-header {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(230, 246, 244, 0.72), rgba(239, 244, 255, 0.86));
}

.material-bill-caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.material-bill-caption strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.material-entry-table {
  min-width: 1420px;
}

.material-entry-table th {
  white-space: nowrap;
}

.material-entry-table td {
  vertical-align: middle;
}

.material-entry-table input,
.material-entry-table select {
  min-width: 112px;
  width: 100%;
}

.material-entry-table td:nth-child(2) select {
  min-width: 250px;
}

.material-entry-table td:nth-child(6) input {
  min-width: 150px;
}

.material-entry-table td:nth-child(7) input {
  min-width: 145px;
}

.sales-entry-table {
  min-width: 1780px;
}

.sales-entry-table th {
  white-space: nowrap;
}

.sales-entry-table td {
  vertical-align: middle;
}

.sales-entry-table input,
.sales-entry-table select {
  min-width: 110px;
  width: 100%;
}

.sales-entry-table td:nth-child(2) select {
  min-width: 390px;
}

.sales-entry-table td:nth-child(7) select {
  min-width: 145px;
}

.sales-invoice-totals .grand-total {
  padding-top: 13px;
  font-size: 1.22rem;
}

.source-document-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 12px 16px;
  border: 1px solid rgba(14, 116, 144, 0.18);
  border-radius: 15px;
  background: rgba(236, 254, 255, 0.72);
  color: var(--muted);
}

.source-document-strip strong {
  color: var(--ink);
  margin-right: 12px;
}

.return-entry-table {
  min-width: 1500px;
}

.return-entry-table th {
  white-space: nowrap;
}

.return-entry-table td {
  vertical-align: middle;
}

.return-entry-table input,
.return-entry-table select {
  min-width: 110px;
  width: 100%;
}

.return-entry-table td:nth-child(2) select {
  min-width: 330px;
}

.return-entry-table td:nth-child(8) select {
  min-width: 205px;
}

.quantity-with-unit {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) auto;
  align-items: center;
  gap: 7px;
}

.quantity-with-unit span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.amount-cell {
  white-space: nowrap;
  font-weight: 800;
}

.material-line-actions {
  justify-content: space-between;
  color: var(--muted);
  font-weight: 700;
}

.material-bill-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.45fr);
  gap: 20px;
  align-items: stretch;
}

.material-bill-totals {
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fafc;
}

.material-bill-totals > div,
.material-bill-totals > label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.material-bill-totals > label input {
  width: 130px;
  text-align: right;
}

.material-bill-totals > div:last-child {
  border-bottom: 0;
}

.material-bill-totals .grand-total {
  color: var(--ink);
  font-size: 1.12rem;
}

@media (max-width: 900px) {
  .material-bill-footer {
    grid-template-columns: 1fr;
  }

  .material-bill-caption {
    align-items: flex-start;
    flex-direction: column;
  }
}

.nav-subbutton {
  border-radius: 12px;
  padding: 10px 12px;
  background: transparent;
  color: rgba(244, 248, 252, 0.76);
  font-size: 13px;
}

.nav-subbutton:hover,
.nav-subbutton.active {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.sidebar-footer {
  margin-top: 18px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(244, 248, 252, 0.78);
  font-size: 12px;
  line-height: 1.6;
}

.workspace {
  padding: 10px;
  display: grid;
  gap: 10px;
  align-content: start;
  grid-auto-rows: min-content;
}

.topbar {
  border-radius: var(--radius-xl);
  padding: 10px 16px;
  background: var(--header-grad);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: var(--shadow-soft);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  max-width: 80ch;
}

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

.pill,
.status-badge,
.shortcut-tag {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.pill {
  background: rgba(29, 78, 216, 0.1);
  color: var(--accent);
}

.pill.subtle-pill {
  background: rgba(15, 23, 42, 0.07);
  color: #42526b;
}

.status-badge.success {
  background: rgba(21, 128, 61, 0.12);
  color: var(--success);
}

.status-badge.warning {
  background: rgba(180, 83, 9, 0.14);
  color: var(--warning);
}

.status-badge.danger {
  background: rgba(185, 28, 28, 0.1);
  color: var(--danger);
}

.shortcut-tag {
  background: rgba(15, 23, 42, 0.06);
  color: var(--ink);
}

.button,
.button-secondary,
.button-danger {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 800;
  cursor: pointer;
}

.button {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #ffffff;
  box-shadow: var(--shadow-soft);
}

.button-secondary {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.button-danger {
  background: rgba(185, 28, 28, 0.1);
  color: var(--danger);
  border: 1px solid rgba(185, 28, 28, 0.12);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.button-compact {
  min-height: 30px;
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1;
}

.page-grid,
.grid-4,
.grid-3,
.grid-2,
.card-grid {
  display: grid;
  gap: 10px;
}

.page-grid {
  align-content: start;
  grid-auto-rows: min-content;
}

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

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

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

.card-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.panel,
.metric-card,
.mini-card {
  background: var(--surface);
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.panel {
  padding: 12px;
}

.metric-card,
.mini-card {
  padding: 12px;
}

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

.panel-kicker,
.field label,
.table thead th,
.metric-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}

.panel-title {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
}

.panel-copy,
.metric-copy,
.mini-copy,
.empty-copy {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.metric-value {
  margin-top: 10px;
  font-size: 30px;
  font-weight: 900;
}

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

.chart-row {
  display: grid;
  grid-template-columns: 150px 1fr 90px;
  gap: 12px;
  align-items: center;
}

.chart-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.chart-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.chart-label,
.chart-value {
  font-size: 12px;
  font-weight: 700;
}

.chart-value {
  text-align: right;
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 12px;
}

.table tfoot td {
  background: rgba(15, 118, 110, 0.08);
  border-top: 2px solid rgba(15, 118, 110, 0.3);
  border-bottom: 0;
  font-weight: 800;
  white-space: nowrap;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: rgba(29, 78, 216, 0.05);
}

.register-search {
  min-width: 260px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  padding: 8px 10px;
  background: #ffffff;
}

.searchable-picker {
  position: relative;
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.searchable-picker input {
  flex: 1;
  min-width: 0;
  padding-right: 36px;
}

.picker-toggle-button {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 34px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.searchable-picker.has-create-button .picker-toggle-button {
  right: 80px;
}

.picker-create-button {
  padding: 8px 12px;
  border-radius: 12px;
  white-space: nowrap;
}

.picker-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  z-index: 20;
  max-height: 220px;
  overflow: auto;
}

.picker-option {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
}

.picker-option:hover,
.picker-option.active {
  background: rgba(29, 78, 216, 0.08);
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.24);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

.wizard-modal {
  width: min(1080px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: var(--shadow-strong);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.wizard-modal-head {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(232, 244, 255, 0.96), rgba(224, 236, 255, 0.96));
}

.wizard-modal-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--ink);
}

.wizard-modal-copy {
  margin-top: 8px;
  color: var(--muted);
}

.wizard-modal-body {
  padding: 18px 24px 24px;
}

.compact-grid {
  gap: 10px;
}

.choice-section-title {
  margin: 18px 0 10px;
  font-size: 15px;
  font-weight: 900;
  color: var(--ink);
}

.choice-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 16px;
  background: #ffffff;
  text-align: center;
  cursor: pointer;
}

.choice-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2) inset;
  background: rgba(239, 246, 255, 0.72);
}

.choice-card.mini {
  padding: 12px;
}

.choice-title {
  font-size: 15px;
  font-weight: 900;
  color: var(--ink);
}

.choice-copy {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.warehouse-pill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

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

.warehouse-stock-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.warehouse-stock-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.warehouse-stock-row.active,
.warehouse-stock-row:hover {
  border-color: var(--accent);
  background: rgba(239, 246, 255, 0.72);
}

.document-preview {
  background: #ffffff;
  color: var(--ink);
}

.document-sheet-a4 {
  width: 198mm;
  min-height: 285mm;
  max-width: 198mm;
  margin: 0 auto;
  padding: 7mm 8mm 6mm;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  box-sizing: border-box;
}

.document-print-stack {
  display: grid;
  gap: 10px;
}

.document-sheet-top {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(220px, 0.9fr);
  gap: 7px;
  align-items: start;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.document-company-block,
.document-title-block,
.document-address-card,
.document-dispatch-board,
.document-section-card,
.document-totals-card,
.document-footer-card {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.document-company-block {
  padding: 7px 9px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.document-title-block {
  padding: 7px 9px;
  text-align: right;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(15, 23, 42, 0.03));
}

.document-company-label,
.document-card-label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #60708c;
}

.preview-company-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.document-address-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.document-address-card {
  padding: 7px 9px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.document-card-title {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}

.document-card-copy {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.3;
  font-size: 10px;
}

.document-meta-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-top: 6px;
}

.document-meta-board-compact {
  margin-top: 7px;
}

.document-meta-item {
  display: grid;
  gap: 3px;
  padding: 5px 7px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(239, 246, 255, 0.96));
}

.document-meta-item strong {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #60708c;
}

.document-meta-item span {
  color: var(--ink);
  font-weight: 600;
  font-size: 10px;
}

.document-dispatch-board {
  margin-top: 6px;
  padding: 7px 9px;
  background: linear-gradient(180deg, #ffffff 0%, #f6fbff 100%);
}

.document-line-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  overflow: hidden;
  table-layout: fixed;
}

.document-line-table th,
.document-line-table td {
  padding: 5px 5px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  text-align: left;
  vertical-align: top;
  font-size: 9px;
  line-height: 1.25;
}

.document-line-table th {
  background: linear-gradient(180deg, #eef5ff 0%, #e5eefb 100%);
  color: #41526d;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.document-line-table td:nth-child(1),
.document-line-table th:nth-child(1) {
  width: 48px;
  text-align: center;
}

.document-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 6px;
  margin-top: 8px;
}

.document-notes-column {
  display: grid;
  gap: 6px;
}

.document-section-card {
  padding: 7px 9px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.document-amount-words {
  font-weight: 700;
  color: var(--ink);
}

.document-totals-card {
  padding: 7px 9px;
  background: linear-gradient(180deg, #ffffff 0%, #f5faff 100%);
}

.document-total-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px dashed rgba(15, 23, 42, 0.08);
  color: var(--muted);
  font-size: 10px;
}

.document-total-row strong {
  color: var(--ink);
  font-size: 11px;
}

.document-total-row.total {
  margin-top: 4px;
  padding-top: 7px;
  border-bottom: 0;
  border-top: 1px solid rgba(15, 23, 42, 0.1);
}

.document-total-row.total span,
.document-total-row.total strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.document-footer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.document-footer-card {
  padding: 7px 9px;
  min-height: 56px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.document-signature-space {
  min-height: 14px;
}

.document-copy-badge {
  display: inline-flex;
  align-self: flex-end;
  padding: 4px 10px;
  margin-bottom: 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--ink);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

  html,
  body {
    background: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .document-sheet-a4,
  .document-sheet-a4 *,
  .print-root,
  .print-root * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body * {
    visibility: hidden !important;
  }

  .modal-backdrop,
  .modal-backdrop * {
    visibility: visible !important;
  }

  .modal-backdrop {
    position: static !important;
    inset: auto !important;
    display: block !important;
    background: #ffffff !important;
    padding: 0 !important;
    z-index: auto !important;
  }

  .wizard-modal {
    width: auto !important;
    max-height: none !important;
    overflow: visible !important;
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }

  .wizard-modal-head,
  .actions-row {
    display: none !important;
  }

  .wizard-modal-body {
    padding: 0 !important;
  }

  .document-sheet-a4 {
    max-width: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    width: 190mm;
    min-height: 277mm;
    padding: 0;
    page-break-after: always;
  }

  .document-sheet-a4:last-child {
    page-break-after: auto;
  }

  .document-title-block {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(15, 23, 42, 0.04)) !important;
  }

  .document-line-table th {
    background: linear-gradient(180deg, #eef5ff 0%, #e5eefb 100%) !important;
    color: #41526d !important;
  }

  .document-company-block,
  .document-address-card,
  .document-dispatch-board,
  .document-section-card,
  .document-totals-card,
  .document-footer-card,
  .document-meta-item {
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%) !important;
  }

  .document-company-block,
  .document-title-block,
  .document-address-card,
  .document-dispatch-board,
  .document-section-card,
  .document-totals-card,
  .document-footer-card,
  .document-meta-item {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

.preview-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.preview-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--ink);
}

.preview-subtitle {
  color: var(--muted);
  font-size: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.accepted,
.status-pill.approved,
.status-pill.posted,
.status-pill.closed,
.status-pill.open,
.status-pill.active,
.status-pill.partly\ invoiced {
  background: rgba(21, 128, 61, 0.12);
  color: var(--success);
}

.status-pill.rejected,
.status-pill.cancelled {
  background: rgba(185, 28, 28, 0.1);
  color: var(--danger);
}

.status-pill.draft,
.status-pill.sent,
.status-pill.pending {
  background: rgba(180, 83, 9, 0.14);
  color: var(--warning);
}

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

.field {
  display: grid;
  gap: 4px;
}

.span-12 { grid-column: span 12; }
.span-8 { grid-column: span 8; }
.span-6 { grid-column: span 6; }
.span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }
.span-2 { grid-column: span 2; }

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--ink);
}

.field textarea {
  min-height: 56px;
  resize: vertical;
}

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

.contact-form-stack {
  display: grid;
  gap: 10px;
}

.contact-form-section {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.contact-section-title {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}

.full-width-button {
  width: 100%;
}

.mono {
  font-family: Consolas, "SFMono-Regular", monospace;
}

.lookup-row {
  display: flex;
  gap: 8px;
}

.lookup-row > *:first-child {
  flex: 1;
}

.hint-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.entry-layout {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 12px;
}

.screen {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  overflow: hidden;
}

.screen-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--header-grad);
}

.screen-title {
  font-size: 18px;
  font-weight: 800;
}

.screen-copy {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.voucher-shell {
  padding: 0 10px 10px;
}

.voucher-grid,
.item-grid {
  width: 100%;
  border-collapse: collapse;
}

.voucher-grid td {
  border-bottom: 1px solid var(--line);
  padding: 6px 8px;
  vertical-align: middle;
}

.voucher-label {
  width: 150px;
  font-size: 13px;
  font-weight: 600;
}

.voucher-input,
.voucher-select,
.voucher-textarea,
.cell-input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  padding: 8px 4px;
}

.voucher-textarea {
  min-height: 64px;
  resize: vertical;
}

.item-grid-shell {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 8px 0;
}

.item-grid th,
.item-grid td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0;
}

.item-grid th:last-child,
.item-grid td:last-child {
  border-right: 0;
}

.item-grid th {
  padding: 8px;
}

.sales-bottom-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 12px;
  margin-top: 12px;
}

.sales-narration {
  width: 100%;
  min-height: 132px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  resize: vertical;
  background: #ffffff;
  color: var(--ink);
}

.totals-right-panel {
  align-self: start;
}

.totals-lines {
  display: grid;
  gap: 8px;
}

.totals-line {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(170px, auto);
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

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

.totals-line.total {
  padding-top: 10px;
  font-size: 16px;
}

.totals-line-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 8px;
}

.totals-line input,
.totals-line select {
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  padding: 7px 10px;
  background: #ffffff;
  color: var(--ink);
}

.totals-amount-input {
  max-width: 170px;
  justify-self: end;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding-top: 8px;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.34);
}

.summary-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.summary-value {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 800;
}

.preview-company {
  font-size: 17px;
  font-weight: 900;
  color: var(--ink);
  margin-bottom: 4px;
}

.document-company-header-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.document-company-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.document-company-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 3px;
  flex-shrink: 0;
}

.document-company-subtitle {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.preview-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
}

.preview-meta-grid div {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.preview-meta-grid strong {
  color: var(--ink);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.preview-section {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.54);
}

.preview-section strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.preview-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.preview-footer {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.selector-modal,
.company-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 40;
}

.company-modal-auth {
  background:
    radial-gradient(circle at 12% 16%, rgba(24, 82, 137, 0.16), transparent 20%),
    radial-gradient(circle at 76% 18%, rgba(22, 121, 101, 0.1), transparent 16%),
    radial-gradient(circle at 88% 82%, rgba(17, 46, 88, 0.09), transparent 20%),
    linear-gradient(135deg, #f4f7fb 0%, #e9eef5 52%, #eef3f8 100%);
  padding: 20px;
}

.selector-dialog,
.company-dialog {
  width: min(1000px, 96vw);
  max-height: 92vh;
  overflow: auto;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 24px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.24);
}

.company-dialog {
  width: min(1120px, 96vw);
}

.company-dialog-auth {
  width: min(820px, 92vw);
  max-height: calc(100vh - 40px);
  background: #ffffff;
  overflow: hidden;
}

.create-company-dialog {
  width: min(720px, 96vw);
}

.selector-head,
.company-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--header-grad);
}

.selector-body,
.company-body {
  padding: 14px;
}

.selector-list,
.company-list {
  display: grid;
  gap: 8px;
}

.company-stack {
  display: grid;
  gap: 14px;
}

.selector-card,
.company-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.64);
  cursor: pointer;
}

.company-card .panel-title {
  font-size: 16px;
}

.selector-card:hover,
.company-card:hover,
.selector-card.active,
.company-card.active {
  border-color: #6fa58f;
  background: rgba(21, 111, 82, 0.08);
}

.selector-meta,
.company-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.company-selected {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.7);
}

.company-selected-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.auth-shell {
  padding: 18px 18px 18px;
}

.auth-page-shell {
  display: grid;
  gap: 10px;
}

.auth-brand-row {
  display: flex;
  justify-content: center;
}

.auth-logo-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-logo-mark {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #17335f 0%, #1f8f78 100%);
  color: #ffffff;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 18px 38px rgba(23, 51, 95, 0.22);
}

.auth-logo-title {
  font-size: 27px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.auth-logo-copy {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.auth-stage {
  display: grid;
  grid-template-columns: minmax(250px, 0.68fr) minmax(360px, 1fr);
  border-radius: 20px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 26px 60px rgba(15, 23, 42, 0.14);
}

.auth-showcase {
  position: relative;
  min-height: 400px;
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.06), transparent 28%),
    linear-gradient(180deg, #12213a 0%, #18314f 48%, #1b4561 100%);
  border-right: 1px solid rgba(15, 23, 42, 0.08);
}

.auth-showcase::before,
.auth-showcase::after {
  content: "";
  position: absolute;
  border-radius: 22px;
  transform: rotate(38deg);
  background: rgba(255, 255, 255, 0.08);
}

.auth-showcase::before {
  width: 160px;
  height: 160px;
  left: -58px;
  bottom: 36px;
}

.auth-showcase::after {
  width: 152px;
  height: 152px;
  right: -38px;
  top: 24px;
}

.auth-showcase-content::before {
  content: "";
  position: absolute;
  inset: 10px 10px auto auto;
  width: 144px;
  height: 144px;
  border-radius: 30px;
  transform: rotate(42deg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03));
}

.auth-showcase-content::after {
  content: "";
  position: absolute;
  left: -12px;
  bottom: -28px;
  width: 146px;
  height: 146px;
  border-radius: 34px;
  transform: rotate(40deg);
  background: rgba(255, 255, 255, 0.06);
}

.auth-showcase-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 13, 22, 0.04) 0%, rgba(8, 13, 22, 0.34) 100%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03), transparent 38%),
    radial-gradient(circle at 28% 78%, rgba(89, 168, 143, 0.12), transparent 22%);
}

.auth-showcase-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  padding: 22px 22px;
  color: #f4f8ff;
}

.auth-visual-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f4f8ff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-visual-title {
  margin-top: 14px;
  font-size: 23px;
  line-height: 1.14;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.auth-visual-copy {
  margin-top: 12px;
  max-width: 272px;
  color: rgba(244, 248, 255, 0.78);
  font-size: 13px;
  line-height: 1.6;
}

.auth-visual-points {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-signin-panel {
  display: grid;
  gap: 12px;
  padding: 20px 20px 18px;
}

.auth-form-head {
  display: grid;
  gap: 8px;
}

.auth-form-title {
  font-size: 22px;
  line-height: 1.08;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.auth-form-copy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  max-width: 420px;
}

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

.auth-selector-block {
  display: grid;
  gap: 12px;
}

.auth-selector-block input,
.auth-credentials-grid input {
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.auth-selector-block input:focus,
.auth-credentials-grid input:focus {
  outline: none;
  border-color: rgba(29, 78, 216, 0.38);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.08);
}

.branding-upload-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
}

.branding-preview-image {
  display: block;
  max-width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: #ffffff;
}

.branding-preview-logo {
  max-height: 110px;
  object-fit: contain;
  padding: 8px;
}

.branding-preview-signature {
  max-height: 88px;
  object-fit: contain;
  padding: 8px;
}

.branding-empty-state {
  min-height: 76px;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px dashed rgba(15, 23, 42, 0.16);
  border-radius: 12px;
  background: rgba(244, 247, 251, 0.88);
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.branding-upload-button {
  position: relative;
  overflow: hidden;
}

.document-signature-image-wrap {
  min-height: 52px;
  display: flex;
  align-items: flex-end;
}

.document-signature-image {
  max-width: 140px;
  max-height: 50px;
  object-fit: contain;
}

.auth-section-label {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5f718d;
}

.auth-company-list {
  display: grid;
  gap: 8px;
  max-height: 126px;
  overflow: auto;
  padding-right: 4px;
}

.auth-company-card {
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  padding: 9px 12px;
  background: #fbfcfe;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
}

.auth-company-card:hover,
.auth-company-card.active {
  border-color: rgba(29, 78, 216, 0.34);
  background: linear-gradient(180deg, rgba(232, 242, 255, 0.96), rgba(242, 247, 255, 0.96));
  box-shadow: 0 12px 20px rgba(29, 78, 216, 0.1);
}

.auth-company-card.active {
  border-width: 1.5px;
}

.auth-credentials-grid {
  display: grid;
  gap: 2px;
}

.auth-credentials-grid .field label {
  color: #5f718d;
}

.auth-credentials-grid .field {
  gap: 4px;
}

.auth-foot-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-primary-action {
  min-width: 140px;
  justify-content: center;
}

.auth-link-button {
  border-color: transparent;
  background: transparent;
  color: #d14d34;
  box-shadow: none;
}

.auth-setup-button {
  color: #5f718d;
}

.auth-link-button:hover {
  background: rgba(209, 77, 52, 0.08);
}

.auth-legal-copy {
  margin-top: 2px;
  color: #8191ab;
  font-size: 12px;
}

.inline-banner {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
}

.inline-banner.info {
  background: rgba(29, 78, 216, 0.08);
  color: var(--accent);
}

.inline-banner.error {
  background: rgba(185, 28, 28, 0.1);
  color: var(--danger);
}

.empty-state {
  padding: 14px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.04);
  color: var(--muted);
}

@media (max-width: 1220px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

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

  .grid-4,
  .grid-3,
  .grid-2,
  .entry-layout,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .auth-stage {
    grid-template-columns: 1fr;
  }

  .auth-showcase {
    min-height: 220px;
  }
}
