/* Shared, scoped treatment for the two delivery registers. */
:is(#ordersView,#rebarView) {
  --delivery-package: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='%23203848' stroke-width='1.7' stroke-linejoin='round'%3E%3Cpath d='m4 9 12-6 12 6v14l-12 6-12-6Zm0 0 12 6 12-6M16 15v14M10 6l12 6v7'/%3E%3C/svg%3E");
  --delivery-rebar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23203848' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M5 3v18M12 3v18M19 3v18M3 7h18M3 17h18'/%3E%3C/svg%3E");
}
:is(#ordersView,#rebarView,#pourView,#diaryView) .delivery-heading {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(210px,300px) auto;
  align-items: center;
  gap: 24px;
  min-height: 138px;
  padding: 24px 28px;
  margin-bottom: 22px;
  border: 1px solid #ece9e4;
  border-radius: 16px;
  background: linear-gradient(110deg,#f4f1eb,#f8f6f2 65%,#f2efea);
}
.delivery-heading::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: url("../assets/brand/orders-banner.svg") no-repeat 52% 65% / 460px auto;
  opacity: .1;
  pointer-events: none;
}
#rebarView .delivery-heading::before { background-image: url("../assets/brand/rebar-banner.svg"); }
.delivery-heading-copy { display:flex; align-items:center; gap:24px; min-width:0; }
.delivery-heading-copy > div { min-width:0; }
.delivery-heading-copy h1 { font-family:var(--bs-font-family); font-size:30px; line-height:1.18; letter-spacing:-.6px; margin:5px 0 8px; }
.delivery-heading-copy .kicker { font-size:12px; letter-spacing:.12em; margin:0; }
.delivery-heading-copy p:last-child { font-size:15px; color:#435b6b; margin:0; line-height:1.45; }
.delivery-module-icon {
  display:block;
  flex:none;
  width:80px;
  height:80px;
  border-radius:14px;
  background-color:#e7e4df;
  background-position:center;
  background-repeat:no-repeat;
  background-size:49px;
}
.delivery-icon-orders { background-image:var(--delivery-package); }
.delivery-icon-rebar { background-image:var(--delivery-rebar); }
.delivery-next { display:flex; align-items:center; gap:14px; padding-left:22px; border-left:1px solid #deded8; min-width:0; }
.delivery-next > div { min-width:0; }
.delivery-next strong { display:block; color:#203848; font-size:14px; font-weight:600; line-height:1.4; margin-bottom:5px; }
.delivery-next p { color:#344e60; font-size:14px; line-height:1.5; margin:0; overflow-wrap:anywhere; }
.delivery-truck-icon {
  flex:none;
  width:46px;
  height:46px;
  border-radius:50%;
  background:#eae8e3 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='%23203848' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M3 7h16v17H3ZM19 13h6l4 6v5h-3m-7 0h2M23 14v6h6'/%3E%3Ccircle cx='9' cy='25' r='3' fill='%23eae8e3'/%3E%3Ccircle cx='24' cy='25' r='3' fill='%23eae8e3'/%3E%3C/svg%3E") no-repeat center / 28px;
}
:is(#ordersView,#rebarView) .primary-order-btn { white-space:nowrap; box-shadow:0 4px 12px #d5483522; }
:is(#ordersView,#rebarView) .module-filter-menu { padding:16px 12px; box-shadow:0 8px 24px #20384805; }
:is(#ordersView,#rebarView) .module-filter-title { color:#435b6b; }
:is(#ordersView,#rebarView) .module-register-card,
#rebarView .rebar-overview { border:1px solid #dce5eb; box-shadow:0 10px 28px #20384808; }
#ordersView .order-list-head,#rebarView .rebar-register-table th { background:#eef3f6; color:#344e60; font-size:13px; }
#ordersView .order-item { min-height:76px; padding-top:12px; padding-bottom:12px; }
#ordersView .order-cell-main { position:relative; padding-left:54px; min-height:44px; align-content:center; }
#ordersView .order-cell-main::before,#rebarView .rebar-row td:first-child::before {
  content:"";
  position:absolute;
  left:0;
  top:50%;
  transform:translateY(-50%);
  width:42px;
  height:44px;
  border-radius:10px;
  background:#f0eeea var(--delivery-package) no-repeat center / 25px;
}
#rebarView .rebar-row td { height:76px; padding-top:12px; padding-bottom:12px; }
#rebarView .rebar-row td:first-child { position:relative; padding-left:65px; }
#rebarView .rebar-row td:first-child::before { left:12px; background-image:var(--delivery-rebar); }
#rebarView .rebar-row td strong { font-weight:500; font-size:14px; overflow-wrap:anywhere; }
#rebarView .rebar-row td:first-child strong { font-weight:600; }
#ordersView .order-item:nth-child(even),#rebarView .rebar-row:nth-child(even) { background:#faf9f7; }
#ordersView .order-item[data-delivery-status="ordered"],#rebarView .rebar-row[data-delivery-status="ordered"] { background:#f0f6ff; }
#ordersView .order-item[data-delivery-status="ordered"] { border-left-color:#4c8bd4; }
#rebarView .rebar-row[data-delivery-status="ordered"] td:first-child { box-shadow:inset 3px 0 #4c8bd4; }
#ordersView .order-item[data-delivery-status="partial"] { border-left-color:#d8aa57; }
#rebarView .rebar-row[data-delivery-status="partial"] td:first-child,
#rebarView .rebar-row[data-delivery-status="cancelled"] td:first-child { box-shadow:inset 3px 0 #d8aa57; }
#rebarView .rebar-row:not([data-open-issues="0"]) .rebar-status-cell small { color:#925b12; font-weight:600; }
#ordersView .order-item:hover,#rebarView .rebar-row:hover td { background:#eaf2f6; }
#ordersView .order-item:focus-visible,#rebarView .rebar-row:focus-visible { outline:2px solid #256ca5; outline-offset:-3px; }
#rebarView .rebar-register-toolbar { grid-template-columns:minmax(200px,1fr) minmax(190px,240px) auto; }
#rebarView .rebar-register-toolbar #exportRebar { height:46px; white-space:nowrap; margin:0; }
#rebarView .rebar-building-control > .rebar-building-label { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
#rebarView .rebar-summary-strip { margin:0 18px 16px; border:0; border-top:1px solid #e1e8ee; border-radius:0; background:#fff; padding-top:12px; }
#rebarView .rebar-summary-strip > span { padding:0 14px; gap:5px; }
#rebarView .rebar-summary-strip > span:first-child { padding-left:0; }
#rebarView .rebar-summary-strip small { font-size:13px; }
#rebarView .rebar-summary-strip strong,#rebarView .rebar-summary-strip b { font-size:20px; }
@media (max-width:1200px) {
  :is(#ordersView,#rebarView,#pourView,#diaryView) .delivery-heading { gap:18px; padding:22px; grid-template-columns:minmax(0,1fr) auto; }
  .delivery-heading-copy { gap:16px; }
  .delivery-heading-copy h1 { font-size:27px; }
  .delivery-module-icon { width:64px; height:64px; background-size:40px; }
  .delivery-next { grid-row:2; grid-column:1/-1; border-left:0; padding:10px 0 0; border-top:1px solid #e2dfd9; }
  .delivery-heading > .primary-order-btn { grid-row:1; grid-column:2; }
  .delivery-next p { display:inline; }
  .delivery-next strong { margin:0; }
  .delivery-truck-icon { width:36px; height:36px; background-size:24px; }
}
@media (max-width:767px) {
  :is(#ordersView,#rebarView,#pourView,#diaryView) .delivery-heading { padding:18px; gap:16px; grid-template-columns:minmax(0,1fr); }
  .delivery-heading-copy h1 { font-size:24px; overflow-wrap:anywhere; }
  .delivery-heading-copy .kicker { font-size:10px; }
  .delivery-module-icon { width:48px; height:52px; background-size:32px; border-radius:10px; }
  .delivery-heading > .primary-order-btn { grid-row:3; grid-column:1; justify-self:start; }
  .delivery-next { grid-column:1; }
  #rebarView .rebar-register-toolbar { grid-template-columns:minmax(0,1fr) auto; }
  #rebarView .rebar-register-toolbar .module-register-search { grid-column:1/-1; }
  #rebarView .rebar-summary-strip { grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px 0; }
  #rebarView .rebar-summary-strip > span:nth-child(2) { border:0; }
  #rebarView .rebar-summary-strip > span:nth-child(3) { padding-left:0; }
  #ordersView .order-cell-main { padding-left:48px; }
}


@media screen {
  #diaryView > .delivery-heading { grid-template-columns:minmax(0,1fr) auto; margin-bottom:12px; }
  .delivery-icon-diary { background-image:url("../assets/icons/diary-log.svg"); }
  #diaryView .diary-heading-actions { display:flex; align-items:center; gap:10px; }
  #diaryView .diary-heading-actions button { display:inline-flex; align-items:center; justify-content:center; gap:9px; min-height:46px; height:auto; padding:11px 17px; font-size:15px; white-space:nowrap; }
  #diaryView .diary-heading-actions svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linejoin:round; stroke-linecap:round; }
}
@media screen and (max-width:767px) {
  #diaryView > .delivery-heading { grid-template-columns:minmax(0,1fr); }
  #diaryView .diary-heading-actions { width:auto; justify-content:flex-start; }
}

@media print { .diary-utility-actions { display:none!important; } }

/* Use the shared choice control without hiding its generated span shell. */
#rebarView .rebar-building-control .bs-select-shell{min-width:0;width:100%}
#rebarView .rebar-building-control .bs-select-trigger{height:46px;font-family:var(--bs-font-family);font-size:16px}
#rebarBuildingSort{display:inline-flex;align-items:center;gap:8px;padding:6px 0;border:0;background:transparent;color:inherit;font:inherit;cursor:pointer}
#rebarBuildingSort span{font-size:16px}
@media(max-width:520px){#rebarView .rebar-register-toolbar{grid-template-columns:minmax(0,1fr)}#rebarView .rebar-building-control{width:100%}#rebarView #exportRebar{justify-self:start}}
