.guide-form,
.guide-records {
  --guide-accent: #2878c7;
  --guide-soft: #edf5ff;
  border-top: 4px solid var(--guide-accent);
}
.field-error-overlay {
  position: absolute;
  box-sizing: border-box;
  border-style: solid;
  border-color: transparent;
  pointer-events: none;
  overflow: hidden;
  white-space: pre;
  color: var(--ink, #163047);
  z-index: 2;
}
.field-error-overlay > span {
  display: block;
  width: max-content;
  min-width: 100%;
}
input.field-error-mirrored {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  caret-color: var(--ink, #163047);
}
.field-error-part {
  color: #be2034;
  text-decoration: none;
}
.field-error-explanation {
  display: block;
  color: #b42338;
  margin-top: 6px;
  font-size: 0.8rem;
  line-height: 1.5;
}
.field-prefix-copy {
  margin-top: 8px;
  font-size: 0.8rem;
}
body.dark .field-error-overlay {
  color: #e4eef8;
}
body.dark input.field-error-mirrored {
  caret-color: #e4eef8;
}
body.dark .field-error-part,
body.dark .field-error-explanation {
  color: #ff9ba8;
  text-decoration-color: #ff9ba8;
}
.field-error-overlay[hidden],
.field-error-explanation[hidden] {
  display: none;
}
@media (forced-colors: active) {
  .field-error-overlay {
    display: none;
  }
  input.field-error-mirrored {
    color: CanvasText !important;
    -webkit-text-fill-color: CanvasText !important;
    caret-color: CanvasText;
  }
}
.guide-payments {
  --guide-accent: #078578;
  --guide-soft: #e9f8f4;
}
.guide-location {
  position: sticky;
  top: 8px;
  z-index: 4;
  display: grid;
  gap: 4px;
  padding: 12px 16px;
  margin: 0 0 20px;
  border: 1px solid var(--guide-accent);
  border-left-width: 5px;
  border-radius: 12px;
  background: var(--guide-soft);
  color: #173750;
  overflow-wrap: anywhere;
  box-shadow: 0 3px 12px #0000000b;
}
.guide-location small {
  font-size: 0.8rem;
}
.guide-capture-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.guide-capture-layout > .fields {
  min-width: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.guide-client-summary {
  position: relative;
  padding: 10px 14px;
  border: 1px solid var(--guide-accent);
  background: var(--guide-soft);
  color: #173750;
  border-radius: 10px;
  overflow-wrap: anywhere;
}
.guide-client-summary h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  line-height: 1.5;
  display: inline;
  margin: 0 0 0 12px;
}
.guide-summary-toggle {
  cursor: pointer;
  min-height: 24px;
  line-height: 1.6;
}
.guide-summary-toggle::marker {
  color: var(--guide-accent);
}
.guide-summary-toggle:focus-visible {
  outline: 2px solid var(--guide-accent);
  outline-offset: 4px;
}
.guide-client-summary:not([open]) h3 {
  font-weight: 500;
}
.guide-client-summary[open] > summary {
  margin-bottom: 10px;
}
.guide-client-summary p {
  margin: 10px 0;
  font-size: 0.88rem;
}
.guide-client-summary small {
  display: block;
  font-size: 0.78rem;
  line-height: 1.6;
}
.guide-summary-label,
.guide-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.guide-policy {
  font-weight: 600;
}
.guide-chip {
  display: inline-block;
  border: 1px solid currentColor;
  border-radius: 9px;
  padding: 5px 8px;
  font-size: 0.76rem;
  line-height: 1.4;
  white-space: normal;
}
.guide-pending {
  color: #805100;
  background: #fff3d5;
}
.guide-saved {
  color: #11634b;
  background: #e5f6ec;
}
.guide-editing {
  color: #57408e;
  background: #f1ebff;
}
.guide-review {
  padding: 8px;
  border-radius: 8px;
}
.guide-field-hint {
  display: block;
  margin-top: 6px;
  line-height: 1.5;
  font-size: 0.78rem;
}
.guide-missing .guide-field-hint {
  color: #805100;
  background: #fff3d5;
  padding: 5px 8px;
  border-radius: 6px;
}
.guide-invalid .guide-field-hint {
  color: #a12835;
  background: #fff0f1;
  padding: 5px 8px;
  border-radius: 6px;
}
.guide-missing input,
.guide-missing select {
  border-color: #b98420 !important;
}
.guide-invalid input,
.guide-invalid select {
  border-color: #cd4551 !important;
}
.guide-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid #8b9fb344;
  border-radius: 12px;
}
.guide-group-label {
  flex-basis: 100%;
}
.guide-records .records-head {
  gap: 14px;
  flex-wrap: wrap;
}
.guide-records tbody tr:nth-child(even):not(.selected) {
  background: #7894af0b;
}
.guide-records tbody tr:hover {
  outline: 1px solid var(--guide-accent);
  outline-offset: -1px;
}
.guide-records tbody tr.selected {
  background: #318ad124;
  box-shadow: inset 4px 0 var(--guide-accent);
}
.guide-records .table-wrap {
  max-height: 65vh;
  overflow: auto;
}
.guide-records thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
.guide-more {
  min-width: 0;
  margin: 0;
  font-size: 0.8rem;
}
.guide-more summary {
  float: left;
  cursor: pointer;
  padding: 7px 9px;
  font-weight: 600;
}
.guide-more[open] {
  flex: 1 1 0;
}
.guide-more button {
  display: inline-block;
  width: auto;
  margin: 0 0 4px 4px;
  white-space: normal;
  text-align: left;
}
/* Each row grows with its own expanded actions; no menu is clipped to 48px. */
:is(#recordsBody, #payRows) > tr > td:not(:last-child) {
  padding-bottom: var(--record-actions-height, 88px);
}
:is(#recordsBody, #payRows) > tr > :is(.record-row-actions, .payment-row-actions) {
  inset: auto auto 0 0;
  width: var(--record-actions-width, 100%);
  max-width: 100%;
  height: auto;
  min-height: 48px;
  box-sizing: border-box;
  transform: translateX(var(--record-actions-offset, 0px));
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
  overflow: visible;
  white-space: normal;
  padding: 6px 8px;
}
#recordsBody .record-row-actions button,
#paymentPanel .payment-row-actions button {
  width: auto;
  max-width: calc(100% - 4px);
  box-sizing: border-box;
  overflow-wrap: anywhere;
  min-height: 32px;
  height: auto;
  padding: 5px 9px;
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: normal;
  flex: 0 1 auto;
}
:is(.record-row-actions, .payment-row-actions) > small {
  order: 3;
  flex: 0 1 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
  font-size: 0.72rem;
}
:is(.record-row-actions, .payment-row-actions) .guide-more {
  flex-shrink: 1;
  max-width: 100%;
}
#recordsBody .record-row-actions .guide-more button,
#paymentPanel .payment-row-actions .guide-more button {
  display: inline-block;
  white-space: normal;
}
@media (max-width: 600px) {
  #recordsBody .record-row-actions button,
  #paymentPanel .payment-row-actions button,
  :is(.record-row-actions, .payment-row-actions) .guide-more summary {
    min-height: 40px;
  }
}
.guide-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.guide-filter-chip {
  border: 1px solid var(--guide-accent);
  background: var(--guide-soft);
  color: #173750;
  padding: 8px 12px;
  border-radius: 20px;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
}
.guide-filter-details,
.guide-copy-help {
  border: 1px solid #8b9fb344;
  border-radius: 10px;
  padding: 12px;
  margin: 12px 0;
}
.guide-filter-details summary,
.guide-copy-help summary {
  cursor: pointer;
  font-weight: 600;
}
.guide-filter-details .payment-filters {
  margin-top: 12px;
}
.save-preview-changed::before {
  content: '✎ Dato modificado';
  display: block;
  color: #57408e;
  font-size: 0.75rem;
  margin-bottom: 8px;
}
.guide-preview-count {
  padding: 10px 14px;
  background: #f1ebff;
  color: #57408e;
  border-radius: 10px;
}
@media (max-width: 1100px) {
  .guide-capture-layout > .fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .guide-capture-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .guide-client-summary {
    position: static;
    grid-row: 1;
  }
}
@media (max-width: 600px) {
  .guide-capture-layout > .fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .guide-location {
    top: 4px;
    padding: 10px;
  }
  .guide-client-summary {
    padding: 12px;
  }
  .guide-client-summary h3 {
    font-size: 0.82rem;
  }
  .guide-action-group {
    width: 100%;
  }
  .guide-action-group button {
    min-height: 44px;
    flex: 1 1 140px;
  }
  .guide-form .form-actions {
    position: relative;
    z-index: 3;
    padding: 10px 4px max(10px, env(safe-area-inset-bottom));
    background: var(--guide-soft);
    color: #173750;
    border-top: 1px solid var(--guide-accent);
  }
  .guide-form .form-actions > p {
    display: none;
  }
  .guide-form .form-action-buttons {
    width: 100%;
  }
  .guide-form .form-actions .primary {
    flex-basis: 100%;
  }
  .guide-form {
    scroll-padding-bottom: 200px;
  }
  .guide-form input,
  .guide-form select,
  .guide-form textarea {
    scroll-margin-bottom: 220px;
  }
}
body.dark .guide-form,
body.dark .guide-records {
  --guide-soft: #192f44;
}
body.dark .guide-payments {
  --guide-soft: #163a37;
}
body.dark .guide-location,
body.dark .guide-client-summary,
body.dark .guide-filter-chip,
body.dark .guide-form .form-actions {
  color: #e4eef8;
}
/* Separate the login emblem from its backdrop without changing the shared image asset. */
#login .login-art {
  background: linear-gradient(135deg, #005578 0%, #006d77 48%, #007765 100%);
}
#login .mlpro-emblem img {
  filter: saturate(1.12) contrast(1.08) brightness(0.82);
}
#login .personal-wordmark {
  filter: brightness(0.84) drop-shadow(0 2px 2px #002e4140);
}
#login .mobile-brand .login-brand-text {
  color: #00618a !important;
}
.records-card .record-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.record-controls [hidden],
.record-view-switch [hidden] {
  display: none !important;
}
.record-view-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #168d7e;
  border-radius: 9px;
  background: #168d7e15;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}
