:root {
  --nav-bg: #14213D;
  --nav-fg: #FFFFFF;
  --primary: #FCA311;
  --theme-navbar-bg: var(--nav-bg);
  --theme-primary: var(--primary);
  --theme-primary-contrast: #14213D;
  --theme-primary-soft: rgba(252, 163, 17, 0.16);
  --theme-nav-logo-height: 34px;
  --section-gap: 1rem;
  --flash-toast-top: 72px;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  background: #f6f8fb;
  color: #1f2a44;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background-color: var(--nav-bg);
  color: var(--primary);
  border-bottom: 2px solid rgba(15, 23, 42, 0.16);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.brand:visited,
.brand:hover,
.brand:focus-visible,
.brand:active {
  color: var(--primary);
  text-decoration: none;
}

.brand__logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  outline: none !important;
  border-radius: 0 !important;
  line-height: 0;
}

.brand__logo {
  display: block;
  height: var(--theme-nav-logo-height);
  width: auto;
  max-height: 80px;
  object-fit: contain;
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  outline: none !important;
  border-radius: 0 !important;
}

.brand__text {
  font-weight: 600;
  white-space: nowrap;
}

.site-header__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0.35rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.site-nav a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  padding: 0.2rem 0.62rem;
  border: 1px solid transparent;
  border-radius: 999px;
  opacity: 0.95;
}

.site-nav a:hover,
.site-nav a:focus {
  text-decoration: underline;
  opacity: 0.82;
}

.site-nav a.is-active {
  background: transparent;
  border: 1px solid var(--primary);
  border-radius: 999px;
  color: var(--primary);
  text-decoration: none;
  opacity: 1;
}

.site-auth {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.site-auth__badge {
  font-size: 0.8rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  color: var(--primary);
  background: transparent;
  opacity: 0.86;
}

.site-auth__logout {
  margin: 0;
}

.site-auth__link {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 0.86rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  opacity: 0.95;
}

.site-auth__link:hover,
.site-auth__link:focus-visible {
  color: var(--primary);
  opacity: 0.82;
}

.dev-mode-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.14rem 0.46rem;
  border-radius: 999px;
  border: 1px solid var(--primary);
  background: var(--theme-primary-soft);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.mode-indicator {
  display: inline-flex;
  align-items: center;
  padding: 0.14rem 0.46rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.mode-indicator--platform {
  border: 1px solid #fca311;
  background: rgba(252, 163, 17, 0.2);
  color: #fca311;
}

.mode-indicator--tenant {
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.container {
  width: 100%;
  box-sizing: border-box;
  margin: 1.25rem auto;
  padding: 1rem 16px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(31, 42, 68, 0.1);
}

@media (min-width: 768px) {
  .container {
    padding: 1.5rem 20px;
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: 1180px;
    padding: 1.75rem 24px;
  }
}

@media (min-width: 1280px) {
  .container {
    max-width: 1400px;
    padding: 2rem 24px;
  }
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ticket-edit-header {
  align-items: flex-start;
}

.page-header .actions {
  margin-left: auto;
  justify-content: flex-end;
}

.page-header form {
  margin: 0;
}

.tickets-list-header {
  margin-bottom: 0;
}

.tickets-list-filters {
  row-gap: 0.85rem;
}

.tickets-list-toggle-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-self: end;
  gap: 0.35rem 0.9rem;
}

.tickets-list-toggle-group .field.checkbox {
  margin: 0;
}

.tickets-list-toggle-group .field.checkbox label {
  white-space: nowrap;
}

.muted {
  color: #6b7280;
  margin: 0.25rem 0 0;
  opacity: 0.55;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  box-sizing: border-box;
  height: 36px;
  padding: 0.45rem 0.8rem;
  font-size: 0.92rem;
  line-height: 1.2;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #f3f4f6;
  color: #111827;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  font: inherit;
  appearance: none;
}

.btn--primary {
  background-color: var(--primary);
  color: var(--theme-primary-contrast);
  border-color: var(--primary);
  font-weight: 600;
}

@media (max-width: 980px) {
  .site-header {
    padding: 0.85rem 1rem;
  }

  .site-header__right {
    width: 100%;
    align-items: flex-start;
  }

  .site-nav {
    width: 100%;
  }

  .site-auth {
    width: 100%;
    justify-content: flex-start;
  }
}

.btn--secondary {
  background: #e5e7eb;
  color: #111827;
  border-color: #d1d5db;
}

.btn--danger {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: #374151;
}

.btn--sm {
  height: 30px;
  padding: 0.25rem 0.6rem;
  font-size: 0.84rem;
}

.btn:disabled,
.btn[disabled],
a.btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn:focus-visible {
  outline: 2px solid #1f2937;
  outline-offset: 2px;
}


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

.filters.filters-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.filters.filters-inline .field {
  min-width: 180px;
}

.field label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  color: #4b5563;
}

.help-inline {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 0.3rem;
  vertical-align: text-top;
  z-index: 1;
}

.help-icon {
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  font: inherit;
  width: 1rem;
  height: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #4b5563;
  font-size: 0.7rem;
  line-height: 1;
  font-weight: 700;
  cursor: help;
}

.help-icon:focus-visible {
  outline: 2px solid #1f2937;
  outline-offset: 2px;
}

.help-tooltip {
  position: absolute;
  bottom: calc(100% + 0.35rem);
  left: 50%;
  transform: translateX(-50%);
  max-width: 260px;
  width: max-content;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  font-size: 0.78rem;
  line-height: 1.3;
  text-align: left;
  white-space: normal;
  overflow-wrap: break-word;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.2);
  z-index: 1400;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.help-inline:hover,
.help-inline:focus-within {
  z-index: 1401;
}

.help-inline:hover .help-tooltip,
.help-icon:focus-visible + .help-tooltip {
  opacity: 1;
  visibility: visible;
}

body.js-help-tooltips .help-tooltip {
  display: none;
}

.help-tooltip-layer {
  position: fixed;
  left: 0;
  top: 0;
  max-width: min(320px, calc(100vw - 16px));
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  font-size: 0.78rem;
  line-height: 1.3;
  text-align: left;
  white-space: normal;
  overflow-wrap: break-word;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.2);
  z-index: 12000;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(0);
  transition: opacity 120ms ease;
}

.help-tooltip-layer.is-visible {
  opacity: 1;
  visibility: visible;
}

.field input {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  box-sizing: border-box;
}

.field input[type="checkbox"] {
  width: auto;
  padding: 0;
}

.field input.account-code {
  text-transform: uppercase;
}

.input-prefix {
  position: relative;
}

.input-prefix__symbol {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  pointer-events: none;
  font-size: 0.95rem;
}

.field input.input-with-prefix {
  padding-left: 1.7rem;
}

.actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.auth-form .actions {
  margin-top: 0.35rem;
}

.filters .actions {
  align-self: end;
  align-items: flex-end;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.print-actions {
  display: grid;
  gap: 0.35rem;
  width: max-content;
  max-width: 100%;
}

.print-actions__form {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  position: relative;
  flex-wrap: wrap;
}

.ticket-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.ticket-header-actions__primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  width: max-content;
  max-width: 100%;
}

.ticket-header-actions__primary > * {
  flex: 0 0 auto;
}

.ticket-print-status-inline {
  width: min(640px, 100%);
  padding: 0.35rem 0.5rem;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f0fdf4;
  color: #14532d;
  font-size: 0.85rem;
}

.ticket-print-status-inline code {
  font-size: 0.82rem;
  background: rgba(15, 23, 42, 0.08);
  padding: 0 0.2rem;
  border-radius: 4px;
}

.ticket-print-availability-hint {
  margin: 0;
  width: 100%;
  text-align: right;
}

.ticket-print-receipt-link {
  width: min(640px, 100%);
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem;
}

@media (max-width: 640px) {
  .print-actions {
    width: 100%;
  }

  .print-actions__form {
    width: 100%;
    flex-wrap: wrap;
  }

  .print-actions__form > .btn {
    flex: 1 1 auto;
  }

  .ticket-header-actions {
    width: 100%;
    align-items: stretch;
  }

  .ticket-header-actions__primary {
    width: 100%;
    justify-content: flex-start;
  }

  .ticket-print-availability-hint {
    text-align: left;
  }

  .ticket-print-receipt-link {
    width: 100%;
    justify-content: flex-start;
  }
}

.tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.75rem 0;
}

