/* Dealer-portal Orders view. Mirrors the dashboard's card-on-bg layout
   so the two views feel like one product. Status pills reuse the
   accent + success + warning + danger tokens from theme.css. */

.ord-root {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.ord-head { margin-bottom: 28px; }
.ord-head h1 {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--lf-text);
}
.ord-sub {
  font-size: 14px;
  color: var(--lf-text-muted);
  margin: 0;
  line-height: 1.55;
}
.ord-sub a { color: var(--lf-accent); text-decoration: none; }
.ord-sub a:hover { text-decoration: underline; }

.ord-section { margin-bottom: 32px; }
.ord-section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--lf-text-muted);
  margin: 0 0 12px;
}

.ord-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--lf-text-muted);
  margin-bottom: 4px;
}

/* ── Cards ───────────────────────────────────────────────────────── */

.ord-card {
  background: var(--lf-panel);
  border: 1px solid var(--lf-border);
  border-radius: var(--radius, 12px);
  padding: 28px;
}

.ord-catalog h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--lf-text);
}
.ord-empty-lead {
  font-size: 14.5px;
  color: var(--lf-text-muted);
  margin: 0 0 20px;
  line-height: 1.55;
}

.ord-order-card { padding: 24px 28px; }
.ord-order-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}
.ord-order-head h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: var(--lf-text);
}
.ord-requested-at {
  font-size: 12.5px;
  color: var(--lf-text-muted);
  margin: 6px 0 0;
}
.ord-status-body {
  font-size: 14px;
  color: var(--lf-text);
  margin: 0 0 18px;
  line-height: 1.55;
}

.ord-error h1 { font-size: 18px; margin: 0 0 10px; }
.ord-error p { color: var(--lf-text-muted); margin: 0 0 12px; line-height: 1.55; }

.ord-loading {
  padding: 40px;
  text-align: center;
  color: var(--lf-text-muted);
  font-size: 14px;
}

/* ── Catalog grid ────────────────────────────────────────────────── */

.ord-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 20px 0 24px;
}

.ord-sku-card {
  background: var(--lf-bg);
  border: 1px solid var(--lf-border);
  border-radius: var(--radius-sm, 8px);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.12s;
}
.ord-sku-card:hover {
  border-color: var(--lf-accent);
}

.ord-sku-image {
  display: block;
  background: var(--lf-panel);
  border-radius: var(--radius-sm, 8px);
  overflow: hidden;
  aspect-ratio: 1 / 1;
  text-align: center;
  border: 1px solid var(--lf-border);
}
.ord-sku-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.ord-sku-meta {
  flex: 1 1 auto;
  min-height: 0;
}
.ord-sku-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--lf-text);
  margin-bottom: 2px;
}
.ord-sku-subtitle {
  font-size: 12.5px;
  color: var(--lf-text-muted);
  line-height: 1.4;
  margin-bottom: 6px;
}
.ord-sku-link {
  display: inline-block;
  font-size: 12px;
  color: var(--lf-accent);
  text-decoration: none;
}
.ord-sku-link:hover { text-decoration: underline; }

/* ── Quantity controls ───────────────────────────────────────────── */

.ord-qty-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin-top: auto;
}
.ord-qty-btn {
  width: 32px;
  background: var(--lf-panel);
  border: 1px solid var(--lf-border);
  border-radius: var(--radius-sm, 8px);
  color: var(--lf-text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ord-qty-btn:hover {
  background: var(--lf-accent-bg);
  border-color: var(--lf-accent);
  color: var(--lf-accent);
}
.ord-qty-input {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  background: var(--lf-panel);
  border: 1px solid var(--lf-border);
  border-radius: var(--radius-sm, 8px);
  color: var(--lf-text);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  padding: 6px;
}
.ord-qty-input:focus {
  outline: 2px solid var(--lf-accent);
  outline-offset: -1px;
  border-color: var(--lf-accent);
}
.ord-qty-input::-webkit-outer-spin-button,
.ord-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ord-qty-input { appearance: textfield; -moz-appearance: textfield; }

/* ── Totals row ──────────────────────────────────────────────────── */

.ord-totals-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--lf-border);
  margin-bottom: 16px;
  transition: background 0.12s, border-color 0.12s;
}
.ord-totals-row.ord-totals-warn {
  background: var(--lf-bg);
  border-color: var(--lf-border);
}
.ord-totals-row.ord-totals-ok {
  background: var(--lf-success-bg);
  border-color: var(--lf-success-border, var(--lf-success));
}
.ord-totals-summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.ord-total-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--lf-text-muted);
}
.ord-total-count {
  font-size: 22px;
  font-weight: 700;
  color: var(--lf-text);
  min-width: 32px;
  text-align: right;
}
.ord-totals-message { font-size: 13.5px; font-weight: 500; }
.ord-totals-warn-msg { color: var(--lf-text-muted); }
.ord-totals-ok-msg { color: var(--lf-success); font-weight: 600; }

