/* stockroom -- orders + clients (orders.js). Scoped under .view-orders (the
   #/orders and #/clients routes), .ord-sheet (this view's sheets) and the
   ord-/cl- classes this file owns. Tokens only. */

/* --------------------------------------------------------------- list -- */
.view-orders .ord-controls { display: grid; gap: 10px; margin-top: 2px; }
.view-orders .ord-controls .seg .ord-n { font-family: var(--f-num); font-weight: 650; color: var(--muted); margin-left: 5px; }
.view-orders .ord-controls .seg .ord-n:empty { display: none; }
.view-orders .ord-sum { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 22px 4px 9px; }
.view-orders .ord-sum .k { font: 650 13px/1.2 var(--f-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.view-orders .ord-sum .v { font: 650 15px/1 var(--f-num); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.view-orders .ord-listbox > .empty { margin-top: 18px; }
.view-orders .ord-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }

/* the order card */
.ord-card { min-width: 0; display: flex; flex-direction: column; padding: 14px 14px 13px; cursor: pointer; outline: none; transition: transform .12s var(--ease), box-shadow .15s; }
.ord-card:active:not(:has(button:active)) { transform: scale(.99); }
.ord-card:focus-visible { box-shadow: 0 0 0 3px var(--brand-tint), var(--sh-1); }
.ord-card.st-cancelled { opacity: .62; }
.ord-card .ord-head { display: flex; align-items: flex-start; gap: 12px; }
.ord-card .ord-who { flex: 1; min-width: 0; padding-top: 1px; }
.ord-card .ord-name { font-size: 16px; font-weight: 650; letter-spacing: -.01em; line-height: 1.25;
                      overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ord-card .ord-meta { font-size: 13px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums;
                      overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ord-card .ord-paidtag { display: inline-flex; align-items: center; gap: 2px; margin-left: 8px; color: var(--ok); font-weight: 650; }
.ord-card .ord-paidtag .i { width: 13px; height: 13px; stroke-width: 2.6; }
.ord-card .ord-amt { flex: none; display: grid; justify-items: end; gap: 6px; }
.ord-card .ord-total { font: 700 18px/1.1 var(--f-num); letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.ord-card .ord-items { margin: 9px 0 0 50px; font-size: 14px; line-height: 1.4; color: var(--ink-2);
                       display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ord-card .ord-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: auto; padding-top: 12px; min-height: 40px; }
.ord-card .ord-pills { flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: 6px; }
.ord-card .ord-acts { flex: none; display: flex; gap: 8px; margin-left: auto; }
.ord-card .pill .i, .view-orders .ord-paid .pill .i, .view-orders .ord-hero .pill .i { width: 12px; height: 12px; stroke-width: 2.6; margin-left: -1px; }
.btn.ord-act { height: 40px; padding: 0 14px; border-radius: 12px; font-size: 15px; gap: 6px; position: relative; }
.btn.ord-act::before { content: ""; position: absolute; inset: -2px 0; }   /* 44 px hit area */
.btn.ord-act .i { width: 18px; height: 18px; }

/* top bar: the + reads as the primary action */
.icon-btn.ord-add { background: var(--brand); color: #fff; border-radius: 50%; width: 36px; height: 36px; margin-left: 4px;
                    box-shadow: 0 3px 10px rgba(42, 69, 201, .28); }
.icon-btn.ord-add::before { inset: -4px; }
.icon-btn.ord-add:active { background: var(--brand-ink); }
.icon-btn.ord-add .i { width: 20px; height: 20px; stroke-width: 2.2; }

/* -------------------------------------------------------------- order -- */
.view-orders .ord-detail { display: grid; gap: 0; }
.view-orders .ord-d-client { margin-top: 6px; }
.view-orders .ord-client { display: flex; align-items: center; gap: 13px; padding: 12px 12px 12px 14px; color: inherit; }
.view-orders .ord-client:active { background: var(--paper); }
.view-orders .ord-client .chev { color: var(--line-2); width: 18px; height: 18px; }
.view-orders .ord-cname { font-size: 18px; font-weight: 700; letter-spacing: -.015em; line-height: 1.2;
                          overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-orders .ord-csub { font-size: 13px; color: var(--muted); margin-top: 3px; }

.view-orders .ord-hero { padding: 16px 16px 14px; margin-top: 10px; }
.view-orders .ord-hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.view-orders .ord-big { font: 700 34px/1 var(--f-num); letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.view-orders .ord-hero-sub { font-size: 13px; color: var(--muted); margin-top: 6px; }
.view-orders .ord-paid { display: grid; justify-items: end; gap: 4px; }
.view-orders .ord-paid-sub { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.view-orders .ord-hero-acts { display: flex; gap: 8px; margin-top: 16px; }
.view-orders .ord-hero-acts .btn { flex: 1; padding: 0 10px; }
.view-orders .ord-hero-acts .btn.primary { flex: 1.4; }

/* progress: Ordered -> Packed -> Shipped -> Delivered */
.view-orders .ord-track { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.view-orders .ord-track li { position: relative; display: grid; justify-items: center; gap: 2px; text-align: center; min-width: 0; }
.view-orders .ord-track li::before { content: ""; position: absolute; top: 11px; right: 50%; width: 100%; height: 3px; margin-top: -1.5px;
                                     background: var(--paper-2); border-radius: 2px; }
.view-orders .ord-track li:first-child::before { display: none; }
.view-orders .ord-track li.done::before { background: var(--brand); }
.view-orders .ord-track .dot { position: relative; z-index: 1; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
                               background: var(--card); border: 2px solid var(--line-2); color: #fff; }
.view-orders .ord-track .dot .i { width: 13px; height: 13px; stroke-width: 3; }
.view-orders .ord-track li.done .dot { background: var(--brand); border-color: var(--brand); }
.view-orders .ord-track li.now .dot { box-shadow: 0 0 0 4px var(--brand-tint); }
.view-orders .ord-track .lbl { margin-top: 5px; font-size: 12.5px; font-weight: 600; color: var(--faint); }
.view-orders .ord-track li.done .lbl { color: var(--ink); }
.view-orders .ord-track .dt { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.view-orders .ord-track.complete li.done::before { background: var(--ok); }
.view-orders .ord-track.complete li.done .dot { background: var(--ok); border-color: var(--ok); }
.view-orders .ord-track.complete li.now .dot { box-shadow: 0 0 0 4px var(--ok-tint); }
.view-orders .ord-track.off { opacity: .5; filter: grayscale(1); }

.view-orders .ord-lineshort { display: flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 12.5px; font-weight: 600; color: var(--bad); }
.view-orders .ord-lineshort .i { width: 14px; height: 14px; stroke-width: 2.2; }

.view-orders .ord-totals { padding: 4px 16px; }
.view-orders .ord-ln { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; font-size: 15px; }
.view-orders .ord-ln .v { font-family: var(--f-num); font-weight: 600; font-variant-numeric: tabular-nums; }
.view-orders .ord-ln.sub { padding: 5px 0; font-size: 14px; color: var(--muted); }
.view-orders .ord-ln.sub .v { font-weight: 500; }
.view-orders .ord-ln.strong { font-weight: 650; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 11px; }
.view-orders .ord-ln.strong .v { font-weight: 700; font-size: 17px; }
.view-orders .ord-totals > .ord-ln:first-child { margin-top: 2px; }
.view-orders .ord-gp { display: flex; align-items: center; gap: 12px; padding: 10px 0 11px; border-top: 1px solid var(--line); margin-top: 4px; }
.view-orders .ord-gp .k { flex: 1; font-weight: 650; font-size: 15px; }
.view-orders .ord-gp .v { font: 700 20px/1 var(--f-num); font-variant-numeric: tabular-nums; }
.view-orders .ord-gp + .ord-ln.sub { border-top: 1px solid var(--line); padding-top: 10px; }

.view-orders .ord-ship { display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 14px; }
.view-orders .ord-trk { font: 650 16px/1.25 var(--f-num); letter-spacing: .02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.view-orders .ord-trk.none { font: 500 15px/1.25 var(--f-ui); color: var(--muted); letter-spacing: 0; }
.view-orders .ord-ship-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.view-orders .ord-tl { padding-bottom: 6px; }
.view-orders .ord-tl .timeline li:last-child { padding-bottom: 4px; }
.view-orders .ord-tl-note { color: var(--ink-2); font-style: italic; }
.view-orders .ord-danger .title { color: var(--bad); }

@media (min-width: 900px) {
  .view-orders .ord-controls { grid-template-columns: minmax(0, 480px) minmax(0, 1fr); align-items: center; }
  .view-orders .ord-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .view-orders .ord-detail { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); column-gap: 24px; align-items: start; }
  .view-orders .ord-d-client { grid-column: 2; grid-row: 1; }
  .view-orders .ord-d-main { grid-column: 1; grid-row: 1 / span 2; }
  .view-orders .ord-d-main > .ord-hero { margin-top: 6px; }
  .view-orders .ord-d-side { grid-column: 2; grid-row: 2; }
}

/* ----------------------------------------------------------- clients -- */
.view-orders .cl-wrap .search { margin-top: 2px; }
.view-orders .cl-list .row { min-height: 64px; }
.view-orders .cl-list .row .gauge { width: 150px; max-width: 100%; }
.view-orders .cl-list .row.cl-off { opacity: .6; }
@media (min-width: 900px) { .view-orders .cl-wrap { max-width: 760px; } }

.view-orders .cl-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px 14px; padding: 16px; margin-top: 6px; }
.view-orders .cl-name { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
.view-orders .cl-sub { font-size: 13.5px; color: var(--muted); margin-top: 3px; }
.view-orders .cl-hero .cl-new { grid-column: 1 / -1; width: 100%; }
.view-orders .cl-stats { margin-top: 12px; }
.view-orders .cl-stats .kpi.tone-warn .value { color: var(--t); }
.view-orders .cl-stats .kpi .foot { min-height: 16px; }
.view-orders .cl-mbar { flex: 1 1 60px; min-width: 40px; max-width: 90px; }
.view-orders .cl-body .section:first-child { margin-top: 24px; }
.view-orders .cl-contact .ord-copy { width: 18px; height: 18px; color: var(--faint); }
.view-orders .cl-more { margin-top: 10px; }
@media (min-width: 900px) {
  .view-orders .cl-hero { grid-template-columns: auto minmax(0, 1fr) auto; padding: 18px 20px; }
  .view-orders .cl-hero .cl-new { grid-column: auto; width: auto; }
  .view-orders .cl-body { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); column-gap: 24px; align-items: start; }
  .view-orders .cl-stats-wrap { grid-column: 1; grid-row: 1; }
  .view-orders .cl-side { grid-column: 2; grid-row: 1 / span 2; }
  .view-orders .cl-orders-wrap { grid-column: 1; grid-row: 2; }
  .view-orders .cl-orders { grid-template-columns: minmax(0, 1fr); }
  .view-orders .cl-side > .section:first-child { margin-top: 12px; }
}

/* ------------------------------------------------------------- sheets -- */
.ord-sheet .ord-form > .field:first-child, .ord-sheet .ord-form > .ord-sh + .field { margin-top: 10px; }
.ord-sheet .ord-sh { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); }
.ord-sheet .ord-sh-name { font-weight: 650; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ord-sheet .ord-sh-items { font-size: 12.5px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ord-sheet .ord-sh-amt { font: 700 17px/1 var(--f-num); font-variant-numeric: tabular-nums; flex: none; }
.ord-sheet .chip.ord-date { height: 48px; width: 100%; border-radius: 12px; justify-content: flex-start; padding: 0 14px; font-weight: 500; font-size: 16px; }
.ord-sheet .chip.ord-date .i { color: var(--muted); width: 19px; height: 19px; }
.ord-sheet .ord-paidrow { display: flex; gap: 8px; align-items: center; }
.ord-sheet .ord-paidrow .chip.ord-date { flex: 1; width: auto; }
.ord-sheet .ord-paidrow .btn.ghost { color: var(--bad); }
.ord-sheet .ord-confirm { margin: 12px 4px 4px; color: var(--ink-2); font-size: 15px; }
.ord-sheet .btn.ord-danger-btn { background: var(--bad); border-color: transparent; color: #fff; }

.ord-sheet .ord-clientchip { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 7px 14px 7px 8px; margin-bottom: 12px;
                             border-radius: 14px; background: var(--paper); border: 1px solid var(--line); text-align: left; font-weight: 650; font-size: 15.5px; }
.ord-sheet button.ord-clientchip:active { background: var(--paper-2); }
.ord-sheet .ord-change { color: var(--brand); font-size: 14px; font-weight: 600; flex: none; }
.ord-sheet .ord-form > .ord-clientchip { margin: 4px 0 0; }
.ord-sheet .tray-total { display: none; }    /* the bill below carries the total */
.ord-sheet .ord-money { margin-top: 4px; }
.ord-sheet .ord-short { display: flex; align-items: center; gap: 7px; margin-top: 8px; padding: 0 4px; font-size: 13.5px; font-weight: 600; color: var(--bad); }
.ord-sheet .ord-short .i { width: 16px; height: 16px; stroke-width: 2.2; }
.ord-sheet .ord-morebtn { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin-top: 4px; padding: 0 4px;
                          color: var(--brand); font-weight: 600; font-size: 15px; }
.ord-sheet .ord-morebtn .i { width: 16px; height: 16px; transition: transform .2s var(--ease); }
.ord-sheet .ord-morebtn[aria-expanded="true"] .i { transform: rotate(180deg); }
.ord-sheet .ord-morebox > .form-row > .field:first-child, .ord-sheet .ord-morebox > .form-row > .field { margin-top: 2px; }
.ord-sheet .ord-bill { margin-top: 16px; padding: 12px 4px 0; border-top: 1px solid var(--line); }
.ord-sheet .ord-bill-ln { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); padding: 2px 0; font-variant-numeric: tabular-nums; }
.ord-sheet .ord-bill-total { display: flex; justify-content: space-between; align-items: baseline; font-weight: 650; padding-top: 4px; }
.ord-sheet .ord-bill-total .v { font: 700 24px/1 var(--f-num); letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