.tabs .btn {
  height: 34px;
  padding: 0.4rem 0.75rem;
  background: #f3f4f6;
  border-color: #d1d5db;
}

.tabs .btn.is-active {
  background: #111827;
  color: #ffffff;
  border-color: #111827;
  font-weight: 600;
}

.printing-overview-note {
  margin: 0.75rem 0 1rem;
  border-color: #d6dde7;
  background: #f8fafc;
}

.printing-overview-note .frame-header {
  background: #edf2f7;
  border-bottom-color: #d6dde7;
  color: #1f2937;
}

.printing-overview-note .frame-body {
  background: #f8fafc;
}

.printing-overview-note__title {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}

.printing-overview-note__title .help-inline {
  margin-left: 0;
}

.printing-overview-note__body {
  padding: 0.75rem 1rem;
}

.printing-overview-note .notice {
  margin: 0 0 0.5rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.84rem;
}

.printing-overview__list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
}

.printing-overview__list li {
  overflow-wrap: anywhere;
}

.template-preview-ticket-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.template-preview-ticket-row input {
  width: auto;
  flex: 1 1 320px;
  min-width: 180px;
}

.template-preview-ticket-row .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.template-vars-disclosure {
  border-color: #d6dde7;
  background: #f8fafc;
}

.template-vars-disclosure .frame-header {
  background: #edf2f7;
  border-bottom-color: #d6dde7;
  color: #1f2937;
}

.template-vars-disclosure .frame-body {
  display: grid;
  gap: 0.9rem;
  background: #f8fafc;
}

.template-vars-section {
  display: grid;
  gap: 0.3rem;
}

.template-vars-section h2 {
  margin: 0;
  font-size: 0.92rem;
}

.template-vars-section p {
  margin: 0;
}

.template-vars-list {
  margin: 0;
  padding-left: 1rem;
}

.template-vars-list li {
  margin: 0.2rem 0;
}

.template-vars-code {
  margin: 0;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.4;
  overflow-x: auto;
  white-space: pre-wrap;
}


.table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
}

.table-wrap.list-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.65rem;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.data-table .status-col {
  min-width: 120px;
}

.data-table td.type-col {
  min-width: 90px;
  color: #1f2a44;
  font-size: 0.9rem;
}

.data-table td.type-col.type-col--system {
  color: #6b7280;
}

.data-table .weights-col {
  min-width: 140px;
}