.record-view-switch label {
  display: grid;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}
.record-view-switch select {
  max-width: 100%;
  min-width: 0;
}
.record-view-switch p {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  .record-view-switch > label,
  .record-view-switch > button {
    width: 100%;
  }
  .record-view-switch button {
    white-space: normal;
  }
}
.records-card > .guide-location {
  position: static;
}
.record-controls #copyRecordsBtn {
  margin-left: 0;
}
.record-controls .select-all {
  font-size: 0.9rem;
  font-weight: 500;
}
@media (min-width: 1000px) {
  .records-card .record-controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  }
  .record-control-section:nth-of-type(-n + 3) {
    grid-column: 1 / -1;
  }
}
.record-control-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #91a8bb66;
  border-radius: 10px;
  background: #eff6fa;
  min-width: 0;
}
.record-control-section h3,
.record-control-section > .record-control-help {
  flex: 0 0 100%;
  margin: 0;
}
.record-control-section h3 {
  color: #075b79;
  font-size: 1rem;
}
.record-control-section > .record-control-help {
  color: #435b70;
  font-size: 0.85rem;
}
.records-card .record-control-section label {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 0;
  max-width: 100%;
}
.record-control-section label:has(input[type='checkbox']) {
  padding: 8px 10px;
  border: 1px solid #859bb466;
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}
.record-control-section label:has(input:checked) {
  background: #d9f4ee;
  border-color: #168d7e;
  color: #07564c;
}
.record-control-section input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #008579;
}
.record-control-section select {
  max-width: 100%;
}
.record-control-section .workflow-actions {
  margin: 0;
}
.record-control-section #selectionCount {
  font-weight: 700;
  color: #075b79;
}
.record-date-selection {
  flex-basis: 100%;
}
.record-date-selection summary {
  cursor: pointer;
  padding: 8px 0;
}
body.dark .record-control-section {
  background: #13232e;
}
body.dark .record-control-section h3,
body.dark .record-control-section #selectionCount {
  color: #8ae2f3;
}
body.dark .record-control-section > .record-control-help {
  color: #c4d4e1;
}
body.dark .record-control-section label:has(input[type='checkbox']) {
  background: #192f3c;
  color: #e6f1f8;
}
body.dark .record-control-section label:has(input:checked) {
  background: #164c49;
  color: #b8fff0;
}