/* ── Item list (existing-order view) ─────────────────────────────── */

.ord-item-block {
  border-top: 1px solid var(--lf-border);
  padding-top: 16px;
  margin-top: 14px;
}
.ord-item-block-title {
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--lf-text-muted);
  margin: 0 0 10px;
}

.ord-item-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}
.ord-item-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 12px;
  background: var(--lf-bg);
  border: 1px solid var(--lf-border);
  border-radius: var(--radius-sm, 8px);
}
.ord-item-qty {
  font-size: 16px;
  font-weight: 700;
  color: var(--lf-accent);
  min-width: 24px;
}
.ord-item-label {
  font-size: 14px;
  color: var(--lf-text);
}

/* ── Terms card ──────────────────────────────────────────────────── */

.ord-terms-card {
  padding: 12px 16px;
  background: var(--lf-bg);
  border: 1px solid var(--lf-border);
  border-radius: var(--radius-sm, 8px);
  font-size: 13.5px;
  color: var(--lf-text-muted);
  margin-bottom: 20px;
  line-height: 1.55;
}
.ord-terms-card strong { color: var(--lf-text); }

/* ── Notes block ─────────────────────────────────────────────────── */

.ord-notes-block {
  padding: 12px 14px;
  background: var(--lf-bg);
  border-left: 3px solid var(--lf-accent);
  border-radius: var(--radius-sm, 8px);
  font-size: 13.5px;
  color: var(--lf-text-muted);
  margin-top: 4px;
}
.ord-notes-block strong { color: var(--lf-text); margin-right: 6px; }

/* ── Buttons ─────────────────────────────────────────────────────── */

.ord-cta-row {
  margin: 18px 0 12px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.ord-btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--radius-sm, 8px);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
  font-family: inherit;
}
.ord-btn-primary {
  background: var(--lf-accent);
  color: var(--lf-accent-contrast);
  border-color: var(--lf-accent);
}
.ord-btn-primary:hover { background: var(--lf-accent-hover); border-color: var(--lf-accent-hover); }
.ord-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--lf-accent);
  border-color: var(--lf-accent);
}
.ord-btn-large {
  padding: 14px 28px;
  font-size: 15px;
}

.ord-link-btn {
  background: none;
  border: none;
  color: var(--lf-accent);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
}
.ord-link-btn:hover { color: var(--lf-accent-hover); }

.ord-fineprint {
  font-size: 12.5px;
  color: var(--lf-text-muted);
  margin: 8px 0 0;
  line-height: 1.55;
}
.ord-fineprint a { color: var(--lf-accent); }
.ord-fineprint a:hover { text-decoration: underline; }

/* ── Status pills ────────────────────────────────────────────────── */

.ord-status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border: 1px solid var(--lf-border);
  background: var(--lf-bg);
  color: var(--lf-text-muted);
}
.ord-status-pill-sm {
  padding: 2px 8px;
  font-size: 10.5px;
  margin-left: 8px;
}
.ord-status-requested {
  background: var(--lf-accent-bg);
  color: var(--lf-accent);
  border-color: var(--lf-accent);
}
.ord-status-draft-ready {
  background: var(--lf-success-bg);
  color: var(--lf-success);
  border-color: var(--lf-success-border);
}
.ord-status-accepted,
.ord-status-in-production {
  background: var(--lf-accent-bg);
  color: var(--lf-accent);
  border-color: var(--lf-accent);
}
.ord-status-shipped,
.ord-status-delivered {
  background: var(--lf-success-bg);
  color: var(--lf-success);
  border-color: var(--lf-success-border);
}
.ord-status-cancelled {
  background: var(--lf-bg);
  color: var(--lf-text-muted);
}

/* ── History rows ────────────────────────────────────────────────── */

.ord-history-row {
  padding: 14px 18px;
  background: var(--lf-panel);
  border: 1px solid var(--lf-border);
  border-radius: var(--radius-sm, 8px);
  margin-bottom: 8px;
}
.ord-history-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--lf-text);
  display: flex;
  align-items: center;
}
.ord-history-when {
  font-size: 12.5px;
  color: var(--lf-text-muted);
  margin-top: 4px;
}

/* ── Mobile ──────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .ord-root { padding: 20px 16px 48px; }
  .ord-card, .ord-order-card { padding: 20px; }
  .ord-order-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .ord-item-list { grid-template-columns: 1fr; }
  .ord-catalog-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .ord-totals-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .ord-totals-summary { justify-content: space-between; }
}