.list-table {
  table-layout: auto;
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.list-table th,
.list-table td {
  white-space: nowrap;
  vertical-align: middle;
}

.lookup-list-table .lookup-col-type {
  width: 140px;
}

.lookup-list-table .lookup-col-status {
  width: 130px;
}

.lookup-list-table .lookup-col-actions {
  width: 220px;
}

.lookup-list-table .lookup-col-name {
  width: 280px;
}

.lookup-list-table {
  table-layout: fixed;
}

.lookup-list-table th.status-col,
.lookup-list-table td.status-col {
  width: 130px;
  min-width: 130px;
}

.lookup-list-table th.actions-col,
.lookup-list-table td.actions-col {
  width: 220px;
  min-width: 220px;
}

.lookup-list-table tr.lookup-row--system-default td {
  background: #f3f4f6;
  color: #374151;
}

.printing-templates-table tr.lookup-row--system-default td {
  background: #f3f4f6;
  color: #374151;
}

.table-wrap.list-table-wrap.customers-table-wrap {
  overflow: visible;
}

.customers-table {
  table-layout: auto;
  width: 100%;
  min-width: 0;
}

.customers-table th.customer-account-col,
.customers-table td.customer-account-col {
  width: 160px;
}

.customers-table th.customer-name-col,
.customers-table td.customer-name-col {
  width: 240px;
}

.customers-table th.terms-col,
.customers-table td.terms-col {
  width: 96px;
}

.customers-table th.pricing-col,
.customers-table td.pricing-col {
  width: 72px;
  text-align: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.customers-table th.flags-col,
.customers-table td.flags-col {
  width: auto;
  padding-left: 0.65rem;
}

.customers-table td.flags-col {
  white-space: normal;
}

.customers-table .customer-terms {
  display: inline-block;
  color: #6b7280;
  font-size: 0.84rem;
  font-weight: 500;
}

.customers-table .customer-terms--empty {
  font-size: 0.95rem;
  font-weight: 600;
}

.customers-table .pricing-indicator {
  display: inline-flex;
  width: 1rem;
  height: 1rem;
  align-items: center;
  justify-content: center;
  color: #166534;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
}

.customers-table td.flags-col .status-stack {
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tickets-table th,
.tickets-table td {
  white-space: nowrap;
}

.tickets-table .status-col,
.tickets-table .weights-col {
  min-width: 0;
}

.tickets-table th.status-col,
.tickets-table td.status-col {
  width: 112px;
  min-width: 112px;
}

.tickets-table td.status-col {
  overflow: visible;
}

.tickets-table th.type-col,
.tickets-table td.type-col {
  width: 90px;
  min-width: 90px;
}

.products-table {
  table-layout: fixed;
  width: 100%;
}

.products-table th,
.products-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.products-table .products-col-code {
  width: 180px;
}

.products-table .products-col-description {
  width: 300px;
}

.products-table .products-col-unit {
  width: 140px;
}

.products-table .products-col-unit-price {
  width: 130px;
}

.products-table .products-col-tax-rate {
  width: 110px;
}

.products-table .products-col-actions {
  width: 210px;
}

.products-table td.description-col,
.products-table td.unit-col {
  max-width: 0;
}

.products-table .tax-rate-col {
  min-width: 110px;
  text-align: right;
}

.products-table .unit-price-col {
  min-width: 130px;
  text-align: right;
}

.products-groups-table .products-groups-col-name {
  width: 280px;
}

.products-groups-table {
  table-layout: fixed;
}

.products-groups-table .products-groups-col-nominal {
  width: 140px;
}

.products-groups-table .products-groups-col-count {
  width: 110px;
}

.products-groups-table .products-groups-col-status {
  width: 130px;
}

.products-groups-table .products-groups-col-actions {
  width: 300px;
}

.products-groups-table th.status-col,
.products-groups-table td.status-col {
  width: 130px;
  min-width: 130px;
}

.products-groups-table th.actions-col,
.products-groups-table td.actions-col {
  width: 300px;
  min-width: 300px;
}

.data-row-link {
  cursor: pointer;
}

.data-row-link:hover {
  background: #f9fafb;
}

.numeric-col {
  text-align: right !important;
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums;
}

.num {
  text-align: right !important;
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums;
}

.data-table .actions-col {
  width: 1%;
  white-space: nowrap;
}

.data-table th.actions-col {
  text-align: right;
}

.data-table .actions-col .btn-group {
  justify-content: flex-end;
  gap: 0.35rem;
}

.data-table .actions-col .actions {
  white-space: nowrap;
  flex-wrap: nowrap;
}

.data-table .actions-col .btn {
  height: 30px;
  padding: 0.25rem 0.6rem;
  font-size: 0.84rem;
  flex: 0 0 auto;
}

.printing-destinations-table-wrap {
  overflow-x: visible;
}

.printing-templates-table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}

.printing-templates-table th,
.printing-templates-table td {
  white-space: nowrap;
  vertical-align: middle;
}

.printing-templates-table .templates-col-code {
  width: 24%;
}

.printing-templates-table .templates-col-description {
  width: 28%;
}

.printing-templates-table .templates-col-document-type {
  width: 12%;
}

.printing-templates-table .templates-col-format {
  width: 10%;
}

.printing-templates-table .templates-col-status {
  width: 130px;
}

.printing-templates-table .templates-col-actions {
  width: 220px;
}

.printing-template-code-cell {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.printing-template-code-cell .table-cell-truncate {
  flex: 1 1 auto;
  min-width: 0;
}

.printing-destinations-table-wrap,
.printing-destinations-table-wrap.table-wrap,
.printing-destinations-table-wrap.table-wrap.list-table-wrap {
  overflow: visible;
}

.printing-destinations-table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}

.printing-destinations-table th,
.printing-destinations-table td {
  white-space: nowrap;
  vertical-align: middle;
  padding: 0.65rem;
}

.printing-destinations-table th {
  overflow: visible;
}

.printing-destinations-table th .help-tooltip {
  top: calc(100% + 0.35rem);
  bottom: auto;
}

.printing-destinations-table .destinations-col-default .help-tooltip {
  left: auto;
  right: calc(100% + 0.35rem);
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
}

.printing-destinations-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.printing-destinations-table .destinations-col-name {
  width: 16%;
}

.printing-destinations-table .destinations-col-document-type {
  width: 12%;
}

.printing-destinations-table .destinations-col-default {
  width: 8%;
}

.printing-destinations-table .destinations-col-template {
  width: 20%;
}

.printing-destinations-table .destinations-col-delivery {
  width: 14%;
}

.printing-destinations-table .destinations-col-status {
  width: 8%;
  min-width: 0;
}

.printing-destinations-table .destinations-col-actions {
  width: 22%;
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
}

.printing-destination-name,
.printing-destination-document-type,
.printing-destination-delivery-type {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.printing-destination-name {
  display: inline-block;
  max-width: 100%;
  font-weight: 500;
  line-height: 1.2;
}

.printing-destination-document-type {
  display: inline-block;
  max-width: 100%;
}

.printing-destination-delivery-type {
  display: inline-block;
  max-width: 100%;
  font-size: 0.9rem;
  color: #4b5563;
}

.printing-destination-actions-inline {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  width: 100%;
}

.printing-destination-form .frame-body {
  display: grid;
  gap: 0.75rem;
}

.printing-destination-form .frame-body .hint {
  margin-top: 0.22rem;
  font-size: 0.8rem;
}

.printing-destination-advanced-json {
  margin: 0;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  background: #f9fafb;
}

.printing-destination-advanced-json > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
}

.printing-destination-advanced-json > .field {
  margin-top: 0.55rem;
}

.printing-jobs-table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}

.printing-jobs-table th,
.printing-jobs-table td {
  padding: 0.3rem 0.5rem;
  vertical-align: middle;
  line-height: 1.25;
}

.printing-jobs-table .jobs-col-id {
  width: 5%;
}

.printing-jobs-table .jobs-col-ticket {
  width: 11%;
}

.printing-jobs-table .jobs-col-doc-type {
  width: 12%;
}

.printing-jobs-table .jobs-col-template {
  width: 9%;
}

.printing-jobs-table .jobs-col-target {
  width: 15%;
}

.printing-jobs-table .jobs-col-status {
  width: 8%;
}

.printing-jobs-table .jobs-col-when {
  width: 10%;
  text-align: left;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.printing-jobs-table .jobs-col-error {
  width: 17%;
}

.printing-job-code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 0.88rem;
  color: #6b7280;
}

.printing-jobs-table .jobs-col-doc-type .table-cell-truncate {
  max-width: 10rem;
}

.printing-jobs-table .jobs-col-template,
.printing-jobs-table .jobs-col-target {
  white-space: nowrap;
}

.printing-jobs-table .jobs-col-template .table-cell-truncate {
  max-width: 8rem;
}

.printing-jobs-table .jobs-col-target .table-cell-truncate {
  max-width: 12rem;
}

.printing-jobs-table td.jobs-col-ticket {
  font-weight: 600;
  color: #111827;
}

.printing-jobs-table .status-pill {
  padding: 2px 6px;
  font-size: 0.78rem;
  border-radius: 6px;
  border: 0;
}

.printing-jobs-table tbody tr:nth-child(even) {
  background: #fafafa;
}

.printing-jobs-table tbody tr:hover {
  background: #f3f4f6;
}

.printing-jobs-table tbody tr.printing-job-row--failed {
  background: #fff6f6;
}

.printing-jobs-table tbody tr.printing-job-row--failed:hover {
  background: #fee2e2;
}

.printing-job-error {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  color: #8b1c1c;
}

.printing-job-error-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: #fca5a5;
  color: #7f1d1d;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  flex: 0 0 auto;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.14rem 0.45rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.1;
  white-space: nowrap;
}

