/* ============================================================
   Orders module styles (Sales > Orders)
   Scoped under #orders-root, ord- prefixed — mirrors the look
   approved in the reference mockup (Inter font, cream/ink palette),
   deliberately independent of the app's global Fraunces/gold theme.
   ============================================================ */

#orders-root {
  font-family: 'Inter', sans-serif;
  background: #F6F3EA;
  color: #22262E;
  padding: 24px 20px 40px;
}
#orders-root * { box-sizing: border-box; }
.ord-container { max-width: 1180px; margin: 0 auto; }

/* ---------- Topbar ---------- */
.ord-topbar { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.ord-title { font-family: 'Inter', sans-serif; font-weight: 800; font-size: 30px; margin: 0; color: #20242B; }
.ord-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ord-search-wrap { position: relative; }
.ord-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #8B8577; pointer-events: none; display: flex; }

/* ---------- Form controls ---------- */
.ord-input, .ord-select {
  height: 38px; border-radius: 9px; border: 1px solid #DDD6C4; background: #FFFFFF;
  font-size: 13px; padding: 0 10px; font-family: 'Inter', sans-serif; color: #22262E;
}
.ord-input.ord-search { padding-left: 32px; width: 220px; }
.ord-select.ord-type-filter { width: 150px; }
.ord-field-full { width: 100%; }
.ord-textarea {
  border-radius: 9px; border: 1px solid #DDD6C4; background: #FFFFFF; font-size: 13px;
  padding: 10px; font-family: 'Inter', sans-serif; color: #22262E; resize: vertical; width: 100%;
}
.ord-label { font-size: 11.5px; color: #8B8577; margin-bottom: 4px; font-weight: 500; display: block; }
.ord-field { display: flex; flex-direction: column; }

/* ---------- Buttons ---------- */
.ord-btn { font-family: 'Inter', sans-serif; cursor: pointer; }
.ord-btn-primary {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 9px;
  border: none; background: #20242B; color: #F6F3EA; font-size: 13px; font-weight: 700; cursor: pointer;
}
.ord-btn-secondary {
  height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid #DDD6C4; background: #FFFFFF;
  color: #22262E; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.ord-btn-teal { border: none; background: #2F6E6E; color: #FFFFFF; }
.ord-btn-danger-fill { border: none; background: #B5453A; color: #FFFFFF; }
.ord-btn-danger-text { background: none; border: none; color: #B5453A; font-size: 12px; cursor: pointer; padding: 0; }
.ord-btn-text { background: none; border: none; color: #8B8577; font-size: 12px; cursor: pointer; padding: 0; }
.ord-btn-link-teal { background: none; border: none; color: #2F6E6E; font-size: 11.5px; font-weight: 600; cursor: pointer; padding: 0; }
.ord-btn-reactivate { background: none; border: none; color: #2F6E6E; font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; display: flex; align-items: center; gap: 4px; }
.ord-btn-dark-fill {
  height: 38px; border-radius: 8px; border: none; background: #20242B; color: #F6F3EA;
  font-weight: 600; font-size: 13px; cursor: pointer;
}
.ord-btn-dark-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 999px;
  border: none; background: #20242B; color: #F6F3EA; font-weight: 700; font-size: 13.5px; cursor: pointer;
}
.ord-btn-dark-pill.ord-disabled, .ord-btn[disabled] { background: #D8D2C2 !important; cursor: not-allowed !important; }

/* ---------- Pills / tags ---------- */
.ord-pill { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.ord-pill-sm { font-size: 10.5px; padding: 1px 7px; }
.ord-tag { font-size: 11px; font-weight: 500; background: #F1EFE8; color: #5F5E58; padding: 3px 9px; border-radius: 6px; }

/* ---------- Overview table ---------- */
.ord-table-scroll { overflow-x: auto; }
.ord-table-wrap { background: #FFFFFF; border: 1px solid #EAE4D4; border-radius: 10px; overflow: hidden; min-width: 720px; }
.ord-table-head, .ord-row {
  display: grid; grid-template-columns: 150px 1fr 1fr 150px 120px; gap: 10px;
}
.ord-table-head {
  padding: 10px 18px; font-size: 10.5px; color: #8B8577; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 700; border-bottom: 1px solid #EFEADB;
}
.ord-row {
  align-items: center; padding: 14px 18px; border-bottom: 1px solid #F1EFE8; cursor: pointer;
  transition: box-shadow .12s ease; background: #FFFFFF;
}
.ord-row:last-child { border-bottom: none; }
.ord-row:hover { box-shadow: 0 4px 12px rgba(34,38,46,0.10); position: relative; z-index: 1; }
.ord-row.ord-row-cancelled { opacity: .55; }
.ord-row-id { font-weight: 700; font-size: 13px; color: #20242B; }
.ord-row-sub { font-size: 11px; color: #8B8577; margin-top: 1px; }
.ord-row-strike { text-decoration: line-through; }
.ord-row-primary { font-size: 13px; font-weight: 600; color: #22262E; }
.ord-row-placeholder { color: #B3AB98; font-weight: 400; font-style: italic; }
.ord-due-cell { text-align: right; }
.ord-due-date { font-size: 12.5px; font-weight: 700; color: #22262E; }
.ord-due-date.ord-overdue { color: #B5453A; }
.ord-due-overdue-label { font-size: 11px; font-weight: 600; color: #B5453A; margin-top: 1px; }
.ord-due-dash { font-size: 12px; color: #B3AB98; }
.ord-empty { font-size: 13px; color: #B3AB98; font-style: italic; padding: 30px 0; text-align: center; }
.ord-loading { padding: 40px; text-align: center; color: #8B8577; font-size: 13px; }

/* ---------- Type picker (new order) ---------- */
.ord-type-grid { display: flex; gap: 12px; flex-wrap: wrap; }
.ord-type-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; text-align: left;
  border: 1px solid #DDD6C4; border-radius: 12px; padding: 18px 16px; background: #FFFFFF; cursor: pointer;
  flex: 1; min-width: 140px; transition: transform .12s ease, box-shadow .12s ease;
}
.ord-type-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(34,38,46,0.10); }
.ord-type-icon { width: 36px; height: 36px; border-radius: 9px; background: #F1EFE8; display: flex; align-items: center; justify-content: center; color: #20242B; }
.ord-type-label { font-weight: 700; font-size: 14px; color: #20242B; }
.ord-type-desc { font-size: 11.5px; color: #8B8577; margin-top: 2px; }

/* ---------- Chip picker (category) ---------- */
.ord-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ord-chip {
  padding: 7px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; cursor: pointer;
  border: 1px solid #DDD6C4; background: #FFFFFF; color: #6B7280;
}
.ord-chip.ord-chip-active { border: 1.5px solid #20242B; background: #20242B; color: #F6F3EA; }

/* ---------- Form layout ---------- */
.ord-form { display: flex; flex-direction: column; gap: 6px; }
.ord-section-title { font-size: 12.5px; font-weight: 700; color: #20242B; margin-top: 10px; }
.ord-section-title:first-child { margin-top: 0; }
.ord-row-flex { display: flex; gap: 10px; flex-wrap: wrap; }
.ord-row-flex > * { flex: 1; min-width: 120px; }
.ord-checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #22262E; margin-top: 10px; font-weight: 700; cursor: pointer; }
.ord-exchange-hint { font-size: 12px; color: #6B7280; white-space: nowrap; }

/* ---------- Diamond / stone line rows ---------- */
.ord-line-row { border: 1px solid #EAE4D4; border-radius: 8px; padding: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.ord-line-remove { background: #F6E9E6; color: #B5453A; border: none; border-radius: 6px; width: 30px; height: 30px; cursor: pointer; flex-shrink: 0; }
.ord-line-field-sm { width: 80px; }
.ord-line-field-md { width: 100px; }

/* ---------- Modal shell ---------- */
.ord-modal-overlay {
  position: fixed; inset: 0; background: rgba(34,38,46,0.45); display: flex; align-items: center;
  justify-content: center; padding: 16px; z-index: 200;
}
.ord-modal-box {
  background: #FFFFFF; border-radius: 14px; padding: 24px; max-width: 100%; max-height: 90vh; overflow-y: auto;
}
.ord-modal-box::-webkit-scrollbar { width: 8px; }
.ord-modal-box::-webkit-scrollbar-thumb { background: #D8D2C2; border-radius: 4px; }
.ord-modal-header {
  position: sticky; top: 0; background: #FFFFFF; z-index: 5; display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 16px; padding-bottom: 4px;
}
.ord-modal-title { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 19px; margin: 0; color: #20242B; }
.ord-modal-close { background: none; border: none; cursor: pointer; color: #8B8577; display: flex; padding: 0; }
.ord-modal-back {
  background: none; border: none; color: #8B8577; font-size: 12px; cursor: pointer; padding: 0;
  margin-top: -10px; margin-bottom: 14px; display: flex; align-items: center; gap: 4px;
}

/* ---------- Order detail modal ---------- */
.ord-detail-head { margin-top: -10px; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.ord-detail-name-row { display: flex; align-items: center; gap: 8px; }
.ord-detail-name { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 22px; margin: 0; color: #20242B; }
.ord-star-btn { background: none; border: none; cursor: pointer; padding: 2px; color: #D8D2C2; display: flex; }
.ord-star-btn.ord-star-active { color: #C9962F; }
.ord-type-meta { font-size: 12.5px; color: #8B8577; margin-top: 2px; }
.ord-pill-row { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.ord-manufacturer-block { text-align: right; flex-shrink: 0; }
.ord-eyebrow { font-size: 10.5px; color: #8B8577; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.ord-manufacturer-name { font-weight: 700; font-size: 13.5px; color: #20242B; margin-top: 2px; }
.ord-place-order-btn { margin-top: 8px; font-size: 11.5px; font-weight: 600; color: #2F6E6E; background: none; border: none; cursor: pointer; padding: 0; }

.ord-infobox-row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.ord-infobox { background: #F6F3EA; border-radius: 8px; padding: 10px 12px; flex: 1; min-width: 140px; }
.ord-infobox-label { font-size: 10.5px; color: #8B8577; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.ord-infobox-value { font-weight: 600; font-size: 13.5px; margin-top: 2px; color: #22262E; }
.ord-infobox-sub { font-size: 12px; color: #6B7280; margin-top: 1px; }

.ord-block-title { font-size: 13.5px; font-weight: 700; margin: 20px 0 8px; color: #20242B; }
.ord-repair-photo { width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; border: 1px solid #EAE4D4; }

/* CAD */
.ord-cad-upload {
  display: flex; align-items: center; justify-content: center; height: 160px; border-radius: 10px;
  border: 1.5px dashed #DDD6C4; background: #F6F3EA; cursor: pointer; overflow: hidden; position: relative;
}
.ord-cad-upload img { width: 100%; height: 100%; object-fit: cover; }
.ord-cad-empty { text-align: center; color: #B3AB98; font-size: 12.5px; }
.ord-cad-empty svg { margin-bottom: 4px; }
.ord-cad-version-badge { position: absolute; top: 8px; left: 8px; background: rgba(255,255,255,0.92); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }

.ord-file-row { display: flex; justify-content: space-between; align-items: center; background: #FFFFFF; border: 1px solid #EAE4D4; border-radius: 8px; padding: 10px 12px; margin-top: 10px; }
.ord-file-info { display: flex; align-items: center; gap: 8px; }
.ord-file-name { font-size: 12.5px; font-weight: 600; }
.ord-file-size { font-size: 11px; color: #8B8577; }
.ord-file-upload-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 8px;
  border: 1.5px dashed #DDD6C4; background: #F6F3EA; cursor: pointer; color: #8B8577; font-size: 12.5px; margin-top: 10px;
}

/* Reference photos (client/stock/repair — attached at any point, not just intake) */
.ord-refphoto-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.ord-refphoto-thumb-wrap { position: relative; flex: none; width: 84px; height: 84px; }
.ord-refphoto-thumb { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; border: 1px solid #EAE4D4; }
.ord-refphoto-remove { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid #E3C3BB; background: #F6E9E6; color: #B5453A; font-size: 11px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
/* Overrides style.css's generic `label { flex:1; flex-direction:column }` —
   this label is a fixed-size upload tile in a photo grid, not a form field. */
.ord-refphoto-add { flex: none; width: 84px; height: 84px; border-radius: 8px; border: 1.5px dashed #DDD6C4; background: #F6F3EA; cursor: pointer; display: flex; flex-direction: row; align-items: center; justify-content: center; color: #8B8577; }
.ord-refphoto-add.uploading { opacity: .6; cursor: wait; }

.ord-approval-row { display: flex; justify-content: space-between; align-items: center; background: #FFFFFF; border: 1px solid #EAE4D4; border-radius: 8px; padding: 10px 12px; margin-top: 10px; gap: 10px; flex-wrap: wrap; }
.ord-approval-sub { font-size: 11.5px; color: #8B8577; margin-top: 1px; }
.ord-approval-note { font-size: 11.5px; color: #B5453A; margin-top: 1px; font-style: italic; }
.ord-btn-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* Timeline */
.ord-timeline-row { display: flex; gap: 12px; }
.ord-timeline-dotcol { display: flex; flex-direction: column; align-items: center; }
.ord-timeline-dot {
  width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: #B3AB98; font-size: 11px; font-weight: 700; flex-shrink: 0; background: #EEF0F2;
}
.ord-timeline-dot.ord-done { color: #FFFFFF; }
.ord-timeline-dot.ord-current { background: #FFFFFF; border-width: 2px; border-style: solid; }
.ord-timeline-line { width: 2px; flex: 1; min-height: 24px; background: #E3DDCC; }
.ord-timeline-body { padding-bottom: 18px; }
.ord-timeline-stagehead { display: flex; align-items: center; gap: 8px; }
.ord-timeline-stagename { font-weight: 600; font-size: 13.5px; color: #22262E; }
.ord-timeline-date { font-size: 11.5px; color: #8B8577; margin-top: 1px; }
.ord-timeline-note { font-size: 12px; color: #8B8577; font-style: italic; margin-top: 2px; }

/* Log update */
.ord-eyebrow-strong { font-size: 11.5px; font-weight: 700; color: #8B8577; text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 8px; }
.ord-logtype-btn { height: 34px; padding: 0 14px; border-radius: 999px; cursor: pointer; font-size: 12.5px; font-weight: 600; background: #FFFFFF; border: 1.5px solid #DDD6C4; color: #6B7280; }
.ord-logtype-btn.ord-active-teal { border-color: #2F6E6E; color: #2F6E6E; }
.ord-logtype-btn.ord-active-gold { border-color: #C9962F; color: #C9962F; }
.ord-log-form-row { display: flex; gap: 10px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.ord-log-form-row .ord-input { width: 160px; }
.ord-log-form-row .ord-btn-dark-fill { flex: 1; min-width: 140px; }
.ord-err-text { font-size: 12px; color: #B5453A; margin-top: 6px; }
.ord-hint-text { font-size: 11.5px; color: #8B8577; margin-top: 6px; }
.ord-hint-text.ord-err { color: #B5453A; }

/* Updates list */
.ord-update-item { display: flex; justify-content: space-between; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid #F1EFE8; gap: 10px; }
.ord-update-item:last-child { border-bottom: none; }
.ord-update-note { font-size: 12px; color: #6B7280; margin-top: 4px; font-style: italic; }
.ord-update-date { font-size: 11.5px; color: #8B8577; white-space: nowrap; margin-left: 10px; }

.ord-status-actions { display: flex; gap: 14px; margin-top: 14px; flex-wrap: wrap; }

/* Payments */
.ord-payment-row { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; padding: 7px 0; border-bottom: 1px solid #EFEADB; gap: 10px; }
.ord-payment-row:last-child { border-bottom: none; }
.ord-payment-meta { color: #6B7280; }
.ord-payment-amount { font-weight: 600; }
.ord-payment-right { display: flex; align-items: center; gap: 10px; }

/* WhatsApp send — order confirmation */
.ord-wa-block { margin: 10px 0 4px; }
.ord-wa-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 8px;
  border: none; background: #2F6E6E; color: #FFFFFF; font-size: 12.5px; font-weight: 700;
  font-family: 'Inter', sans-serif; cursor: pointer;
}
.ord-wa-btn:disabled { opacity: .65; cursor: default; }
.ord-wa-btn.ord-wa-btn-sent { background: #E9F4EC; color: #3F7D4F; }
.ord-wa-status { font-size: 11px; color: #8B8577; margin-top: 6px; }
.ord-wa-status.ord-wa-sent { color: #3F7D4F; font-weight: 600; }
.ord-wa-status.ord-wa-failed { color: #B5453A; font-weight: 600; }
.ord-wa-status.ord-wa-skipped { color: #8B8577; }

/* WhatsApp send — payment resend */
.ord-wa-resend-btn {
  display: flex; align-items: center; gap: 5px; background: none; border: 1px dashed #2F6E6E; color: #2F6E6E;
  font-size: 10.5px; font-weight: 600; border-radius: 6px; padding: 3px 8px; cursor: pointer; font-family: 'Inter', sans-serif;
}
.ord-wa-resend-btn:disabled { opacity: .55; cursor: default; border-style: solid; border-color: #DDD6C4; color: #8B8577; }
.ord-wa-sentcheck { display: flex; align-items: center; gap: 5px; color: #3F7D4F; font-size: 10.5px; font-weight: 600; }

/* WhatsApp send — log payment checkbox */
.ord-wa-checkrow { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; padding: 10px; background: #F6F3EA; border-radius: 8px; }
.ord-wa-checkrow input { margin-top: 2px; accent-color: #2F6E6E; width: 15px; height: 15px; flex-shrink: 0; }
.ord-wa-checkrow .ord-wa-check-copy { font-size: 12.5px; color: #22262E; font-weight: 600; line-height: 1.4; }
.ord-wa-checkrow .ord-wa-check-sub { font-size: 11px; color: #8B8577; font-weight: 400; margin-top: 2px; display: block; }

/* Manufacturer message */
.ord-message-box { font-family: monospace; font-size: 12.5px; line-height: 1.6; background: #F6F3EA; width: 100%; height: 300px; }

/* Customer picker (search existing lead/client, or add new inline) */
.ord-cust-picker { position: relative; }
.ord-cust-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20;
  background: #FFFFFF; border: 1px solid #DDD6C4; border-radius: 9px; box-shadow: 0 8px 20px rgba(34,38,46,0.12);
  max-height: 260px; overflow-y: auto;
}
.ord-cust-result-row { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #F1EFE8; }
.ord-cust-result-row:last-child { border-bottom: none; }
.ord-cust-result-row:hover { background: #F6F3EA; }
.ord-cust-result-name { font-size: 12.5px; font-weight: 600; color: #22262E; }
.ord-cust-result-code { font-size: 10.5px; font-weight: 600; color: #8B8577; margin-left: 6px; }
.ord-cust-result-phone { font-size: 11.5px; color: #6B7280; margin-top: 1px; }
.ord-cust-add-new { color: #2F6E6E; font-weight: 600; font-size: 12.5px; }

.ord-cust-selected-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #F6F3EA; border: 1px solid #DDD6C4; border-radius: 9px; padding: 10px 12px;
}
.ord-cust-selected-name { font-size: 13px; font-weight: 700; color: #20242B; }
.ord-cust-selected-code { font-size: 10.5px; font-weight: 700; color: #2F6E6E; background: #E9F2F1; padding: 1px 7px; border-radius: 999px; margin-left: 6px; }
.ord-cust-selected-code.ord-cust-new-badge { color: #C9962F; background: #FBF1DF; }
.ord-cust-selected-phone { font-size: 11.5px; color: #6B7280; margin-top: 2px; }

.ord-cust-new-inline { background: #F6F3EA; border: 1px solid #DDD6C4; border-radius: 9px; padding: 12px; }
/* .hidden is already defined globally in style.css — reused as-is here */

@media (max-width: 640px) {
  .ord-topbar { flex-direction: column; align-items: stretch; }
  .ord-controls { flex-direction: column; align-items: stretch; }
  .ord-input.ord-search { width: 100%; }
  .ord-select.ord-type-filter { width: 100%; }
  .ord-type-grid { flex-direction: column; }
}
