html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

@media (min-width: 1400px) {
  .container {
    max-width: 1680px;
  }
}

@media (min-width: 1800px) {
  .container {
    max-width: 1800px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  background: #f7f8fa;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.5rem 0;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(1.75rem, 2.5vw, 2.4rem);
  font-weight: 650;
}

.work-order-actions {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.filters-panel,
.content-section {
  background: #fff;
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.list-summary {
  color: #5b6675;
  margin: 1rem 0 .5rem;
}

.work-orders-table {
  background: #fff;
  border: 1px solid #dfe4ea;
}

.work-orders-table th {
  color: #465160;
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

.wo-layout {
  align-items: start;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
}

.wo-layout-main,
.wo-layout-side {
  min-width: 0;
}

@media (max-width: 1199.98px) {
  .wo-layout {
    grid-template-columns: 1fr;
  }
}

.details-grid > div,
.print-meta > div {
  background: #fff;
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  padding: .85rem;
}

.details-grid span,
.print-meta span,
.print-header span {
  display: block;
  color: #667085;
  font-size: .82rem;
  font-weight: 600;
}

.details-grid strong,
.print-meta strong {
  display: block;
  margin-top: .2rem;
  font-weight: 650;
}

.work-order-title-field {
  grid-column: 1 / -1;
}

.work-order-title-input {
  font-size: 1.18rem;
  font-weight: 650;
  line-height: 1.35;
  max-height: calc(1.35em * 3 + 1.5rem + 2px);
  min-height: calc(1.35em * 3 + 1.5rem + 2px);
  overflow-y: auto;
  resize: none;
}

.content-section h2,
.print-section h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .75rem;
}

.preserve-lines {
  white-space: pre-wrap;
  margin-bottom: 0;
}

.schema-column-list {
  columns: 3 16rem;
  margin-bottom: 0;
}

.schema-column-list li {
  break-inside: avoid;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: .88rem;
}

.print-body {
  background: #fff;
  margin: 0;
}

/* Etiqueta compacta para impresora Brother QL-800.
   El tamano (.label-sheet width/height) y @page se emiten inline segun el LabelType. */
.label-body {
  background: #fff;
  margin: 0;
}

.label-sheet {
  box-sizing: border-box;
  /* Margen izquierdo extra: la QL-800 no imprime bien pegado al borde izquierdo. */
  padding: 1.5mm 2mm 1.5mm 4.5mm;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 2mm;
  overflow: hidden;
  color: #000;
  font-family: "Roboto", Arial, sans-serif;
  line-height: 1.1;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.label-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5mm;
  min-width: 0;
  flex: 1 1 55%;
}

.label-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.4mm;
  min-width: 0;
  flex: 1 1 45%;
  border-left: 0.3mm solid #000;
  padding-left: 2mm;
  font-size: 2.5mm;
}

.label-id {
  font-size: 5.5mm;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1;
}

.label-date {
  font-size: 2.6mm;
  font-weight: 500;
}

.label-contact {
  display: flex;
  flex-direction: column;
  font-size: 2.8mm;
}

.label-contact span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.label-contact-name {
  font-weight: 600;
}

.label-company {
  font-weight: 500;
}

.label-side-row {
  display: flex;
  gap: 1mm;
  overflow: hidden;
}

.label-side-row .label-k {
  font-weight: 600;
  flex: 0 0 auto;
}

.label-side-row span:last-child {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.label-desc {
  font-size: 2.3mm;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.print-sheet {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.print-background {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.print-background-inner {
  position: relative;
}

.print-header {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  border-bottom: 2px solid #111827;
  padding-bottom: .6rem;
  margin-bottom: .85rem;
}

.print-header h1 {
  margin: .15rem 0 0;
  font-size: 1.6rem;
}

.print-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .5rem;
  margin-bottom: .85rem;
}

.print-meta > div {
  padding: .5rem .7rem;
}

.print-section {
  break-inside: avoid;
  margin-bottom: .85rem;
}

.print-section h2 {
  margin-bottom: .4rem;
}

.print-section .table {
  margin-bottom: 0;
}

.print-section .table th,
.print-section .table td {
  padding: .25rem .5rem;
}

@media screen and (max-width: 767.98px) {
  .page-heading {
    flex-direction: column;
  }

  .work-order-actions {
    align-items: stretch;
    width: 100%;
  }

  .work-order-actions > .d-flex {
    flex-wrap: wrap;
  }

  .details-grid,
  .print-meta {
    grid-template-columns: 1fr;
  }
}

@media print {
  .print-sheet {
    max-width: none;
    padding: 0;
  }

  a[href]::after {
    content: "";
  }
}

:root {
  --md-primary: #1a73e8;
  --md-on-primary: #ffffff;
  --md-primary-container: #d3e3fd;
  --md-on-primary-container: #041e49;
  --md-secondary: #5f6368;
  --md-background: #f8fafd;
  --md-surface: #ffffff;
  --md-surface-container: #f0f4f9;
  --md-on-surface: #1f1f1f;
  --md-on-surface-variant: #5f6368;
  --md-outline: #c4c7c5;
  --md-outline-variant: #dde3ea;
  --md-shadow: 0 1px 2px rgba(60, 64, 67, .14), 0 1px 3px 1px rgba(60, 64, 67, .08);
  --md-radius-sm: 8px;
  --md-radius: 12px;
  --md-radius-lg: 16px;
}

body {
  background: var(--md-background);
  color: var(--md-on-surface);
  font-family: Roboto, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-topbar {
  background: var(--md-surface);
  border-bottom: 1px solid var(--md-outline-variant);
  box-shadow: var(--md-shadow);
}

.navbar-brand {
  align-items: center;
  color: var(--md-on-surface);
  display: inline-flex;
  font-weight: 700;
  letter-spacing: 0;
  min-height: 44px;
  padding: .2rem 0;
}

.navbar-brand-logo {
  display: block;
  height: 36px;
  max-width: 180px;
  object-fit: contain;
  width: auto;
}

.navbar .nav-link {
  border-radius: 999px;
  color: var(--md-on-surface-variant);
  font-weight: 500;
  padding: .45rem .9rem;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
}

.page-kicker {
  color: var(--md-primary);
  display: block;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  margin-bottom: .25rem;
  text-transform: uppercase;
}

.page-heading h1 {
  font-weight: 700;
}

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

.dashboard-card {
  background: var(--md-surface);
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-lg);
  box-shadow: var(--md-shadow);
  color: var(--md-on-surface);
  min-width: 0;
  padding: 1rem;
}

.dashboard-card-action {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 150px;
  text-decoration: none;
}

.dashboard-card-action:hover,
.dashboard-card-action:focus {
  border-color: color-mix(in srgb, var(--md-primary) 55%, var(--md-outline-variant));
  color: var(--md-on-surface);
  transform: translateY(-1px);
}

.dashboard-label {
  color: var(--md-on-surface-variant);
  display: block;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.dashboard-card strong {
  display: block;
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 750;
  line-height: 1;
  margin: .7rem 0;
}

.dashboard-note {
  color: var(--md-on-surface-variant);
  font-size: .9rem;
}

.dashboard-state-card {
  grid-row: span 2;
}

.dashboard-card-heading {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: .8rem;
}

.dashboard-card-heading strong {
  font-size: 1.7rem;
  margin: .25rem 0 0;
}

.dashboard-card-heading-compact {
  align-items: center;
  margin-bottom: .55rem;
}

.dashboard-card-heading-compact strong {
  font-size: 1.25rem;
}

.dashboard-messages-card {
  grid-column: 1 / -1;
  padding-bottom: .8rem;
  padding-top: .8rem;
}

.dashboard-list-card {
  min-height: 280px;
}

.dashboard-list-card-wide {
  grid-column: auto;
}

.dashboard-empty {
  color: var(--md-on-surface-variant);
  margin: 0;
}

.dashboard-table-wrap {
  overflow-x: auto;
}

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

.dashboard-table thead th {
  color: var(--md-on-surface-variant);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.dashboard-table a,
.dashboard-item-list a {
  color: var(--md-on-surface);
  text-decoration: none;
}

.dashboard-table a:hover,
.dashboard-item-list a:hover {
  color: var(--md-primary);
}

.dashboard-item-list {
  display: grid;
  gap: .55rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.dashboard-item-list li {
  background: var(--md-surface-container);
  border-radius: var(--md-radius-sm);
  min-width: 0;
}

.dashboard-item-list a {
  display: block;
  padding: .65rem .75rem;
}

.dashboard-item-title,
.dashboard-item-meta {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-item-title {
  font-weight: 700;
}

.dashboard-item-meta {
  color: var(--md-on-surface-variant);
  font-size: .86rem;
  margin-top: .15rem;
}

.dashboard-message-list {
  display: grid;
  gap: .45rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.dashboard-message-list li {
  background: var(--md-surface-container);
  border-radius: var(--md-radius-sm);
  min-width: 0;
}

.dashboard-message-list li.dashboard-message-unread {
  background: color-mix(in srgb, var(--md-primary-container) 58%, var(--md-surface));
}

.dashboard-message-list a {
  color: var(--md-on-surface);
  display: block;
  min-width: 0;
  padding: .55rem .7rem;
  text-decoration: none;
}

.dashboard-message-list a:hover {
  color: var(--md-primary);
}

.dashboard-message-subject,
.dashboard-message-meta,
.dashboard-message-preview {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-message-subject {
  font-weight: 700;
}

.dashboard-message-meta,
.dashboard-message-preview {
  color: var(--md-on-surface-variant);
  font-size: .82rem;
}

.status-count-list {
  display: grid;
  gap: .45rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.status-count-list li {
  align-items: center;
  background: var(--md-surface-container);
  border-radius: var(--md-radius-sm);
  display: flex;
  gap: .75rem;
  justify-content: space-between;
  min-height: 42px;
  padding: .55rem .7rem;
}

.status-count-list span {
  color: var(--md-on-surface-variant);
  min-width: 0;
}

.status-count-list strong {
  font-size: 1rem;
  margin: 0;
}

.filters-panel,
.content-section,
.material-card {
  background: var(--md-surface);
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-lg);
  box-shadow: var(--md-shadow);
}

.form-label {
  color: var(--md-on-surface-variant);
  font-size: .82rem;
  font-weight: 500;
}

.autocomplete {
  position: relative;
}

.autocomplete-menu {
  position: absolute;
  z-index: 1050;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  margin: 0;
  padding: .25rem 0;
  list-style: none;
  max-height: 16rem;
  overflow-y: auto;
  background: var(--md-surface);
  border: 1px solid var(--md-outline);
  border-radius: var(--md-radius-sm);
  box-shadow: var(--md-shadow);
}

.autocomplete-item {
  align-items: baseline;
  cursor: pointer;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: .4rem .75rem;
}

.autocomplete-item.is-active,
.autocomplete-item:hover {
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
}

.autocomplete-item-meta {
  color: var(--md-on-surface-variant);
  font-size: .82rem;
  white-space: nowrap;
}

.autocomplete-item.is-active .autocomplete-item-meta,
.autocomplete-item:hover .autocomplete-item-meta {
  color: var(--md-on-primary-container);
}

.autocomplete-locked {
  background-color: var(--md-surface-container);
}

.form-control,
.form-select {
  background-color: var(--md-surface);
  border: 1px solid var(--md-outline);
  border-radius: var(--md-radius-sm);
  min-height: 42px;
}

.form-control:focus,
.form-select:focus,
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-check-input:focus {
  border-color: var(--md-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-primary) 22%, transparent);
}

.btn {
  border-radius: 999px;
  font-weight: 700;
  min-height: 40px;
  padding: .45rem 1rem;
}

.btn-sm {
  min-height: 32px;
  padding: .25rem .8rem;
}

.btn-primary {
  background-color: var(--md-primary);
  border-color: var(--md-primary);
  color: var(--md-on-primary);
  box-shadow: var(--md-shadow);
}

.btn-outline-primary,
.btn-outline-secondary {
  background: var(--md-surface);
  border-color: var(--md-outline);
  color: var(--md-primary);
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover {
  background: var(--md-primary-container);
  border-color: var(--md-primary-container);
  color: var(--md-on-primary-container);
}

.table-responsive {
  border-radius: var(--md-radius-lg);
  box-shadow: var(--md-shadow);
}

.work-orders-table {
  border: 1px solid var(--md-outline-variant);
  margin-bottom: 0;
}

.work-orders-table thead th {
  background: var(--md-surface-container);
  color: var(--md-on-surface-variant);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.work-orders-table tbody tr {
  --ot-status-color: var(--md-secondary);
  --ot-status-foreground: var(--md-on-surface);
  --bs-table-bg: var(--ot-status-color);
  --bs-table-color: var(--ot-status-foreground);
  --bs-table-hover-bg: color-mix(in srgb, var(--ot-status-color) 86%, var(--md-surface));
  --bs-table-hover-color: var(--ot-status-foreground);
  background-color: var(--ot-status-color);
  color: var(--ot-status-foreground);
}

.work-orders-table tbody tr:hover {
  background-color: var(--bs-table-hover-bg);
}

.work-orders-table tbody td {
  border-color: color-mix(in srgb, var(--ot-status-color) 20%, var(--md-outline-variant));
  color: inherit;
}

.btn-wo-finalize {
  background-color: var(--wo-finalize-color, #34a853);
  border-color: var(--wo-finalize-color, #34a853);
  color: var(--wo-finalize-foreground, #ffffff);
}

.btn-wo-finalize:hover,
.btn-wo-finalize:focus {
  background-color: color-mix(in srgb, var(--wo-finalize-color, #34a853) 85%, black);
  border-color: color-mix(in srgb, var(--wo-finalize-color, #34a853) 85%, black);
  color: var(--wo-finalize-foreground, #ffffff);
}

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

.settings-grid > div {
  background: var(--md-surface);
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius);
  box-shadow: var(--md-shadow);
  padding: .9rem;
}

.settings-grid span {
  color: var(--md-on-surface-variant);
  display: block;
  font-size: .8rem;
  font-weight: 700;
}

.settings-grid strong {
  display: block;
  font-weight: 700;
  margin-top: .25rem;
}

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

.status-color-row {
  align-items: center;
  background: var(--md-surface-container);
  border-radius: var(--md-radius);
  display: grid;
  gap: .65rem;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  padding: .75rem;
}

.status-swatch {
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
  height: 20px;
  width: 20px;
}

.status-color-input {
  min-height: 36px;
  min-width: 56px;
  padding: .25rem;
  width: 64px;
}

.status-color-row .field-validation-error {
  grid-column: 2 / -1;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

.status-update-form {
  align-items: start;
  display: grid;
  gap: .5rem;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: .35rem;
}

.status-update-form .field-validation-error {
  grid-column: 1 / -1;
}

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

.status-mapping-card {
  background: var(--md-surface-container);
  border-radius: var(--md-radius);
  padding: .85rem;
}

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

.status-mapping-card span {
  color: var(--md-on-surface-variant);
  margin-top: .25rem;
}

.footer {
  background: var(--md-surface);
  border-top: 1px solid var(--md-outline-variant);
  color: var(--md-on-surface-variant);
}

@media screen and (max-width: 767.98px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-list-card-wide {
    grid-column: auto;
  }

  .dashboard-state-card {
    grid-row: auto;
  }

  .dashboard-card-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-message-list {
    grid-template-columns: 1fr;
  }

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

  .status-color-row {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .status-color-input,
  .status-color-row .field-validation-error {
    grid-column: 2;
  }
}

.material-tabs {
  border-bottom: 1px solid var(--md-outline-variant);
  gap: .25rem;
}

.material-tabs .nav-link {
  border: 0;
  border-radius: var(--md-radius) var(--md-radius) 0 0;
  color: var(--md-on-surface-variant);
  font-weight: 700;
}

.material-tabs .nav-link.active {
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
}

.section-toolbar {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: .85rem;
}

.section-toolbar h2 {
  margin-bottom: 0;
}

.catalog-toolbar-title {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  min-width: 0;
}

.catalog-toolbar-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: flex-end;
}

.catalog-search-input {
  max-width: 280px;
  min-width: 220px;
}

.catalog-table-wrap {
  box-shadow: none;
  max-height: calc(100vh - 190px);
  overflow: auto;
}

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

.catalog-table thead th {
  background: var(--md-surface-container);
  color: var(--md-on-surface-variant);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.catalog-row-actions {
  align-items: center;
  display: inline-flex;
  gap: .4rem;
  justify-content: flex-end;
  white-space: nowrap;
}

/* Bootstrap paints the text color on the cells, so the row-level rule is overridden;
   target the cells (and the hover state) to keep hidden records visibly grey. */
.catalog-row-inactive > td,
.table-hover > tbody > tr.catalog-row-inactive:hover > td {
  color: #80868b;
}

.catalog-row-selectable {
  cursor: pointer;
}

.catalog-row-selected > td,
.table-hover > tbody > tr.catalog-row-selected:hover > td {
  background-color: var(--md-primary-container);
  color: var(--md-on-primary-container);
}

.company-vessels {
  border-top: 1px solid var(--md-outline-variant);
  margin-top: 1.25rem;
  padding-top: 1rem;
}

.company-vessels-title {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: .6rem;
}

.company-vessels-list {
  list-style: none;
  margin: 0;
  max-height: 18rem;
  overflow-y: auto;
  padding: 0;
}

.company-vessels-list li {
  border-bottom: 1px solid var(--md-outline-variant);
  padding: .35rem 0;
}

.company-vessels-list li:last-child {
  border-bottom: 0;
}

.catalog-hidden-toggle {
  margin: .5rem 0 .75rem;
}

.catalog-select-column {
  text-align: center;
  width: 54px;
}

.catalog-editor-layout {
  align-items: start;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, .9fr);
}

.catalog-list-panel,
.catalog-detail-panel {
  margin-bottom: 0;
}

.catalog-detail-panel {
  max-height: calc(100vh - 120px);
  overflow: auto;
  position: sticky;
  top: 88px;
}

.catalog-form-grid,
.create-form-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.create-page-heading p {
  display: none;
}

.create-main-grid {
  gap: .75rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.create-main-grid > div:first-child {
  display: none;
}

.catalog-field-wide,
.create-field-wide {
  grid-column: 1 / -1;
}

.create-title-field {
  grid-column: 1 / -1;
}

.ai-refine-field-heading {
  align-items: center;
  display: flex;
  gap: .75rem;
  justify-content: space-between;
  margin-bottom: .5rem;
}

.ai-refine-error {
  margin: .75rem 0 0;
  padding: .65rem .8rem;
}

.ai-refine-preview {
  min-height: 220px;
  resize: vertical;
}

.ai-edit-heading {
  align-items: center;
  display: flex;
  gap: .75rem;
  justify-content: space-between;
  margin-bottom: .5rem;
}

.ai-original-toggle {
  margin-top: .5rem;
}

.ai-edit-heading .ai-original-toggle {
  margin-top: 0;
}

.ai-original-text {
  background: var(--md-surface-container);
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-sm);
  color: var(--md-on-surface-variant);
  margin-top: .5rem;
  padding: .65rem .75rem;
}

.catalog-field small {
  display: block;
  margin-top: .25rem;
}

.merge-summary {
  align-items: baseline;
  display: flex;
  gap: .4rem;
  margin-bottom: .75rem;
}

.merge-summary strong {
  font-size: 1.35rem;
}

.merge-summary span {
  color: var(--md-on-surface-variant);
}

.merge-work-orders-wrap {
  box-shadow: none;
  max-height: 360px;
  overflow: auto;
}

.form-section-title {
  color: var(--md-primary);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .08em;
  margin: 1.2rem 0 .75rem;
  text-transform: uppercase;
}

.form-section-title:first-of-type {
  margin-top: 0;
}

[data-work-order-edit-root]:not(.is-editing) [data-editable-work-order-field] {
  background: var(--md-surface-container);
  color: var(--md-on-surface);
  opacity: 1;
}

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

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

.login-panel h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.token-list {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-bottom: 1rem;
}

.token-list code {
  background: var(--md-surface-container);
  border: 1px solid var(--md-outline-variant);
  border-radius: 6px;
  color: var(--md-on-surface);
  padding: .25rem .45rem;
}

.app-user-nav {
  align-items: center;
  gap: .15rem;
}

.app-message-link {
  align-items: center;
  display: inline-flex;
  min-height: 40px;
  position: relative;
}

.app-message-icon {
  font-size: 1.12rem;
  line-height: 1;
}

.app-message-badge {
  align-items: center;
  background: #b3261e;
  border: 2px solid var(--md-surface);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: .7rem;
  font-weight: 700;
  height: 20px;
  justify-content: center;
  min-width: 20px;
  padding: 0 .28rem;
  position: absolute;
  right: .1rem;
  top: .05rem;
}

.internal-message-toast-container {
  z-index: 1080;
}

.internal-messages-table {
  margin-bottom: 0;
}

.internal-messages-table thead th {
  background: var(--md-surface-container);
  color: var(--md-on-surface-variant);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.internal-messages-table tbody tr.message-unread {
  background: color-mix(in srgb, var(--md-primary-container) 48%, var(--md-surface));
}

.message-subject {
  color: var(--md-on-surface);
  display: block;
  font-weight: 700;
  text-decoration: none;
}

.message-subject:hover,
.message-subject:focus {
  color: var(--md-primary);
  text-decoration: underline;
}

.message-preview {
  color: var(--md-on-surface-variant);
  display: block;
  font-size: .88rem;
  max-width: 680px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-thread-count {
  background: var(--md-surface-container);
  border: 1px solid var(--md-outline-variant);
  border-radius: 999px;
  color: var(--md-on-surface-variant);
  display: inline-flex;
  font-size: .72rem;
  font-weight: 700;
  margin-left: .4rem;
  padding: .1rem .45rem;
  vertical-align: middle;
}

.message-compose-form {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(220px, .7fr) minmax(0, 1.3fr);
}

.message-compose-body,
.message-compose-form .settings-actions,
.message-compose-form .alert {
  grid-column: 1 / -1;
}

.message-body {
  background: var(--md-surface-container);
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius);
  font-family: inherit;
  margin: 0;
  padding: 1rem;
  white-space: pre-wrap;
}

.message-thread {
  display: grid;
  gap: .85rem;
}

.message-thread-item {
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius);
  padding: .85rem;
}

.message-thread-own {
  background: color-mix(in srgb, var(--md-primary-container) 34%, var(--md-surface));
}

.message-thread-header {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: .65rem;
}

.message-thread-header strong,
.message-thread-header span {
  display: block;
}

.message-thread-header span,
.message-thread-header time {
  color: var(--md-on-surface-variant);
  font-size: .82rem;
}

.message-reply-form {
  border-top: 1px solid var(--md-outline-variant);
  margin-top: 1rem;
  padding-top: 1rem;
}

@media screen and (max-width: 767.98px) {
  .catalog-editor-layout {
    grid-template-columns: 1fr;
  }

  .catalog-detail-panel {
    max-height: none;
    overflow: visible;
    position: static;
  }

  .catalog-form-grid,
  .create-form-grid {
    grid-template-columns: 1fr;
  }

  .catalog-search-input {
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .create-main-grid {
    grid-template-columns: 1fr;
  }

  .app-user-nav {
    align-items: stretch;
  }

  .app-message-link {
    justify-content: flex-start;
    width: max-content;
  }

  .message-preview {
    max-width: 220px;
  }

  .message-compose-form {
    grid-template-columns: 1fr;
  }

  .message-thread-header {
    flex-direction: column;
    gap: .25rem;
  }
}

@media print {
  .app-topbar,
  .footer,
  .work-order-actions,
  [data-edit-mode-only],
  [data-ai-original-toggle],
  .ai-original-text,
  #aiWorkOrderRefineError,
  .btn {
    display: none !important;
  }

  body {
    background: #fff;
    margin: 0;
  }

  .container {
    max-width: none;
    width: 100%;
  }

  .content-section,
  .details-grid > div {
    border-color: #d0d5dd;
    box-shadow: none;
  }

  .form-control,
  .form-select {
    border: 0;
    min-height: auto;
    padding: 0;
  }
}

/* Bulk selection toolbar on the work-order list */
.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.85rem;
  background: var(--md-surface-container);
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-sm);
}

.bulk-toolbar-count {
  font-weight: 600;
  color: var(--md-on-surface);
}

.bulk-toolbar-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.bulk-toolbar-feedback {
  color: var(--md-on-surface-variant);
  font-size: 0.9rem;
}

.wo-select-col {
  width: 2.5rem;
  text-align: center;
}

.bulk-delete-list {
  max-height: 12rem;
  overflow-y: auto;
  margin-bottom: 0.75rem;
  padding-left: 1.25rem;
}

/* Selected-OT rows on the bulk edit page open a read-only detail popup */
.ot-detail-row {
  cursor: pointer;
}

/* OT attachments: drop zone, upload progress and the thumbnail gallery */
.attachment-dropzone {
  border: 2px dashed #c7d0da;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  transition: background-color .15s ease, border-color .15s ease;
}

.attachment-dropzone-active {
  background: #eef5ff;
  border-color: #1a73e8;
}

.attachment-hint {
  color: #5b6675;
  font-size: .82rem;
  margin: .5rem 0 0;
}

.attachment-progress-list {
  list-style: none;
  margin: .75rem 0 0;
  padding: 0;
}

.attachment-progress {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  font-size: .85rem;
  padding: .25rem 0;
}

.attachment-progress-label {
  flex: 1 1 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-progress-notice {
  color: #a05a00;
  flex: 1 1 100%;
  font-size: .8rem;
}

.attachment-grid {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  margin-top: .75rem;
}

.attachment-tile {
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  margin: 0;
  overflow: hidden;
}

.attachment-preview {
  align-items: center;
  background: #f2f4f7;
  border: 0;
  display: flex;
  height: 120px;
  justify-content: center;
  padding: 0;
  width: 100%;
}

.attachment-preview img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.attachment-preview-file {
  color: #465160;
  font-weight: 700;
  letter-spacing: .05em;
  text-decoration: none;
}

.attachment-caption {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .5rem;
}

.attachment-name {
  color: #1a73e8;
  font-size: .85rem;
  overflow: hidden;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-meta {
  color: #5b6675;
  font-size: .75rem;
}

.attachment-remove {
  align-self: flex-start;
}

.attachment-lightbox-image {
  max-height: 75vh;
  max-width: 100%;
  object-fit: contain;
}

.attachment-camera-video {
  background: #000;
  border-radius: 8px;
  max-height: 60vh;
  width: 100%;
}

/* ---------------------------------------------------------------------------------------------
   Ordenes de servicio (OS)
   --------------------------------------------------------------------------------------------- */

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

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

.os-channel-options {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  min-height: calc(1.5em + .75rem + 2px);
}

.os-status {
  border-radius: 999px;
  display: inline-block;
  font-size: .78rem;
  font-weight: 700;
  padding: .15rem .6rem;
  white-space: nowrap;
}

.os-status-draft {
  background: var(--md-surface-container);
  border: 1px solid var(--md-outline-variant);
  color: var(--md-on-surface-variant);
}

.os-status-pending {
  background: #fff4d6;
  color: #7a5600;
}

.os-status-signed {
  background: #dff3e5;
  color: #136c34;
}

.os-status-voided {
  background: #fde2e0;
  color: #a50e0e;
}

.os-signature-facts {
  display: grid;
  gap: .25rem .75rem;
  grid-template-columns: auto 1fr;
  margin-bottom: .75rem;
}

.os-signature-facts dt {
  color: var(--md-on-surface-variant);
  font-size: .82rem;
  font-weight: 500;
}

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

.os-link-list {
  list-style: none;
  margin: 0 0 .75rem;
  padding: 0;
}

.os-link-list li {
  border-bottom: 1px solid var(--md-outline-variant);
  padding: .45rem 0;
}

.os-link-list li:last-child {
  border-bottom: 0;
}

.os-sign-layout {
  align-items: start;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr);
}

.os-sign-panel {
  position: sticky;
  top: 1rem;
}

.os-sign-panel h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

/* Signature pad */

.signature-pad-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: .25rem;
}

.signature-pad-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  justify-content: flex-end;
}

.signature-pad-header {
  flex-wrap: wrap;
  gap: .25rem .5rem;
}

.signature-settings {
  align-items: start;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(200px, 1fr) minmax(0, 2fr);
}

.signature-saved-preview {
  align-items: center;
  background: #fff;
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-sm);
  display: flex;
  justify-content: center;
  min-height: 110px;
  padding: .5rem;
}

.signature-saved-preview img {
  max-height: 120px;
  max-width: 100%;
  object-fit: contain;
}

@media (max-width: 767.98px) {
  .signature-settings {
    grid-template-columns: 1fr;
  }
}

.signature-pad-surface {
  background: #fff;
  border: 2px dashed var(--md-outline);
  border-radius: var(--md-radius-sm);
  position: relative;
}

.signature-pad.has-signature .signature-pad-surface {
  border-color: var(--md-primary);
  border-style: solid;
}

.signature-pad-canvas {
  aspect-ratio: 3 / 1;
  cursor: crosshair;
  display: block;
  min-height: 140px;
  /* Without this the browser scrolls or zooms the page instead of drawing. */
  touch-action: none;
  width: 100%;
}

.signature-pad-placeholder {
  align-items: center;
  color: var(--md-outline);
  display: flex;
  font-size: 1.1rem;
  inset: 0;
  justify-content: center;
  pointer-events: none;
  position: absolute;
}

.signature-pad-caption {
  color: var(--md-on-surface-variant);
  font-size: .85rem;
  margin-top: .25rem;
  text-align: center;
}

/* The A4 sheet: same layout as the paper booklet. Physical units so screen and paper match. */

.os-sheet {
  --os-ink: #111827;
  --os-rule: #9aa3ad;
  -webkit-print-color-adjust: exact;
  background-color: #fff;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  color: var(--os-ink);
  font-family: Roboto, Arial, sans-serif;
  font-size: 10.5pt;
  line-height: 1.35;
  margin: 0 auto;
  max-width: 210mm;
  padding: 12mm 14mm;
  position: relative;
  print-color-adjust: exact;
}

/* A letterhead template is drawn behind the sheet, so the sheet itself must not paint over it. */
.os-sheet.os-sheet-templated {
  background-color: transparent;
}

/* On screen a letterhead template stays inside the preview box instead of covering the viewport. */
.os-sheet-preview {
  position: relative;
  z-index: 0;
}

@media screen {
  .os-sheet-preview .print-background {
    position: absolute;
  }
}

.os-sheet-preview .os-sheet {
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-sm);
  box-shadow: var(--md-shadow);
}

.os-sheet-header {
  align-items: flex-end;
  border-bottom: 2px solid var(--os-ink);
  display: flex;
  gap: 1.5rem;
  justify-content: space-between;
  margin-bottom: 4mm;
  min-height: 22mm;
  padding-bottom: 3mm;
}

.os-sheet-logo {
  display: block;
  margin-bottom: 1.5mm;
  max-height: 18mm;
  max-width: 60mm;
  object-fit: contain;
}

.os-sheet-issuer-name {
  font-size: 15pt;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.1;
}

.os-sheet-issuer-lines {
  color: #374151;
  font-size: 8.5pt;
  line-height: 1.3;
  margin-top: 1mm;
}

.os-sheet-number {
  text-align: right;
  white-space: nowrap;
}

.os-sheet-kind {
  display: block;
  font-size: 13pt;
  font-weight: 700;
  letter-spacing: .35em;
  text-transform: uppercase;
}

.os-sheet-no {
  display: block;
  font-size: 12pt;
}

.os-sheet-no strong {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 20pt;
  letter-spacing: .05em;
}

.os-sheet-label {
  font-size: 8.5pt;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.os-sheet-request {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 2.5mm;
}

.os-sheet-field {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 2mm;
}

.os-sheet-channels {
  display: flex;
  flex-direction: column;
  font-size: 8.5pt;
  font-weight: 700;
  gap: 1mm;
  text-transform: uppercase;
}

.os-sheet-channel {
  align-items: center;
  display: flex;
  gap: 2mm;
}

.os-sheet-checkbox {
  align-items: center;
  border: 1.2px solid var(--os-ink);
  display: inline-flex;
  font-size: 8pt;
  height: 4.5mm;
  justify-content: center;
  line-height: 1;
  width: 4.5mm;
}

.os-sheet-boxes {
  align-items: center;
  display: inline-flex;
  gap: 1.5mm;
}

.os-sheet-box-group {
  display: inline-flex;
}

.os-sheet-box {
  align-items: center;
  border: 1.2px solid var(--os-ink);
  display: inline-flex;
  font-size: 10.5pt;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  height: 7mm;
  justify-content: center;
  width: 8mm;
}

.os-sheet-box + .os-sheet-box {
  border-left: 0;
}

.os-sheet-colon,
.os-sheet-hrs {
  font-weight: 700;
}

.os-sheet-hrs {
  font-size: 8.5pt;
}

.os-sheet-line {
  align-items: baseline;
  display: flex;
  gap: 2mm;
  margin: 2.5mm 0;
  min-width: 0;
}

.os-sheet-value {
  border-bottom: 1px solid var(--os-rule);
  flex: 1;
  min-height: 1.35em;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 0 1mm .3mm;
}

.os-sheet-times {
  display: flex;
  flex-wrap: wrap;
  gap: 3mm 10mm;
  margin: 2.5mm 0;
}

.os-sheet-equipment {
  display: grid;
  gap: 5mm;
  grid-template-columns: 1.2fr 1fr 1fr;
}

.os-sheet-block {
  margin: 3mm 0;
}

/* Lined like the paper form, so an unsigned printout still has room to write by hand. */
.os-sheet-ruled {
  --os-line-height: 6.5mm;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--os-line-height) - 1px),
    var(--os-rule) calc(var(--os-line-height) - 1px),
    var(--os-rule) var(--os-line-height));
  line-height: var(--os-line-height);
  min-height: calc(var(--os-lines, 2) * var(--os-line-height));
  overflow-wrap: anywhere;
  padding: 0 1mm;
  white-space: pre-wrap;
}

.os-sheet-signatures {
  break-inside: avoid;
  display: grid;
  gap: 14mm;
  grid-template-columns: 1fr 1fr;
  margin-top: 8mm;
}

.os-sheet-signature {
  text-align: center;
}

.os-sheet-signature-image {
  align-items: flex-end;
  border-bottom: 1.5px dotted var(--os-ink);
  display: flex;
  height: 24mm;
  justify-content: center;
}

.os-sheet-signature-image img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.os-sheet-signature-caption {
  font-size: 8.5pt;
  font-weight: 700;
  margin-top: 1.5mm;
  text-transform: uppercase;
}

.os-sheet-signature-name {
  font-size: 9.5pt;
  min-height: 1.3em;
}

.os-sheet-footer {
  border-top: 1px solid #d1d5db;
  color: #4b5563;
  font-size: 7.5pt;
  margin-top: 6mm;
  padding-top: 2mm;
}

.os-sheet-footer:empty {
  display: none;
}

.os-sheet-void-note {
  color: #a50e0e;
  font-weight: 700;
}

.os-sheet-watermark {
  align-items: center;
  color: rgba(165, 14, 14, .14);
  display: flex;
  font-size: 72pt;
  font-weight: 800;
  inset: 0;
  justify-content: center;
  letter-spacing: .1em;
  pointer-events: none;
  position: absolute;
  transform: rotate(-30deg);
  z-index: 1;
}

/* Public receipt / remote signing page */

.os-public-toolbar {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #d1d5db;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  justify-content: space-between;
  padding: .75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.os-public-alert,
.os-public-sheet,
.os-public-sign {
  margin-left: auto;
  margin-right: auto;
  max-width: 210mm;
}

.os-public-alert {
  margin-top: 1rem;
}

.os-public-sheet {
  margin-bottom: 1rem;
  margin-top: 1rem;
}

.os-public-sign {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  margin-bottom: 2rem;
  padding: 1.25rem;
}

.os-public-sign h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: .75rem;
}

.os-public-message {
  background: #fff;
  border-radius: 12px;
  margin: 3rem auto;
  max-width: 560px;
  padding: 2rem;
}

@media screen {
  .os-print-body,
  .os-public-body {
    background: #e5e7eb;
  }

  .os-print-body {
    padding: 1rem 0;
  }

  .os-print-body .os-sheet {
    box-shadow: var(--md-shadow);
    min-height: 297mm;
  }
}

@media (max-width: 1199.98px) {
  .os-sign-layout {
    grid-template-columns: 1fr;
  }

  .os-sign-panel {
    position: static;
  }
}

@media (max-width: 767.98px) {
  .os-form-grid {
    grid-template-columns: 1fr;
  }

  .os-public-alert,
  .os-public-sheet,
  .os-public-sign {
    margin-left: 8px;
    margin-right: 8px;
  }
}

@media screen and (max-width: 767.98px) {
  .os-sheet {
    font-size: 9.5pt;
    padding: 16px;
  }

  .os-sheet-header {
    align-items: flex-start;
    flex-direction: column;
    gap: .5rem;
  }

  .os-sheet-number {
    text-align: left;
  }

  .os-sheet-box {
    font-size: 9pt;
    height: 6.5mm;
    width: 6.5mm;
  }

  .os-sheet-equipment {
    gap: 0;
    grid-template-columns: 1fr;
  }

  .os-sheet-signatures {
    gap: 16px;
  }
}

@media print {
  .os-print-body,
  .os-public-body {
    background: #fff;
    padding: 0;
  }

  .os-sheet {
    max-width: none;
  }

  .os-sheet-preview .os-sheet {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .os-public-sheet {
    margin: 0;
    max-width: none;
  }

  .os-public-toolbar,
  .os-public-alert,
  .os-public-sign {
    display: none !important;
  }
}