.status-pill.status-open {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.status-pill.status-complete {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #166534;
}

.status-pill.status-paid {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #166534;
}

.status-pill.status-draft {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.status-pill.status-void {
  background: #f3f4f6;
  border-color: #e5e7eb;
  color: #6b7280;
}

.status-pill.status-info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.status-stack {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  align-items: center;
}

.ticket-kind-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.06rem 0.36rem;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #374151;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ticket-kind-badge--sale {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.ticket-kind-badge--waste {
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}

.ticket-kind-badge--goods {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.data-table th {
  background: #f3f4f6;
  font-weight: 600;
}

.truncate {
  display: inline-block;
  max-width: 16rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.truncate--sm {
  max-width: 8rem;
}

.truncate--md {
  max-width: 14rem;
}

.truncate--lg {
  max-width: 24rem;
}

.table-cell-truncate {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.truncate-col {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  display: inline-flex;
  align-items: center;
}

.badge--muted {
  background: #eee;
  color: #666;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 0.35rem;
  line-height: 1.2;
}

.tenant-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.14rem 0.52rem;
}

.tenant-status-badge--active {
  color: #166534;
  background: #dcfce7;
  border: 1px solid #86efac;
}

.tenant-status-badge--disabled {
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fca5a5;
}

.status-void {
  background: #f3f4f6;
  border-color: #e5e7eb;
  color: #6b7280;
}

.status-text {
  font-weight: 600;
}

.status-text.status-open {
  color: #92400e;
}

.status-text.status-complete {
  color: #166534;
}

.status-text.status-paid {
  color: #166534;
}

.status-text.status-draft {
  color: #92400e;
}

.status-text.status-void {
  color: #6b7280;
}

.empty {
  text-align: left;
  white-space: normal;
  color: #6b7280;
  padding: 1.25rem;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.pager-links a {
  margin-left: 0.75rem;
  color: #14213d;
  text-decoration: none;
}

.pager-links a:hover,
.pager-links a:focus {
  text-decoration: underline;
}

.link-muted {
  color: #9ca3af;
}

.link-muted:hover,
.link-muted:focus {
  color: #6b7280;
}

.alert {
  background: #fff3cd;
  border: 1px solid #f5c2c7;
  color: #664d03;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

/* Warning banner (non-blocking) */
.alert.alert--warning {
  border-color: #f0c36d;
  background: #fff6d6;
  color: #3b2f00;
}

.alert.alert--danger {
  border-color: #f5c2c7;
  background: #fde8e8;
  color: #7f1d1d;
}

.alert.alert--success {
  border-color: #86efac;
  background: #dcfce7;
  color: #14532d;
}

.alert ul {
  margin: 0;
  padding-left: 1.25rem;
}

.flash-toasts {
  position: fixed;
  top: var(--flash-toast-top);
  right: 16px;
  z-index: 9999;
  width: calc(100vw - 32px);
  max-width: 520px;
  display: grid;
  gap: 0.5rem;
  pointer-events: none;
}

.flash-toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.6rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #1f2937;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.15);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 250ms ease, transform 250ms ease;
}

.flash-toast--success {
  border-color: #bbf7d0;
}

.flash-toast--error {
  border-color: #f5c2c7;
}

.flash-toast.is-hiding {
  opacity: 0;
  transform: translateY(-6px);
}

.flash-toast__content ul {
  margin: 0;
  padding-left: 1.15rem;
}

.flash-toast__close {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #374151;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.flash-toast__close:hover {
  background: #f3f4f6;
}

.flash-toast__close:focus-visible {
  outline: 2px solid #1f2937;
  outline-offset: 2px;
}

.overwrite-alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: nowrap;
  margin-top: 0.5rem;
}

.overwrite-actions {
  display: flex;
  gap: 0.5rem;
}

.overwrite-alert .btn {
  white-space: nowrap;
}

.ticket-form {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}

.card {
  padding: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
  overflow: visible;
}

.page-header + .card {
  margin-top: var(--section-gap);
}

.card + .card {
  margin-top: var(--section-gap);
}

.card + .frame,
.frame + .card {
  margin-top: var(--section-gap);
}

.page-header + .ticket-form {
  margin-top: var(--section-gap);
}

.ticket-form .card + .card {
  margin-top: 0;
}

.ticket-form .frame + .frame {
  margin-top: 0;
}

.ticket-form .card,
.ticket-form .frame {
  overflow: visible;
}

.card h2 {
  margin: -1rem -1rem 1rem -1rem;
  padding: 0.6rem 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  background: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
  border-radius: 10px 10px 0 0;
}

.card-header {
  margin: -1rem -1rem 1rem -1rem;
  padding: 0.6rem 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  background: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
  border-radius: 10px 10px 0 0;
}

.card-body {
  display: block;
}

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: #6b7280;
}

.ticket-meta a {
  color: inherit;
  text-decoration: underline;
}

.ticket-credit-banner {
  margin-bottom: 1rem;
}

.ticket-credit-banner__values {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin-top: 0.35rem;
  font-size: 0.9rem;
}

.ticket-credit-banner__values > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ticket-credit-banner__label {
  font-weight: 600;
}

.frame {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
  overflow: visible;
}

.stacked-frames {
  display: grid;
  gap: 1rem;
}

.help-template-frames > .frame + .frame {
  margin-top: 0.15rem;
}

.frame-header {
  background: #f3f4f6;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  font-weight: 600;
  border-radius: 10px 10px 0 0;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.ticket-form fieldset {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}

.frame-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

details.frame:not([open]) .frame-header {
  border-bottom: none;
  border-radius: 10px;
}

.frame-body {
  padding: 1rem;
}

.template-vars-table {
  table-layout: fixed;
  width: 100%;
  min-width: 980px;
}

.template-vars-table th,
.template-vars-table td {
  white-space: normal;
  vertical-align: top;
}

.template-vars-table th {
  text-align: left;
}

.template-vars-table .template-vars-col-variable {
  width: 28%;
}

.template-vars-table .template-vars-col-description {
  width: 38%;
}

.template-vars-table .template-vars-col-example {
  width: 34%;
}

.template-vars-table code {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.frame.compact .frame-header {
  padding: 0.45rem 1rem;
}

.frame.compact .frame-body {
  padding: 0.75rem 1rem;
}

.ticket-void-frame {
  margin-top: var(--section-gap);
  border-color: #f5c2c7;
  background: #fff8f8;
}

.po-inline-field {
  scroll-margin-top: 1rem;
}

.po-inline-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}

.po-inline-row .readonly {
  flex: 1 1 240px;
}

.po-inline-details {
  margin: 0;
}

.po-inline-details > summary {
  list-style: none;
}

.po-inline-details > summary::-webkit-details-marker {
  display: none;
}

.po-inline-editor {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.5rem;
}

.ticket-void-frame .frame-header {
  background: #fde8e8;
  border-bottom-color: #f5c2c7;
  color: #7f1d1d;
}

.ticket-void-frame .frame-body {
  background: #fff8f8;
}

.ticket-void-actions {
  margin-top: 0.75rem;
}

.compliance-frame {
  position: relative;
  overflow: visible;
  z-index: 12;
}

.compliance-frame .frame-body {
  overflow: visible;
}

.product-main-card {
  position: relative;
  overflow: visible;
  z-index: 8;
}

.frame-weights .frame-header h2 {
  font-weight: 700;
}

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

.field select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  box-sizing: border-box;
}

.field textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  box-sizing: border-box;
  font: inherit;
  line-height: 1.35;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-start;
}

.checkbox label {
  margin: 0;
  display: inline;
}

.checkbox .help-inline {
  margin-left: 0.2rem;
}

.help {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: #6b7280;
}

.readonly {
  padding: 0.6rem 0.7rem;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #f3f4f6;
  color: #374151;
}

.field-secondary label,
.label-muted {
  color: #6b7280;
}

.readonly-secondary,
.field input.input-secondary {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #4b5563;
}

.readonly-muted,
.field input.input-muted {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #6b7280;
}

.estimate-value {
  font-size: 0.9rem;
  color: #6b7280;
}

.tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
  font-size: 0.8rem;
}

