/* Farmer orders (30/10/2026): quantity controls on the product tiles, the order bar above the bottom navigation,
   the confirm screen, "Đơn của tôi" and the dealer's "Duyệt đơn" list/detail. */

.order-dealer-box { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 12px 14px; border: 1px solid #e3ebe5; border-radius: 14px; background: #f4faf6; color: #163622; font-size: 14px; }
.order-dealer-box > .bi { font-size: 22px; color: var(--mak-green, #0e8b52); }
.order-dealer-box > div { flex: 1; min-width: 0; display: grid; }
.order-dealer-box small { color: #5d6b63; font-size: 12px; }
.order-dealer-box strong { overflow-wrap: anywhere; }
.order-dealer-error { justify-content: space-between; background: #fff5f5; border-color: #f3cfcf; color: #a61b1b; }
.order-dealer-warning { background: #fff1f2; border-color: #fca5a5; color: #9f1239; }
.order-dealer-warning > .bi { color: #dc2626; }
.order-dealer-warning .order-link-btn { color: #b91c1c; font-weight: 700; }
.order-field-error { margin: 0; color: #b42318; font-size: 13px; font-weight: 600; }
.order-my-link { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; flex: none; color: #076837; font-size: 11px; font-weight: 700; line-height: 1.2; text-decoration: none; text-align: center; white-space: nowrap; }
.order-my-link > .bi { font-size: 24px; line-height: 1; }
.order-link-btn { flex: none; border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; }
.order-dealer-missing { background: var(--mak-gold-soft, #fef3c7); border-color: #f4dd96; }
.order-dealer-missing > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.order-dealer-missing .order-link-btn { padding: 0; color: #076837; }

/* Dealer-code dialog: same white card on a dark backdrop as the "Không tải được điểm" screen. Below the leave warning (z 100). */
.order-link-backdrop { z-index: 90; }
.order-link-card { display: grid; justify-items: center; gap: 12px; width: min(100%, 340px); padding: 28px 22px 22px; border-radius: 22px; background: #fff; color: var(--mak-ink, #0f172a); text-align: center; box-shadow: 0 18px 44px rgba(0, 0, 0, .38); }
.order-link-card .app-splash__logo { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 8px 22px rgba(0, 0, 0, .18); }
.order-link-card h2 { margin: 0; font-size: 18px; font-weight: 800; }
.order-link-card p { margin: 0; color: #4b5a51; font-size: 14px; line-height: 1.45; }
.order-link-card .ui-input { width: 100%; text-align: center; text-transform: uppercase; font-size: 17px; font-weight: 700; letter-spacing: .04em; }
.order-link-card .ui-input[aria-invalid="true"] { border-color: #b42318; }
.order-link-card .point-action { width: 100%; margin: 0; }
.order-link-card .order-field-error { margin: -4px 0 0; }

.order-tile { display: flex; flex-direction: column; background: #fff; }
.order-tile-link { display: block; flex: 1; color: inherit; text-decoration: none; }
.order-tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 44px; padding: 4px 8px 8px; }
.order-tile-points { min-width: 0; color: #5d6b63; font-size: 12px; line-height: 1.25; }
.order-tile-points strong { color: #076837; font-size: 14px; }
.order-tile-nopoints { color: #8a958f; font-size: 12px; }
.order-qty { display: inline-flex; align-items: center; gap: 2px; flex: none; border-radius: 999px; background: #eef7f1; }
.order-qty-btn { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 999px; background: var(--mak-green, #0e8b52); color: #fff; font-size: 22px; font-weight: 800; line-height: 1; }
.order-qty-btn:disabled { opacity: 0.45; }
.order-qty-locked:disabled { opacity: 1; background: #eef0f2; color: #b6bcc4; border: 1px solid #dfe3e8; cursor: not-allowed; }
.order-tile-soldout { margin-left: auto; margin-right: 6px; color: #d92d20; font-size: 13px; font-style: italic; font-weight: 600; white-space: nowrap; }
.order-qty-btn:focus-visible { outline: 2px solid #efb721; outline-offset: 2px; }
.order-qty-add { flex: none; }
.order-qty-value { min-width: 26px; color: #163622; font-weight: 800; text-align: center; }

.has-order-bar { padding-bottom: 76px; }
.order-bar { position: fixed; z-index: 49; left: 0; right: 0; bottom: calc(66px + env(safe-area-inset-bottom, 0px)); max-width: 440px; margin-inline: auto; display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #163622; color: #fff; box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.12); }
.order-bar-text { flex: 1; min-width: 0; display: grid; font-size: 14px; line-height: 1.3; }
.order-bar-text small { color: #f6d77a; font-size: 12px; }
.order-bar-btn { flex: none; min-height: 44px; padding: 0 20px; border: 0; border-radius: 12px; background: #f6c03b; color: #163622; font-weight: 800; }
.order-bar-btn:disabled { opacity: 0.55; }

.order-page { display: grid; gap: 12px; }
/* .ui-card has no padding of its own: every order card sets it here. */
.order-review, .order-done, .order-card, .order-reject-form { padding: 16px; }
.order-review { display: grid; gap: 12px; }
.order-review-dealer { display: grid; }
.order-review-dealer small { color: #5d6b63; font-size: 12px; }
.order-lines { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.order-lines li { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 8px; border-bottom: 1px dashed #e3e8e4; font-size: 14px; }
.order-lines li span { min-width: 0; overflow-wrap: anywhere; }
.order-lines li strong { flex: none; color: #076837; }
.order-review-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.order-review-total strong { color: #076837; font-size: 20px; }
.order-note { display: flex; gap: 6px; margin: 0; color: #5d6b63; font-size: 13px; line-height: 1.45; }
.order-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.order-actions .point-action { margin: 0; }
.order-accept { background: var(--mak-green, #0e8b52); }
.order-reject { background: #b42318; border-color: #b42318; color: #fff; }
.order-done { display: grid; justify-items: center; gap: 6px; text-align: center; }
.order-done .bi { color: var(--mak-green, #0e8b52); font-size: 44px; }
.order-done h1 { margin: 0; font-size: 18px; }
.order-done p { margin: 0; color: #4b5a51; }

.order-card { display: grid; gap: 6px; color: inherit; text-decoration: none; }
.order-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.order-card-lines { margin: 0; color: #4b5a51; font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.order-card-lines-list { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; padding: 8px 10px; background: #f8faf9; border: 1px solid #e7efe9; border-radius: 10px; list-style: none; }
.order-card-line-item { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; line-height: 1.4; color: #203527; }
.order-card-line-item:not(:last-child) { padding-bottom: 5px; border-bottom: 1px dashed #e1eae3; }
.order-card-line-item .order-line-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.order-card-line-item .order-line-qty { flex: none; font-weight: 700; color: var(--mak-green, #0e8b52); white-space: nowrap; }
.order-card-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: #5d6b63; }
.order-card-meta strong { flex: none; color: #076837; }
.order-card-time { color: #8a958f; font-size: 12px; }
.order-cancel { justify-self: center; color: #b42318; font-weight: 700; text-align: center; }
.order-cancel:hover, .order-cancel:focus-visible { color: #8e1b13; }
.order-status { flex: none; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.order-status-pending { background: #fef3c7; color: #92400e; }
.order-status-approved { background: #dcfce7; color: #166534; }
.order-status-rejected { background: #fee2e2; color: #991b1b; }
.order-status-cancelled { background: #eef0ee; color: #5d6b63; }
.order-reason { margin: 0; color: #991b1b; font-size: 13px; }
.order-quota { margin: 0 0 4px; color: #4b5a51; font-size: 14px; }
.order-quota .negative, .order-note.negative { color: #b42318; }
.order-reject-form { display: grid; gap: 8px; }
.order-reject-form textarea { resize: vertical; }
.dealer-scan-cta { position: relative; }
.dealer-cta-badge { position: absolute; top: -8px; right: 14px; display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 800; line-height: 1; text-align: center; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.25); pointer-events: none; z-index: 2; }


/* Dealer order stock and line adjustments (migration 056) */
.dealer-order-section-title {
  font-size: 15.5px;
  font-weight: 700;
  color: #0f172a;
  margin: 6px 0 2px;
  letter-spacing: -0.1px;
}

.order-review .dealer-kv {
  font-size: 14px;
  padding: 7px 0;
}
.order-review .dealer-kv span {
  color: #64748b;
  font-size: 14px;
}
.order-review .dealer-kv strong {
  color: #0f172a;
  font-size: 14.5px;
  font-weight: 700;
}

.dealer-order-lines {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}
.dealer-order-lines .dealer-order-line-item {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  padding: 16px 16px !important;
  background: #ffffff !important;
  border: 1px solid #e1eae3 !important;
  border-radius: 16px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  font-size: 14.5px !important;
  transition: all .15s ease !important;
}
.dealer-order-lines .dealer-order-line-item.is-stock-short {
  background: #fffaf5 !important;
  border-color: #fed7aa !important;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.06) !important;
}
.dealer-order-lines .dealer-order-line-item.is-removed {
  background: #f8fafc !important;
  border: 1px dashed #cbd5e1 !important;
  opacity: 0.72 !important;
  box-shadow: none !important;
}
.dealer-order-line-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.order-line-title-wrap {
  flex: 1;
  min-width: 0;
}
.order-line-title-wrap .order-line-name {
  display: block;
  font-size: 16.5px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.order-line-orig-note {
  font-size: 13.5px;
  color: #64748b;
  margin-top: 4px;
  font-weight: 500;
}
.order-line-points {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--mak-green-soft, #e6f6ee);
  border: 1px solid rgba(14, 139, 82, 0.28);
  color: var(--mak-green-dark, #076837);
  font-size: 14.5px;
  font-weight: 800;
  white-space: nowrap;
  letter-spacing: -0.2px;
}
.text-strikethrough { text-decoration: line-through; color: #8a958f !important; }

/* Stock status banner */
.order-stock-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 14px;
}
.order-stock-banner.short {
  background: #fff7ed;
  border: 1px solid #fed7aa;
}
.order-stock-banner.ok {
  background: var(--mak-green-soft, #e6f6ee);
  border: 1px solid rgba(14, 139, 82, 0.25);
}
.order-stock-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}
.order-stock-tag .bi {
  font-size: 15px;
}
.order-stock-tag.order-stock-short {
  color: #c2410c;
}
.order-stock-tag.order-stock-ok {
  color: var(--mak-green-dark, #076837);
}
.order-stock-tag.order-stock-ok .bi {
  color: var(--mak-green, #0e8b52);
}
.order-line-btn-fix {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #ea580c;
  background: #ffffff;
  color: #c2410c;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(234, 88, 12, 0.1);
  transition: all .15s ease;
}
.order-line-btn-fix:hover {
  background: #ea580c;
  color: #ffffff;
}

/* Stepper & Action Controls */
.order-line-ctrls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}
.order-line-ctrls.is-removed {
  justify-content: space-between;
}
.order-line-ctrls.static {
  justify-content: flex-start;
}
.order-line-stepper-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.order-line-stepper-label {
  font-size: 14px;
  color: #334155;
  font-weight: 600;
}
.order-line-stepper {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  padding: 2px 4px;
}
.order-line-step-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  color: var(--mak-green-dark, #076837);
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  transition: all .15s ease;
}
.order-line-step-btn:hover:not(:disabled) {
  background: var(--mak-green, #0e8b52);
  color: #ffffff;
}
.order-line-step-btn:disabled {
  opacity: 0.35;
  background: transparent;
  box-shadow: none;
  cursor: default;
  color: #94a3b8;
}
.order-line-step-qty {
  min-width: 32px;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.order-line-btn-remove {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #fee2e2;
  background: #fef2f2;
  color: #dc2626;
  font-size: 13.5px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s ease;
}
.order-line-btn-remove:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}
.order-removed-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13.5px;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  padding: 5px 12px;
  border-radius: 999px;
}
.order-line-btn-restore {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(14, 139, 82, 0.35);
  background: var(--mak-green-soft, #e6f6ee);
  color: var(--mak-green-dark, #076837);
  font-size: 13.5px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s ease;
}
.order-line-btn-restore:hover {
  background: var(--mak-green, #0e8b52);
  color: #ffffff;
}
.order-line-static-qty {
  font-size: 14.5px;
  color: #475569;
}
.order-line-static-qty strong {
  font-size: 15px;
  color: #0f172a;
}

/* Reject order modal popup */
.reject-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInModal .2s ease;
}
.reject-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.reject-modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 20px;
  padding: 22px 20px 20px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid #f1f5f9;
}
.reject-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.reject-modal-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fef2f2;
  color: #dc2626;
  display: grid;
  place-items: center;
  font-size: 22px;
  flex: none;
}
.reject-modal-title-box {
  flex: 1;
  min-width: 0;
}
.reject-modal-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}
.reject-modal-subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: #64748b;
}

/* Preset options */
.reject-options-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.reject-option-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
}
.reject-option-card:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.reject-option-card input[type="radio"] {
  display: none;
}
.reject-option-card:has(input[type="radio"]:checked) {
  border-color: #ea580c;
  background: #fffaf5;
}
.reject-option-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.reject-option-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}
.reject-option-card:has(input[type="radio"]:checked) .reject-option-title {
  color: #c2410c;
}
.reject-option-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.35;
}
.reject-option-check {
  font-size: 18px;
  color: #e2e8f0;
  flex: none;
}
.reject-option-card:has(input[type="radio"]:checked) .reject-option-check {
  color: #ea580c;
}

/* Custom note textarea */
.reject-custom-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.reject-custom-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}
.reject-custom-label small {
  font-weight: 400;
  color: #64748b;
}
.reject-custom-input {
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13.5px;
  border: 1px solid #cbd5e1;
  resize: vertical;
  min-height: 56px;
}
.reject-custom-input:focus {
  border-color: #ea580c;
  outline: none;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.12);
}
.reject-actions {
  margin-top: 4px;
}
@keyframes fadeInModal {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.order-quota-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.order-quota-row .order-quota {
  margin: 0;
}
.dealer-orders-reload-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #d1d5db;
  border-radius: 50%;
  background: #ffffff;
  color: var(--mak-green-dark, #076837);
  font-size: 15px;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.dealer-orders-reload-btn:hover {
  background: var(--mak-green-soft, #e6f6ee);
  border-color: var(--mak-green, #0e8b52);
  color: var(--mak-green, #0e8b52);
}

/* Redeem success popup (shown on Tickets after exchanging points for codes) */
.redeem-success-overlay { position: fixed; inset: 0; z-index: 1050; display: flex; align-items: center; justify-content: center; padding: 20px; background: color-mix(in srgb, var(--mak-deep, #05281a) 85%, transparent); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.redeem-success-card { position: relative; width: 100%; max-width: 350px; padding: 44px 22px 22px; border-radius: 28px; background: #fff; text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.redeem-success-icon { position: absolute; top: -32px; left: 50%; transform: translateX(-50%); width: 64px; height: 64px; display: grid; place-items: center; border: 4px solid #fff; border-radius: 50%; background: var(--mak-green, #087436); color: #fff; font-size: 32px; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); }
.redeem-success-card h2 { margin: 0 0 6px; font-size: 21px; font-weight: 700; color: #0f172a; }
.redeem-success-card p { margin: 0 0 20px; font-size: 14px; color: #64748b; }
.redeem-success-codes { margin-bottom: 20px; padding: 18px 16px; border: 1.5px dashed var(--mak-green-bright, var(--mak-green, #087436)); border-radius: 18px; background: var(--mak-green-soft, #f0fdf4); }
.redeem-success-code-list { display: flex; flex-direction: column; gap: 6px; font-family: monospace; font-size: 28px; font-weight: 800; letter-spacing: 2px; color: var(--mak-green, #087436); }
.redeem-success-code-list.is-many { font-size: 20px; }
.redeem-success-codes span { display: block; margin-top: 8px; font-size: 13px; font-weight: 600; text-transform: uppercase; color: var(--mak-green-dark, #166534); }
.redeem-success-primary { width: 100%; margin: 0; border: 0; background: linear-gradient(135deg, var(--mak-gold, #ffc42e), var(--mak-gold-dark, #e08a00)); color: #1a1a1a; font-weight: 800; box-shadow: 0 6px 16px color-mix(in srgb, var(--mak-gold, #ffc42e) 45%, transparent); }
.redeem-success-secondary { display: block; margin-top: 10px; padding: 10px; border-radius: 14px; background: #f8fafc; font-size: 14.5px; color: #64748b; text-decoration: none; }
