/* =========================================================
   ORDER VIEW (ov- prefix)
   ========================================================= */
/* ========================================
   Order view – herstel layout-betrouwbaarheid
   ======================================== */

.ov-page input,
.ov-page textarea {
  transform: none;
}

.ov-page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: #222;
}

.ov-title {
  margin-bottom: 16px;
}

/* ---------- Grid ---------- */
.ov-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;

}

.ov-grid-2 {
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .ov-grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- Cards ---------- */
.ov-card {
  background: #f6f7f9;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
}

.ov-card-title {
  margin: 0 0 12px 0;
  font-size: 1.1rem;
}

/* ---------- Status badge ---------- */
.ov-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.85em;
}

.ov-status-open {
  background: #d1e7dd;
  color: #0f5132;
}

.ov-status-cancelled {
  background: #f8d7da;
  color: #842029;
}

.ov-status-completed {
  background: #cff4fc;
  color: #055160;
}

/* ---------- Buttons ---------- */
.ov-btn {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 14px;
}

.ov-btn-primary {
  background: #0d6efd;
  color: #fff;
}

.ov-btn-secondary {
  background: #f1f3f5;
  color: #333;
}

.ov-btn-danger {
  background: #dc3545;
  color: #fff;
}

/* ---------- Button groups ---------- */
.ov-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Tables ---------- */
.ov-table-wrapper {
  overflow-x: auto;
}

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

.ov-table th,
.ov-table td {
  padding: 8px;
  border-bottom: 1px solid #ddd;
  text-align: left;
}

/* ---------- Memo's ---------- */
.ov-memo {
  border-left: 4px solid #ddd;
  padding-left: 12px;
  margin-bottom: 12px;
}

.ov-memo-meta {
  font-size: 0.85em;
  color: #555;
  margin-bottom: 4px;
}

.ov-memo-add {
  margin-top: 12px;
}
/* =======================
   Memo’s
   ======================= */

.ov-memo-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ov-memo-item {
  background: #f9fafb;
  border: 1px solid #e3e6ea;
  border-radius: 6px;
  padding: 12px;
}

.ov-memo-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 6px;
}

.ov-memo-user {
  font-weight: 600;
  color: #222;
}

.ov-memo-date {
  color: #777;
}

.ov-memo-delete {
  margin-left: auto;
}

.ov-memo-body {

  line-height: 1.4;
  color: #222;
}

/* ----- memo toevoegen ----- */

.ov-memo-add {
  margin-top: 16px;
}

.ov-memo-add-summary {
  cursor: pointer;
  color: #0d6efd;
  font-weight: 500;
}

.ov-memo-form {
  margin-top: 8px;
}

.ov-memo-textarea {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
  margin-bottom: 8px;
  font-family: inherit;
  font-size: 0.95rem;
}

/* Kleine knop variant */
.ov-btn-small {
  padding: 4px 8px;
  font-size: 0.75rem;
}
.ov-memo-deleted {
  background: #f1f3f5;
  border: 1px dashed #ccc;
  color: #666;
  font-style: italic;
}

.ov-memo-deleted-text {
  font-size: 0.6rem;
    opacity: 0.6;
    font-style: italic;
}
.ov-memo-empty {
  color: #777;
  font-style: italic;
  padding: 0px 0;
}
/* Klant visitekaart */
.ov-client-card-body {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ov-client-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #2563eb; /* blauw accent */
  color: #fff;
  font-weight: 600;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ov-client-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ov-client-name {
  font-weight: 600;
  font-size: 15px;
}

.ov-client-email {
  font-size: 13px;
  color: #2563eb;
  word-break: break-all;
}

.ov-client-address {
  font-size: 13px;
  color: #555;
  line-height: 1.4;
}
.ov-client-phones {
  font-size: 13px;
  color: #444;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ov-client-phones a {
  color: inherit;
  text-decoration: none;
}

.ov-client-phones a:hover {
  text-decoration: underline;
}
.ov-client-phones:empty {
  display: none;
}
.ov-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ov-table th.num,
.ov-table td.num {
  text-align: right;
  white-space: nowrap;
}

.ov-table td.actions {
  white-space: nowrap;
}
.ov-add-line {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed #ccc;
}

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

.ov-form-actions {
  grid-column: span 6;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.ov-line-edit td {
  background: #f9fafb;
}

.ov-line-form {
  padding: 12px;
}

.ov-table td.actions {
  white-space: nowrap;
}

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

.ov-form-actions {
  grid-column: span 6;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

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


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

  .ov-form-actions {
    justify-content: stretch;
  }
}

/* Mobiel */
@media (max-width: 640px) {
  .ov-client-card-body {
    align-items: flex-start;
  }
}
.ov-add-line-card {
  margin: 8px 0 12px;
  padding: 8px;
  background: #f9fafb;
  border: 1px dashed #d0d7de;
  border-radius: 6px;
}

.ov-add-line-card input,
.ov-add-line-card select {
  width: 100%;
  box-sizing: border-box;
}

.ov-table-compact td {
  padding-top: 6px;
  padding-bottom: 6px;
}
#orderregels .ov-card-header {
  margin-bottom: 16px;
}

.ov-table thead th {
  background: #e5e7eb;
  color: #111827;
  font-weight: 600;
  border-bottom: 1px solid #d1d5db;
}

.ov-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

.ov-table tbody tr:nth-child(even) {
  background: #f9fafb;
}

.ov-table tbody tr:hover {
  background: #eef2f7;
}

.ov-table tbody tr:has(.ov-edit:not([hidden])) {
  background: #eef6ff;
}

.ov-table td.num,
.ov-table th.num {
  text-align: right;
  white-space: nowrap;
}

.ov-table td.actions {
  text-align: right;
  white-space: nowrap;
}

.ov-table input,
.ov-table select {
  padding: 4px 6px;
  font-size: 0.9rem;
}
/* Concept-acties naast elkaar */
.ov-concept-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

/* Rode gevaar-knop */
.ov-btn-danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.ov-btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}
/* Gedeelde info-lijsten in cards */
.ov-info-list {
    font-size: 14px;
    line-height: 1.35;
}