.ewc-search-field {
  position: relative;
  z-index: 40;
}

.ewc-search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.25rem);
  z-index: 1200;
  max-height: 240px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(31, 42, 68, 0.12);
}

.ewc-search-results[hidden] {
  display: none;
}

.ewc-search-results__item {
  display: block;
  width: 100%;
  border: 0;
  background: #ffffff;
  text-align: left;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  color: #1f2a44;
  font: inherit;
}

.ewc-search-results__item:hover,
.ewc-search-results__item:focus {
  background: #f3f4f6;
  outline: none;
}

.ewc-search-results__empty {
  padding: 0.55rem 0.7rem;
  color: #6b7280;
  font-size: 0.85rem;
}

.audit {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  color: #4b5563;
}

.actions form {
  display: inline;
}

.lookup-actions form {
  display: inline-flex;
  margin: 0;
}


.notice {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  color: #374151;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.wip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.4rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #fde68a;
  border: 1px solid #f59e0b;
  color: #92400e;
}

.hint {
  font-size: 0.8rem;
  color: #777;
  margin-top: 0.25rem;
}

.unsaved-changes-indicator {
  margin-top: 0.35rem;
  color: #92400e;
}

.participants .field {
  margin-bottom: 0.4rem;
}

.participants #walk-in-sale-field {
  /* Keep walk-in toggle in a stable column when sibling fields are hidden. */
  grid-column: -2 / -1;
}

