/* ============================================================
   Phase 21b: Order detail page polish
   Scoped to /admin/orders/<id> only via body.p21-order-detail
   ============================================================ */

body.p21-order-detail {
  background: #f8fafc !important;
}

body.p21-order-detail .page-hero,
body.p21-order-detail .soft-card,
body.p21-order-detail .order-main-card {
  border: 1px solid #e2e8f0 !important;
  border-radius: 20px !important;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .06) !important;
  overflow: hidden;
}

body.p21-order-detail .page-hero {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
}

body.p21-order-detail .page-hero h1 {
  font-weight: 950 !important;
  letter-spacing: -.03em !important;
  color: #0f172a !important;
  word-break: normal !important;
  overflow-wrap: anywhere !important;
}

body.p21-order-detail .hero-subtitle {
  color: #64748b !important;
  font-weight: 750 !important;
}

body.p21-order-detail .badge {
  border-radius: 999px !important;
  font-weight: 850 !important;
}

body.p21-order-detail .hero-summary-grid,
body.p21-order-detail .payment-overview-grid {
  gap: .7rem !important;
}

body.p21-order-detail .hero-stat-card,
body.p21-order-detail .payment-stat {
  border-radius: 16px !important;
  border: 1px solid #e2e8f0 !important;
  background: #ffffff !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .04) !important;
}

body.p21-order-detail .hero-stat-card .label,
body.p21-order-detail .payment-stat .label {
  color: #64748b !important;
  font-weight: 900 !important;
  text-transform: uppercase;
  letter-spacing: .035em;
}

body.p21-order-detail .hero-stat-card .value,
body.p21-order-detail .payment-stat .value {
  color: #0f172a !important;
  font-weight: 950 !important;
}

body.p21-order-detail .section-title-row h2,
body.p21-order-detail .section-title-row h3 {
  font-weight: 950 !important;
  letter-spacing: -.02em !important;
  color: #0f172a !important;
}

body.p21-order-detail .section-note,
body.p21-order-detail .summary-clean-note {
  color: #64748b !important;
  font-weight: 650 !important;
}

body.p21-order-detail .form-control,
body.p21-order-detail .form-select {
  border-radius: 13px !important;
  border-color: #cbd5e1 !important;
}

body.p21-order-detail .form-control:focus,
body.p21-order-detail .form-select:focus {
  border-color: #334155 !important;
  box-shadow: 0 0 0 .2rem rgba(15, 23, 42, .11) !important;
}

body.p21-order-detail .btn {
  border-radius: 13px !important;
  font-weight: 850 !important;
}

/* Desktop polish */
@media (min-width: 768px) {
  body.p21-order-detail main,
  body.p21-order-detail .container,
  body.p21-order-detail .container-fluid {
    max-width: 1320px !important;
  }

  body.p21-order-detail .page-hero {
    padding: 1.15rem !important;
  }

  body.p21-order-detail .hero-actions {
    max-width: 560px;
    justify-content: flex-end !important;
  }

  body.p21-order-detail .hero-actions .btn,
  body.p21-order-detail .hero-actions form button {
    min-height: 34px !important;
    font-size: .78rem !important;
    padding: .32rem .55rem !important;
  }

  body.p21-order-detail .card-body {
    padding: 1rem !important;
  }

  body.p21-order-detail .desktop-line-row {
    border-radius: 14px !important;
    border: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    margin-bottom: .65rem !important;
    padding: .75rem !important;
  }

  body.p21-order-detail .table-shell {
    border-radius: 15px !important;
    overflow: auto !important;
  }
}