.ov-info-list > div {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}

.ov-info-list > div:last-child {
    margin-bottom: 0;
}

.ov-info-list strong {
    font-weight: 600;
    color: #444;
}
.ov-info-list > div strong {
    min-width: 110px;
    display: inline-block;
}
/* =========================
   Form layout
   ========================= */

.ov-form {
  display: flex;
  flex-direction: column;
}

.ov-form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ov-form-row label {
  font-weight: 600;
  font-size: 13px;
  color: #444;
}

/* Inputs / textarea uniform */
.ov-form-row input,
.ov-form-row textarea,
.ov-form-row select {
  width: 100%;
  box-sizing: border-box;

  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.4;

  border: 1px solid #ccc;
  border-radius: 4px;

  background-color: #fff;
}

/* Textarea specifieke afstemming */
.ov-form-row textarea {
  resize: vertical;
  min-height: 90px;
}

/* Checkbox row */
.ov-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.ov-checkbox input {
  width: auto;
}

/* Actieknoppen */
.ov-form-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Focus states */
.ov-form-row input:focus,
.ov-form-row textarea:focus,
.ov-form-row select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25);
}
/* =========================
   Order create layout
   ========================= */

.ov-grid-order-create {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 16px;
  align-items: start; /* ⬅️ CRUCIAAL */
}

/* Linkerkolom: kaarten onder elkaar */
.ov-left-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}


.ov-card-client .ov-form-row:has([name="email"]) {
  grid-column: 1 / -1;
}
/* Mobiel */
@media (max-width: 900px) {

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

  /* Volgorde mobiel */
  .ov-card-load   { order: 1; }
  .ov-card-client { order: 2; }
  .ov-card-order  { order: 3; }

  /* Left column hoeft niet meer te groeperen */
  .ov-left-column {
    display: contents;
  }
}

/* Klant laden knop niet full width */
.ov-card-load .ov-btn {
  width: auto;
  align-self: flex-start;
    background-color: #4b5563; /* donkergrijs */
  border-color: #4b5563;
  color: #fff;
}

/* =========================
   Klantgegevens – strakke en gelijke uitlijning
   ========================= */

/* Basis: klantformulier is een grid */
.ov-card-client .ov-form {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  row-gap: 14px;     /* verticale spacing */
  column-gap: 14px;    /* 🔑 voorkomt meetellen in breedte */
}

.ov-card-client .ov-form-row {
  min-width: 0; /* 🔑 voorkomt overflow in grid */
}

.ov-card-client .ov-form-row input,
.ov-card-client .ov-form-row textarea,
.ov-card-client .ov-form-row select {
  width: 100%;
  box-sizing: border-box;
}


/* =========================
   Desktop (≥ 901px)
   ========================= */
@media (min-width: 901px) {

  /* E-mail: altijd volledige breedte */
  .ov-card-client .ov-form-row:has([name="email"]) {
    grid-column: 1 / -1;
  }

  /* Voornaam + tussenvoegsel */
  .ov-card-client .ov-form-row:has([name="first_name"]) {
    grid-column: 1 / 7;
  }
  .ov-card-client .ov-form-row:has([name="middle_name"]) {
    grid-column: 7 / -1;
  }

  /* Achternaam */
  .ov-card-client .ov-form-row:has([name="last_name"]) {
    grid-column: 1 / -1;
  }

  /* Straat + huisnummer + toevoeging */
  .ov-card-client .ov-form-row:has([name="street"]) {
    grid-column: 1 / 7;
  }
  .ov-card-client .ov-form-row:has([name="house_no"]) {
    grid-column: 7 / 9;
  }
  .ov-card-client .ov-form-row:has([name="addition"]) {
    grid-column: 9 / -1;
  }

  /* Postcode + woonplaats */
  .ov-card-client .ov-form-row:has([name="postcode"]) {
    grid-column: 1 / 5;
  }
  .ov-card-client .ov-form-row:has([name="city"]) {
    grid-column: 5 / -1;
  }

  /* Telefoon / mobiel */
  .ov-card-client .ov-form-row:has([name="phone"]),
  .ov-card-client .ov-form-row:has([name="mobile"]) {
    grid-column: 1 / -1;
  }
}

/* =========================
   Mobiel (≤ 900px)
   ========================= */
@media (max-width: 900px) {

  .ov-card-client .ov-form {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Volle breedte velden */
  .ov-card-client .ov-form-row:has([name="email"]),
  .ov-card-client .ov-form-row:has([name="last_name"]),
  .ov-card-client .ov-form-row:has([name="street"]),
  .ov-card-client .ov-form-row:has([name="postcode"]),
  .ov-card-client .ov-form-row:has([name="city"]),
  .ov-card-client .ov-form-row:has([name="phone"]),
  .ov-card-client .ov-form-row:has([name="mobile"]) {
    grid-column: 1 / -1;
  }

  /* Voornaam + tussenvoegsel */
  .ov-card-client .ov-form-row:has([name="first_name"]) {
    grid-column: 1 / 3;
  }
  .ov-card-client .ov-form-row:has([name="middle_name"]) {
    grid-column: 3 / -1;
  }

  /* Huisnummer + toevoeging */
  .ov-card-client .ov-form-row:has([name="house_no"]) {
    grid-column: 1 / 3;
  }
  .ov-card-client .ov-form-row:has([name="addition"]) {
    grid-column: 3 / -1;
  }
}