.plate-input {
  text-transform: uppercase;
  background: #f5e49b;
  border: 1px solid #c7a63a;
  color: #1f2a44;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: left;
  padding: 0.6rem 0.7rem;
  font-size: 1rem;
  border-radius: 6px;
  width: 100%;
}

.frame-weights .field input {
  padding: 0.7rem 0.8rem;
  font-size: 1rem;
}

.frame summary.frame-header {
  cursor: pointer;
}

details > summary:focus-visible {
  outline: 2px solid #1f2937;
  outline-offset: 2px;
}

.vehicle-suggestion {
  margin-top: 0.75rem;
}

.suggestion-note {
  border: 1px solid #e5e7eb;
  background: transparent;
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

.suggestion-actions {
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.suggestion-status {
  margin-bottom: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.suggestion-status ul {
  margin: 0;
  padding-left: 1.25rem;
}

.suggestion-status.is-error {
  background: #fee2e2;
  color: #991b1b;
}

.suggestion-status.is-warning {
  background: #f9fafb;
  color: #6b7280;
}


.weights-actions {
  margin-top: 1rem;
}


.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

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

.vehicle-tares-add-form + .table-wrap {
  margin-top: var(--section-gap);
}

.invoice-generate-actions {
  margin-top: var(--section-gap);
  margin-bottom: var(--section-gap);
}

.invoice-frequency-status {
  margin: 0.5rem 0 0;
  padding: 0.45rem 0.6rem;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 0.88rem;
}

.quick-ranges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}

.quick-ranges__label {
  font-size: 0.82rem;
  color: #4b5563;
  margin-right: 0.2rem;
}

.quick-range-btn {
  height: 30px;
  padding: 0.3rem 0.65rem;
  font-size: 0.82rem;
  border-radius: 999px;
}

.invoice-action-form {
  gap: 0.75rem;
}

.invoice-action-form .btn {
  justify-self: start;
}

.invoice-edit-header {
  margin-bottom: 1.5rem;
}

.invoice-back-link {
  margin-top: -0.9rem;
  margin-bottom: 1rem;
}

.invoice-header-actions {
  align-items: flex-end;
}

.invoice-header-actions .ticket-header-actions__primary {
  align-items: center;
  justify-content: flex-end;
}

.invoice-detail .card {
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 2px rgba(20, 33, 61, 0.08);
}

.invoice-detail .card + .card {
  margin-top: 0;
}

.invoice-detail > .card:last-child {
  margin-bottom: 0;
}

.invoice-list-section {
  margin-top: var(--section-gap);
}

.invoice-billing-address {
  margin-top: 0.35rem;
}

.invoice-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem 2rem;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.summary-label {
  font-size: 0.85rem;
  color: #4b5563;
}

.summary-value {
  color: #111827;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.platform-tenants-summary-card {
  margin-bottom: 1.5rem;
}

.platform-tenants-summary-card .invoice-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.platform-tenants-actions {
  flex-wrap: wrap;
}

.platform-tenants-row-note {
  font-size: 0.78rem;
}

.platform-tenants-table .actions-col {
  min-width: 250px;
}

.platform-tenant-detail-users-copy {
  margin-bottom: 1rem;
}

.tenant-form__error {
  margin: 0.35rem 0 0;
  color: #b91c1c;
  font-size: 0.84rem;
  font-weight: 500;
}

.customer-credit-summary__grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.customer-credit-summary {
  border-color: #cfdbe8;
  background: linear-gradient(180deg, #f9fcff 0%, #f4f9ff 100%);
  box-shadow: inset 0 1px 0 #ffffff;
}

.customer-credit-summary > h2 {
  background: transparent;
  border-bottom: 1px dashed #d4deea;
  color: #1f3b57;
}

.customer-credit-summary + .ticket-form {
  margin-top: var(--section-gap);
}

.customer-credit-summary .summary-label {
  color: #526277;
}

.customer-credit-summary .summary-value {
  font-size: 1.02rem;
}

.customer-credit-summary__value--low {
  color: #92400e;
}

.customer-credit-summary__value--over {
  color: #7f1d1d;
}

.customer-credit-summary__links {
  margin: 0.8rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.account-adjustments-card {
  padding: 0.85rem;
  border-top: 2px solid #dbe3ee;
}

.account-adjustments-card > h2 {
  margin: -0.85rem -0.85rem 0.65rem -0.85rem;
  padding: 0.55rem 0.85rem;
}

.account-adjustments-help {
  margin: 0 0 0.65rem;
}

.account-adjustments-ledger .data-table th,
.account-adjustments-ledger .data-table td {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.account-adjustments-disclosure {
  margin-top: 0.75rem;
}

.account-adjustments-disclosure > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
}

.account-adjustments-disclosure > summary::marker {
  content: "";
}

.account-adjustments-disclosure > summary::-webkit-details-marker {
  display: none;
}

.filters.filters-inline.account-adjustments-form {
  margin-top: 0.75rem;
  margin-bottom: 0;
  align-items: flex-start;
}

.account-adjustments-form .actions {
  align-self: flex-start;
  margin-top: 1.45rem;
}

.filters.filters-inline.account-adjustments-form .field {
  min-width: 225px;
}

.audit-log-filters .field {
  min-width: 170px;
}

.audit-log-filters .field.audit-field-entity-id {
  min-width: 220px;
  flex: 1 1 260px;
}

.audit-log-table {
  table-layout: auto;
  min-width: 920px;
  font-size: 0.88rem;
}

.audit-log-table th,
.audit-log-table td {
  padding: 0.52rem 0.6rem;
  line-height: 1.3;
}

.audit-log-table .audit-col-time {
  width: 165px;
}

.audit-log-table .audit-col-user {
  width: 210px;
}

.audit-log-table .audit-col-action {
  width: 120px;
}

.audit-log-table .audit-col-entity {
  width: 250px;
}

.audit-log-table .audit-col-summary {
  width: 220px;
}

.audit-log-table .audit-col-view {
  width: 56px;
}

.audit-log-table th.audit-col-summary,
.audit-log-table td.audit-col-summary {
  white-space: normal;
}

.audit-log-table th.audit-col-entity,
.audit-log-table td.audit-col-entity {
  white-space: normal;
}

.audit-log-table td.audit-col-summary {
  overflow-wrap: anywhere;
}

.audit-log-table td.audit-col-entity {
  overflow-wrap: anywhere;
}

.audit-log-table td {
  vertical-align: top;
}

.align-right {
  text-align: right;
}

.invoice-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.invoice-status-badge--draft {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.invoice-status-badge--paid {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #166534;
}

.invoice-status-badge--void {
  background: #f3f4f6;
  border-color: #e5e7eb;
  color: #6b7280;
}

.invoice-mark-paid-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem 2rem;
  align-items: start;
}

.invoice-mark-paid-action {
  align-self: end;
}

.invoice-mark-paid-action .btn {
  width: 100%;
}

.invoice-void-card {
  border-color: #f5c2c7;
  background: #fff8f8;
}

.invoice-void-card .card-header {
  background: #fde8e8;
  border-bottom-color: #f5c2c7;
  color: #7f1d1d;
}

.invoice-void-card .card-body {
  background: #fff8f8;
}

.invoice-warning-text {
  margin-bottom: 0.85rem;
  color: #7f1d1d;
  opacity: 0.85;
}

.invoice-void-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 1rem 1.5rem;
}

.invoice-void-actions {
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.invoice-detail .data-table tbody tr:hover {
  background: #f9fafb;
}

.invoice-lines-table,
.invoice-linked-table {
  table-layout: auto;
}

@media (min-width: 901px) {
  .invoice-linked-col-ticket {
    width: 96px;
  }

  .invoice-linked-col-date {
    width: 112px;
  }

  .invoice-linked-col-product {
    width: auto;
  }

  .invoice-linked-col-compliance {
    width: 240px;
  }

  .invoice-linked-col-netqty {
    width: 132px;
  }

  .invoice-linked-col-total {
    width: 112px;
  }

  .invoice-linked-product {
    min-width: 220px;
  }

  .invoice-linked-compliance {
    min-width: 200px;
    max-width: 280px;
  }
}

.invoice-lines-table th,
.invoice-lines-table td,
.invoice-linked-table th,
.invoice-linked-table td {
  vertical-align: top;
  padding: 0.65rem 0.75rem;
}

.invoice-lines-table td,
.invoice-linked-table td {
  white-space: normal;
}

.invoice-lines-table td.align-right,
.invoice-linked-table td.align-right {
  white-space: nowrap;
}

.invoice-lines-table .line-description {
  font-weight: 600;
  word-break: break-word;
}

.invoice-linked-product {
  word-break: break-word;
}

.invoice-linked-compliance {
  word-break: break-word;
  font-size: 0.92em;
  line-height: 1.2;
}

.invoice-linked-compliance__line + .invoice-linked-compliance__line {
  margin-top: 0.2rem;
}

.invoice-linked-compliance__label {
  opacity: 0.75;
}

.invoice-lines-table tfoot td {
  background: #f9fafb;
  border-bottom: none;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.invoice-total-label {
  text-align: right;
  font-weight: 600;
}

.invoice-total-value {
  font-weight: 700;
}

.invoice-void-disclosure > summary,
.ticket-void-disclosure > summary {
  list-style: none;
}

.invoice-void-disclosure:not([open]) {
  padding-bottom: 0;
}

.invoice-void-disclosure:not([open]) > .card-header {
  margin-bottom: 0;
  border-bottom: none;
  border-radius: 10px;
}

.invoice-void-disclosure > summary::-webkit-details-marker,
.ticket-void-disclosure > summary::-webkit-details-marker {
  display: none;
}

.invoice-void-disclosure > summary,
.ticket-void-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.invoice-void-disclosure > summary::after,
.ticket-void-disclosure > summary::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  margin-left: 0.4rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 120ms ease;
  flex-shrink: 0;
}

.invoice-void-disclosure[open] > summary::after,
.ticket-void-disclosure[open] > summary::after {
  transform: rotate(45deg);
}

.ticket-link-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f3f4f6;
  color: #14213d;
  text-decoration: none;
  font-weight: 500;
}

.tickets-table .ticket-link-badge {
  padding: 0.05rem 0.4rem;
  font-size: 0.78rem;
  line-height: 1;
}

@media (max-width: 900px) {
  :root {
    --flash-toast-top: 96px;
  }

  .invoice-summary-grid,
  .invoice-mark-paid-grid,
  .invoice-void-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .invoice-mark-paid-action .btn {
    width: auto;
  }

  .invoice-detail .table-wrap {
    overflow-x: visible;
    border: none;
    border-radius: 0;
    background: transparent;
  }

  .invoice-lines-table thead,
  .invoice-linked-table thead {
    display: none;
  }

  .invoice-lines-table tbody,
  .invoice-linked-table tbody {
    display: block;
  }

  .invoice-lines-table tbody tr,
  .invoice-linked-table tbody tr {
    display: block;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
    margin-bottom: 0.75rem;
    padding: 0.35rem 0.75rem;
  }

  .invoice-lines-table tbody td,
  .invoice-linked-table tbody td {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 0.5rem;
    align-items: start;
    border-bottom: 1px solid #f1f5f9;
    padding: 0.45rem 0;
    text-align: left;
    white-space: normal;
  }

  .invoice-lines-table tbody td::before,
  .invoice-linked-table tbody td::before {
    content: attr(data-label);
    font-size: 0.82rem;
    color: #4b5563;
    font-weight: 600;
  }

  .invoice-lines-table tbody td:last-child,
  .invoice-linked-table tbody td:last-child {
    border-bottom: none;
  }

  .invoice-lines-table tbody td.empty,
  .invoice-linked-table tbody td.empty {
    display: block;
    border-bottom: none;
    text-align: center;
    padding: 0.8rem 0;
  }

  .invoice-lines-table tbody td.empty::before,
  .invoice-linked-table tbody td.empty::before {
    content: none;
  }

  .invoice-lines-table tfoot {
    display: block;
    margin-top: 0.25rem;
  }

  .invoice-lines-table tfoot tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    align-items: baseline;
    padding: 0.35rem 0;
    border-bottom: 1px solid #e5e7eb;
  }

  .invoice-lines-table tfoot tr:last-child {
    border-bottom: none;
  }

  .invoice-lines-table tfoot td {
    display: block;
    border-bottom: none;
    padding: 0;
    background: transparent;
  }

  .invoice-lines-table tfoot td:first-child {
    display: none;
  }

  .invoice-total-label {
    text-align: left;
  }

.invoice-total-value {
  text-align: right;
}
}

.admin-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
  align-items: stretch;
}

.admin-hub-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.8rem 0.85rem;
  background: #ffffff;
}

