/* Final operational refinements over the existing visual system. */
.editor .linefields {
  grid-template-columns: minmax(70px, 100px) minmax(130px, 1fr) 90px 44px;
  align-items: end;
  gap: 12px;
}
.editor .linefields .description {
  grid-column: 1 / -1;
}
.editor .linefields .quantity {
  grid-column: 1;
}
.editor .linefields input,
.editor .linefields select {
  width: 100%;
  min-width: 0;
  font-size: 14px;
}
.editor .linefields textarea {
  width: 100%;
  min-width: 0;
  font-size: 14px;
  min-height: 76px;
}
.editor .linefields .field {
  min-width: 0;
}
.editor .linefields .remove {
  min-width: 44px;
  min-height: 44px;
}
.clientcard .client-card-actions button {
  width: auto;
}
.client-picker {
  grid-column: 1 / -1;
}
.invoice-client-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px solid #dfe4d8;
  border-radius: 12px;
  background: #f8f9f4;
}
.invoice-client-identity {
  min-width: 0;
}
.invoice-client-identity > * {
  display: block;
  overflow-wrap: anywhere;
}
.invoice-client-identity strong {
  font-size: 15px;
  line-height: 1.5;
  margin: 3px 0;
}
.invoice-client-label {
  color: #63705d;
  font-size: 11px;
}
.invoice-client-card button {
  flex-shrink: 0;
  min-height: 44px;
}
.invoice-client-choice {
  margin-top: 16px;
}
.invoice-client-choice[hidden],
.invoice-client-card button[hidden] {
  display: none;
}
.client-switch-note {
  color: #52624b;
  font-size: 12px;
  line-height: 1.7;
  margin: 0 0 16px;
}
.client-switch-summary {
  display: grid;
  gap: 6px;
  padding: 18px;
  background: #f8f9f4;
  border: 1px solid #dfe4d8;
  border-radius: 12px;
  margin-bottom: 18px;
}
.client-switch-summary span {
  color: #63705d;
  font-size: 11px;
}
.client-switch-summary strong {
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.5;
}
.client-switch-summary strong + span {
  margin-top: 10px;
}
.client-search .client-suggestions {
  position: static;
  margin-top: 8px;
  max-height: 240px;
  box-shadow: none;
}
.invoice-client-choice .picker-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.invoice-client-choice .picker-footer button {
  min-height: 44px;
}
@media (max-width: 640px) {
  .invoice-client-card {
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px;
  }
  .invoice-client-identity {
    flex: 1 1 180px;
  }
}
.editor [data-draft-conflict] .actions {
  flex-wrap: wrap;
}
.contact-panels address {
  white-space: normal;
  overflow-wrap: anywhere;
}
.operation-statuses {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}
.operation-statuses > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  font-size: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.operation-statuses strong {
  text-align: right;
}
.attention-list {
  display: grid;
  gap: 15px;
}
.attention-list .attention-item {
  background: #fff;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.clientcard h3 {
  overflow-wrap: anywhere;
}
.history-aside {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.history-aside .operation-statuses {
  margin-bottom: 0;
}
.invoice-controls {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.invoice-controls summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  min-height: 32px;
}
.invoice-controls > button {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
}
.doc-shipping {
  padding: 16px 0;
  border-top: 1px solid var(--line);
  margin: 18px 0;
  font-size: 12px;
  line-height: 1.8;
}
.doc-shipping label {
  display: block;
  letter-spacing: 1.5px;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 7px;
}
.clientcard {
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.clientcard:focus-within {
  border-color: #9cad8f;
  box-shadow: 0 0 0 2px #edf1e8;
}
@media (hover: hover) {
  .clientcard:hover {
    border-color: #bdc9b1;
    box-shadow: 0 8px 24px #24341b08;
  }
}
@media (prefers-reduced-motion: reduce) {
  .clientcard {
    transition: none;
  }
}
@media (max-width: 700px) {
  .editor .linefields {
    grid-template-columns: 54px minmax(95px, 1fr) 65px 44px;
    gap: 8px;
  }
  .editor .linefields .remove {
    min-width: 44px;
  }
  .editor .linefields input,
  .editor .linefields select,
  .editor .linefields textarea {
    font-size: 16px;
  }
  .editor .linefields input,
  .editor .linefields select {
    padding-left: 8px;
    padding-right: 5px;
  }
  .editor-bottom {
    bottom: calc(68px + env(safe-area-inset-bottom));
    flex-direction: row;
    gap: 8px;
  }
  .editor-bottom > button {
    width: auto;
  }
  .editor-bottom > .primary {
    order: 0;
    flex: 1;
  }
  .editor .date-presets button,
  .editor .presets button {
    min-height: 36px;
  }
  .client-card-actions {
    flex-wrap: wrap;
  }
  .client-toolbar {
    gap: 12px;
  }
  .clientgrid {
    grid-template-columns: 1fr;
  }
  .fields:has([name="sameShipping"]) {
    grid-template-columns: 1fr;
  }
  .fields[data-shipping] {
    grid-template-columns: 1fr;
  }
  .contact-panels {
    grid-template-columns: 1fr;
  }
}