/* Mobile polish */
@media (max-width: 767.98px) {
  body.p21-order-detail main,
  body.p21-order-detail .container,
  body.p21-order-detail .container-fluid {
    padding-left: 8px !important;
    padding-right: 8px !important;
    padding-bottom: 92px !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  body.p21-order-detail .page-hero {
    border-radius: 16px !important;
    padding: .72rem !important;
    margin-bottom: .65rem !important;
  }

  body.p21-order-detail .page-hero h1 {
    font-size: 1rem !important;
    line-height: 1.12 !important;
    margin-bottom: .25rem !important;
  }

  body.p21-order-detail .hero-subtitle {
    font-size: .75rem !important;
    line-height: 1.2 !important;
    margin-bottom: .45rem !important;
  }

  body.p21-order-detail .page-hero .badge {
    font-size: .55rem !important;
    padding: .16rem .32rem !important;
    white-space: normal !important;
    line-height: 1.05 !important;
  }

  body.p21-order-detail .page-hero > .d-flex,
  body.p21-order-detail .page-hero .d-flex.justify-content-between {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: .55rem !important;
  }

  body.p21-order-detail .hero-summary-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: .42rem !important;
    margin-top: .5rem !important;
  }

  body.p21-order-detail .hero-stat-card,
  body.p21-order-detail .payment-stat {
    border-radius: 13px !important;
    padding: .48rem .35rem !important;
    min-width: 0 !important;
    text-align: center !important;
  }

  body.p21-order-detail .hero-stat-card .label,
  body.p21-order-detail .payment-stat .label {
    font-size: .52rem !important;
    line-height: 1 !important;
  }

  body.p21-order-detail .hero-stat-card .value,
  body.p21-order-detail .payment-stat .value {
    font-size: .9rem !important;
    line-height: 1.05 !important;
  }

  body.p21-order-detail .hero-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: .42rem !important;
    width: 100% !important;
  }

  body.p21-order-detail .hero-actions .btn,
  body.p21-order-detail .hero-actions form,
  body.p21-order-detail .hero-actions form button {
    width: 100% !important;
    min-height: 36px !important;
    font-size: .68rem !important;
    padding: .28rem .35rem !important;
    margin: 0 !important;
  }

  body.p21-order-detail .soft-card,
  body.p21-order-detail .order-main-card {
    border-radius: 15px !important;
    margin-bottom: .65rem !important;
  }

  body.p21-order-detail .card-body {
    padding: .68rem !important;
  }

  body.p21-order-detail .section-title-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: .3rem !important;
    margin-bottom: .55rem !important;
  }

  body.p21-order-detail .section-title-row h2,
  body.p21-order-detail .section-title-row h3 {
    font-size: .95rem !important;
    margin-bottom: .1rem !important;
  }

  body.p21-order-detail .section-note,
  body.p21-order-detail .summary-clean-note {
    font-size: .7rem !important;
    line-height: 1.2 !important;
  }

  body.p21-order-detail .mobile-collapse-toggle {
    width: 100% !important;
    border-radius: 14px !important;
    min-height: 42px !important;
    font-size: .84rem !important;
    font-weight: 950 !important;
    margin-bottom: .5rem !important;
  }

  body.p21-order-detail .form-label {
    font-size: .68rem !important;
    font-weight: 900 !important;
    color: #334155 !important;
    margin-bottom: .18rem !important;
  }

  body.p21-order-detail .form-control,
  body.p21-order-detail .form-select {
    min-height: 40px !important;
    border-radius: 11px !important;
    font-size: 16px !important;
    padding: .38rem .52rem !important;
  }

  body.p21-order-detail textarea.form-control {
    min-height: 86px !important;
  }

  body.p21-order-detail .btn {
    min-height: 38px !important;
    border-radius: 12px !important;
    font-size: .76rem !important;
    padding: .35rem .55rem !important;
  }

  body.p21-order-detail .btn-sm {
    min-height: 34px !important;
    font-size: .68rem !important;
  }

  body.p21-order-detail .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
    row-gap: .5rem !important;
  }

  body.p21-order-detail [class*="col-"] {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Racket line items */
  body.p21-order-detail .desktop-line-items,
  body.p21-order-detail .head {
    display: none !important;
  }

  body.p21-order-detail .mobile-line-card {
    border-radius: 14px !important;
    border: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    box-shadow: 0 7px 18px rgba(15, 23, 42, .05) !important;
    padding: .62rem !important;
    margin-bottom: .6rem !important;
  }

  body.p21-order-detail .mobile-line-card .row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: .48rem !important;
  }

  body.p21-order-detail .mobile-line-card .row > div:has(input[name="racket_brand"]),
  body.p21-order-detail .mobile-line-card .row > div:has(input[name="racket_model"]),
  body.p21-order-detail .mobile-line-card .row > div:has(select[name="string_product_id"]),
  body.p21-order-detail .mobile-line-card .row > div:has(input[name="notes"]),
  body.p21-order-detail .mobile-line-card form {
    grid-column: 1 / -1 !important;
  }

  body.p21-order-detail .line-items-toolbar {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: .45rem !important;
  }

  body.p21-order-detail .line-items-toolbar form {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: .4rem !important;
    width: 100% !important;
  }

  body.p21-order-detail .line-items-toolbar input {
    width: 100% !important;
  }

  /* Tables should scroll, not break into vertical text */
  body.p21-order-detail .table-responsive,
  body.p21-order-detail .table-shell {
    overflow-x: auto !important;
    border-radius: 13px !important;
    border: 1px solid #e2e8f0 !important;
  }

  body.p21-order-detail table {
    min-width: 620px !important;
    font-size: .78rem !important;
  }

  body.p21-order-detail table th,
  body.p21-order-detail table td {
    padding: .45rem .5rem !important;
    white-space: normal !important;
    word-break: normal !important;
  }

  /* Payments */
  body.p21-order-detail .payment-overview-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: .42rem !important;
    min-width: 0 !important;
  }

  body.p21-order-detail #payments-card form.row,
  body.p21-order-detail #shipments-card form.row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: .45rem !important;
  }

  body.p21-order-detail #payments-card form.row > div,
  body.p21-order-detail #shipments-card form.row > div {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Extras */
  body.p21-order-detail .extras-manage-panel {
    padding: .6rem !important;
    border-radius: 14px !important;
  }

  body.p21-order-detail .extras-total-pill {
    width: 100% !important;
    justify-content: space-between !important;
    border-radius: 13px !important;
    padding: .5rem .6rem !important;
  }
}