.admin-hub-card h3 {
  margin: 0;
  font-size: 0.98rem;
  color: #1f2a44;
}

.admin-hub-card p {
  margin: 0;
  font-size: 0.88rem;
  color: #4b5563;
  line-height: 1.4;
}

.admin-hub-card .actions {
  margin-top: auto;
}

.admin-hub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  font-size: 0.85rem;
}

.admin-hub-links a {
  color: #1f2a44;
  text-decoration: underline;
}

.admin-env-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.admin-env-panel p {
  margin: 0;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  align-items: stretch;
  gap: 0.9rem;
}

.health-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.health-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.72rem 0.95rem;
}

.health-card .card-header h2 {
  margin: 0;
  font-size: 1rem;
}

.health-card .card-body {
  display: grid;
  gap: 0.35rem;
  align-content: start;
  flex: 1;
  padding: 0.82rem 0.95rem;
}

.health-card .card-body p {
  margin: 0;
  font-size: 0.9rem;
  color: #374151;
}

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

.health-table th,
.health-table td {
  border: 1px solid #d1d5db;
  padding: 0.35rem 0.45rem;
  vertical-align: top;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.health-table th {
  background: #f9fafb;
  text-align: left;
}

.health-table .health-col-doc-type {
  width: 25%;
}

.health-table .health-col-status {
  width: 15%;
  white-space: nowrap;
}

.health-table .health-col-default {
  width: 45%;
}

.health-table .health-col-warnings {
  width: 15%;
}

.health-list {
  margin: 0.35rem 0 0;
  padding-left: 1rem;
}

.health-list li {
  margin: 0.2rem 0;
  font-size: 0.82rem;
}

.health-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
  padding: 0.22rem 0.5rem;
  text-transform: uppercase;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
  white-space: normal;
  word-break: break-word;
}

.health-badge--ok {
  background: #ecfdf3;
  border-color: #86efac;
  color: #166534;
}

.health-badge--warning {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.health-badge--error {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.health-path,
.health-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;
  font-size: 0.84rem;
}

.health-path {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.health-truncate {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.health-copy {
  background: transparent;
  border: none;
  color: #4b5563;
  cursor: pointer;
  font-size: 0.8rem;
  margin-left: 0.35rem;
  padding: 0;
  text-decoration: underline;
}

.health-copy:hover,
.health-copy:focus-visible {
  color: #1f2937;
}

.health-copy.is-copied {
  color: #166534;
  text-decoration: none;
}

.site-footer {
  margin: 0 auto 1rem;
  max-width: 1400px;
  padding: 0 18px;
  text-align: right;
}

.site-footer__build {
  color: #6b7280;
  display: inline-block;
  font-size: 0.74rem;
  letter-spacing: 0.01em;
}

.company-logo-preview-container {
  width: 100%;
  max-width: 360px;
  height: 90px;
  padding: 0.55rem 0.6rem;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
}

.company-logo-preview-image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 70px;
  object-fit: contain;
}

.company-logo-preview-meta {
  margin-top: 0.4rem;
  display: grid;
  gap: 0.2rem;
  color: #6b7280;
  font-size: 0.8rem;
}

.company-logo-preview-meta a {
  width: fit-content;
}

.company-color-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.company-color-row .company-color-picker {
  width: 44px;
  min-width: 44px;
  height: 28px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.company-color-row .company-color-hex {
  width: 120px;
  min-width: 120px;
}

.company-color-error.is-visible {
  color: #b91c1c;
}

.company-logo-preview-meta code {
  overflow-wrap: anywhere;
}

/* Theme cascade guard: keep tenant branding authoritative. */
.site-header {
  background-color: var(--nav-bg) !important;
}

.btn--primary {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}
