/* The order-view picker and the Orders «Workspace» view (static/js/orders/orders-workspace.js).
   <html data-ow> is on only while that view is on screen: it brings the palette and the layout. */

/* ── Parts the picker needs on every order view ─────────────────────────────── */
.ow-ic { width: 16px; height: 16px; flex: none; }
.ow-ic-xs { width: 12px; height: 12px; }
.ow-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  min-width: 32px; height: 32px; padding: 0 7px; border-radius: 8px; flex: none;
  border: 1px solid var(--border); background: var(--bg2); color: var(--text2); cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
}
.ow-icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg3); }
.ow-icon-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.ow-icon-btn-lg { min-width: 38px; height: 38px; }
.od-style-picker { display: inline-flex; flex: none; }
.od-style-btn .ow-ic:first-child { width: 17px; height: 17px; }

.ow-menu {
  position: fixed; z-index: 9500; min-width: 240px; max-width: min(340px, calc(100vw - 16px));
  max-height: calc(100vh - 16px); overflow-y: auto; padding: 6px;
  background: var(--bg2); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow);
}
.ow-menu-title { padding: 6px 10px 5px; font-size: 12px; font-weight: 600; color: var(--text2); }
.ow-menu-sep { border-top: 1px solid var(--border); margin: 5px 2px; }
.ow-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px;
  background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.ow-menu-item > .ow-ic:first-child { color: var(--text2); }
.ow-menu-item:hover, .ow-menu-item:focus-visible { background: var(--bg3); }
.ow-menu-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ow-menu-item.is-danger, .ow-menu-item.is-danger > .ow-ic:first-child { color: var(--red); }
.ow-menu-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ow-menu-txt small { font-size: 11.5px; line-height: 1.35; color: var(--text2); }
.ow-menu-check { color: var(--accent); }
.ow-icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ── Palette: only while the view is on ─────────────────────────────────────── */
:root[data-ow] {
  --bg: #101216; --bg2: #171A21; --bg3: #1E222B; --bg4: #2A2E39;
  --border: #2A2E39; --border-strong: #3B404E;
  --text: #F2F3F5; --text-heading: #F2F3F5; --text2: #A6ADBB; --text-muted: #8D94A3;
  --accent: #8B7AF6; --accent-hover: #A091F8;
  --green: #3DD68C; --orange: #F5B544; --red: #F2767B;
  --hairline: rgba(255,255,255,.06); --input-bg: #1E222B; --tint-strong: rgba(139,122,246,.14);
  --chrome-bg: #14161B; --chrome-border: #2A2E39; --chrome-shadow: none;
  --table-header-bg: #1E222B; --table-header-rule: 1px solid #2A2E39; --table-row-hover: rgba(255,255,255,.03);
  --row-bg: #14161B; --row-hover: rgba(139,122,246,.1); --row-sep: rgba(255,255,255,.06);
  --row-disabled-bg: #1E222B; --detail-bg: #171A21;
  --appbar-bg: #14161B; --appbar-border: #2A2E39; --appbar-field: #1E222B;
  --success-text: #3DD68C; --success-bg: rgba(61,214,140,.13); --success-border: rgba(61,214,140,.32);
  --warning-text: #F5B544; --warning-bg: rgba(245,181,68,.12); --warning-border: rgba(245,181,68,.38);
  --danger-text: #F2767B; --danger-bg: rgba(242,118,123,.13); --danger-border: rgba(242,118,123,.34);
  --info-text: #C4BBFB; --info-bg: rgba(139,122,246,.14); --info-border: rgba(139,122,246,.36);
  /* White on the brief's #8B7AF6 is 3.4:1; this violet is the filled-button shade, 4.8:1. */
  --ow-fill: #6F5CE8; --ow-fill-hover: #7D6BEE;
  --radius: 10px;
}
:root[data-ow] .btn-primary { background: var(--ow-fill); }
:root[data-ow] .btn-primary:hover { background: var(--ow-fill-hover); }

/* ── Layout: three panes, each scrolling on its own ─────────────────────────── */
:root[data-ow] #main { overflow: hidden; scrollbar-gutter: auto; }
:root[data-ow] #page-orders.active { flex: 1; min-height: 0; padding: 0; gap: 0; }
:root[data-ow] #page-orders > :not(#orders-workspace):not(#orders-dup-alert) { display: none !important; }
:root[data-ow] #orders-dup-alert > div { margin: 10px 16px 0; }

.ow {
  position: relative; flex: 1; min-height: 0; display: grid;
  grid-template-columns: 320px minmax(0, 1fr); background: var(--bg); color: var(--text); font-size: 14px;
}
.ow button { font-family: inherit; }
.ow :focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ── The sidebar in this view ───────────────────────────────────────────────── */
:root[data-ow] #sidebar { width: 200px; min-width: 200px; background: #14161B; padding-top: 12px; }
:root[data-ow] #sidebar .nav-item {
  gap: 11px; margin: 1px 10px; padding: 9px 11px; border-left: 0; border-radius: 10px; font-size: 14px; color: var(--text2);
}
:root[data-ow] #sidebar .nav-item:hover { background: var(--bg3); color: var(--text); }
:root[data-ow] #sidebar .nav-item.active { background: rgba(139,122,246,.17); color: var(--text); font-weight: 500; }
:root[data-ow] #sidebar .nav-item.active svg { color: var(--accent); }
:root[data-ow] #sidebar .nav-item svg { width: 17px; height: 17px; stroke-width: 1.8; }
:root[data-ow] #sidebar .nav-section { font-size: 0; padding: 0; margin: 10px 20px; border-top: 1px solid var(--border); opacity: 1; }
:root[data-ow] #sidebar .sidebar-bottom { padding: 12px; }
:root[data-ow][data-sb="collapsed"] #sidebar { width: 64px; min-width: 64px; }
:root[data-ow][data-sb="collapsed"] #sidebar .nav-item { margin: 1px 8px; padding: 10px 0; }
:root[data-ow][data-sb="collapsed"] #sidebar .nav-section { margin: 8px 14px; }
:root[data-ow][data-sb="collapsed"] #sidebar .nav-section::after { display: none; }
/* The queue has the search box; the top one would drive the same field. */
:root[data-ow] #appbar-search-wrap { visibility: hidden; }

/* ── Tasks and AI: on this view the corner is the money column, so they join the top bar ── */
@media (min-width: 761px) {
  :root[data-ow] #tasks-fab, :root[data-ow] #aiw-fab {
    top: calc(var(--appbar-h) / 2 - 18px); bottom: auto; width: 36px; height: 36px; border-radius: 10px; box-shadow: none; font-size: 16px;
  }
  :root[data-ow] body.has-outage #tasks-fab, :root[data-ow] body.has-outage #aiw-fab { top: calc(var(--outage-h, 0px) + var(--appbar-h) / 2 - 18px); }
  :root[data-ow] #aiw-fab { right: 130px; }
  :root[data-ow] #tasks-fab { right: 174px; }
  :root[data-ow] #aiw-fab svg { width: 28px; height: 28px; }
  :root[data-ow] #aiw-fab > svg.aiw-scene { width: 100%; height: 100%; }   /* what the AI does fills the tile */
  :root[data-ow] #tasks-fab:hover, :root[data-ow] #aiw-fab:hover { transform: none; filter: brightness(1.12); }
  :root[data-ow] #tasks-fab .tf-badge, :root[data-ow] #aiw-fab .aiw-badge { top: -5px; right: -5px; min-width: 16px; height: 16px; font-size: 10px; border-width: 1px; }
  :root[data-ow] #aiw-panel { top: calc(var(--appbar-h) + 8px); bottom: auto; right: 12px; }
}

/* ── Queue ──────────────────────────────────────────────────────────────────── */
.ow-queue { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--border); }
.ow-q-head { display: flex; align-items: center; gap: 8px; padding: 16px 16px 12px; }
.ow-q-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; margin: 0; font-size: 20px; font-weight: 700; color: var(--text); }
.ow-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 22px; padding: 0 8px;
  border-radius: 999px; background: var(--ow-fill); color: #fff; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.ow-count:empty { display: none; }
.ow-q-tools { display: flex; align-items: center; gap: 4px; flex: none; }
.ow-q-search { display: flex; gap: 8px; padding: 0 16px 10px; }
.ow-searchbox { position: relative; flex: 1; min-width: 0; }
.ow-searchbox-ic { position: absolute; left: 11px; top: 11px; color: var(--text2); pointer-events: none; z-index: 1; }
.ow-searchbox .search-input-wrapper { max-width: none; min-width: 0; width: 100%; flex: none; }
.ow-searchbox .search-input { width: 100%; height: 38px; padding-left: 34px; font-size: 14px; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; color: var(--text); }
.ow-searchbox .search-input:focus { outline: none; border-color: var(--accent); }
.ow-searchbox .search-input::placeholder { color: var(--text2); }
#ow-filter-btn { position: relative; }
.ow-filter-n:empty { display: none; }
.ow-filter-n {
  position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--ow-fill); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.ow-seg { display: flex; gap: 2px; margin: 0 16px 10px; padding: 3px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--border); }
.ow-seg button { flex: 1; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--text2); font-size: 13.5px; font-weight: 500; cursor: pointer; }
.ow-seg button:hover { color: var(--text); }
.ow-seg button.on { background: var(--ow-fill); color: #fff; font-weight: 600; }
.ow-q-chips #orders-filter-chips { margin: 0 16px 10px !important; }
.ow-q-list { flex: 1; min-height: 0; overflow-y: auto; border-top: 1px solid var(--border); }
.ow-q-msg { padding: 40px 20px; text-align: center; color: var(--text2); }
.ow-q-msg p { margin: 0 0 12px; }
.ow-q-msg-sub { font-size: 12.5px; word-break: break-word; }

.ow-row {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: start; width: 100%;
  padding: 12px 14px 12px 13px; border: 0; border-left: 3px solid transparent; border-bottom: 1px solid var(--border);
  background: none; color: inherit; text-align: left; cursor: pointer;
}
.ow-row:hover { background: rgba(255,255,255,.025); }
.ow-row.is-sel { border-left-color: var(--accent); background: rgba(139,122,246,.11); }
.ow-row:focus-visible { outline-offset: -2px; }
.ow-r-th { position: relative; display: block; width: 56px; height: 56px; }
.ow-th { display: block; width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: #fff; }
.ow-noph { display: block; background: var(--bg3) center / 40% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238D94A3' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 8 12 3 3 8v8l9 5 9-5z'/%3E%3Cpath d='m3 8 9 5 9-5M12 13v8'/%3E%3C/svg%3E"); }
.ow-r-more { position: absolute; right: -4px; bottom: -4px; padding: 0 5px; border-radius: 999px; background: var(--bg4); border: 1px solid var(--border-strong); color: var(--text); font-size: 10.5px; font-weight: 700; line-height: 16px; }
.ow-r-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ow-r-num { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.ow-r-num b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ow-r-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.ow-r-plat { display: flex; min-width: 0; }
.ow-r-plat .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; padding: 2px 8px; }
.ow-r-name { font-size: 13.5px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ow-row.is-sel .ow-r-name { color: var(--text); }
.ow-r-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 18px; align-self: stretch; }
.ow-r-time { font-size: 12.5px; color: var(--text2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ow-r-total { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.ow-q-pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); }
.ow-q-pager:empty { display: none; }
.ow-page-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--bg2); color: var(--text); font-size: 13px; cursor: pointer;
}
.ow-page-btn:hover:not(:disabled) { background: var(--bg3); }
.ow-page-btn:disabled { color: var(--text-muted); cursor: default; opacity: .6; }
.ow-page-n { font-size: 13px; color: var(--text2); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Filters: the page's own controls, in a panel over the panes ─────────────── */
.ow-filters {
  display: none; position: absolute; z-index: 60; left: 12px; width: min(560px, calc(100% - 24px));
  max-height: calc(100% - 130px); overflow-y: auto; padding: 14px;
  background: var(--bg2); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow);
}
.ow-filters.open { display: block; }
.ow-filters #orders-quick-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; overflow: visible; max-width: none; }
.ow-filters .search-row { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; overflow: visible !important; }
.ow-filters .search-row > * { width: 100%; min-width: 0; flex: none !important; }
.ow-filters #orders-adv-btn { display: none; }
.ow-filters #orders-adv-panel { display: block !important; margin: 10px 0 0 !important; padding: 0 !important; background: none !important; border: 0 !important; }
.ow-filters #orders-adv-panel > div { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }

/* ── Selected order ─────────────────────────────────────────────────────────── */
.ow-detail { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ow-head { flex: none; padding: 14px 24px 0; border-bottom: 1px solid var(--border); }
.ow-crumb { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13.5px; color: var(--text2); }
.ow-crumb-back { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--accent); font-size: 13.5px; cursor: pointer; }
.ow-crumb-back:hover { text-decoration: underline; }
.ow-crumb-ic { display: none; }
.ow-crumb-sep { color: var(--text-muted); }
.ow-crumb-num { display: none; }
.ow-head-top { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.ow-title-wrap { flex: 1 1 300px; min-width: 0; }
.ow-title { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ow-title .copy-id { padding: 0; }
.ow-title .copy-id:hover { background: none; text-decoration: none; }
.ow-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; font-size: 14px; color: var(--text2); }
.ow-sub b { color: var(--text); font-weight: 600; }
.ow-sub-sep { width: 1px; height: 14px; background: var(--border-strong); }
.ow-head-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ow-status {
  height: 38px; min-width: 170px; max-width: 240px; padding: 0 30px 0 12px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer;
  color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--ow-st, var(--border-strong));
  appearance: none; -webkit-appearance: none;
  background: var(--bg2) right 10px center / 14px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A6ADBB' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.ow-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 10px; flex: none;
  border: 1px solid var(--border-strong); background: var(--bg2); color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer;
}
.ow-btn:hover { background: var(--bg3); }
.ow-btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.ow-btn-wide { width: 100%; margin-top: 14px; }
.ow-head-tabs { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; min-height: 48px; margin-top: 8px; }
.ow-tabs { display: flex; gap: 22px; }
.ow-tabs button {
  height: 40px; padding: 0 2px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; color: var(--text2); font-size: 14.5px; font-weight: 500; cursor: pointer;
}
.ow-tabs button:hover { color: var(--text); }
.ow-tabs button.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.ow-primary { height: 40px; padding: 0 18px; margin-bottom: 8px; font-size: 14px; border-radius: 10px; flex: none; }

.ow-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 24px 32px; container-type: inline-size; }
.ow-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; height: 100%; min-height: 240px; color: var(--text2); }
.ow-empty p { margin: 0; font-size: 15px; }
.ow-empty-ic { width: 36px; height: 36px; color: var(--text-muted); }
.ow-grid { display: grid; grid-template-columns: minmax(0, 1fr) clamp(340px, 31%, 380px); gap: 16px; align-items: start; }
.ow-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ow-col > div:empty { display: none; }
.ow-col > details { margin-bottom: 0 !important; }
.ow-pane[hidden] { display: none; }
.ow-col-side .otc-card:not(.ow-card) { flex: none; min-width: 0; max-width: none; }

.ow-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.ow-card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 26px; margin-bottom: 12px; }
.ow-card-h h3 { margin: 0; font-size: 18px; font-weight: 600; color: var(--text); }
.ow-card-meta { font-size: 13.5px; color: var(--text2); }
.ow-none, .ow-muted { color: var(--text2); }
.ow-note-muted { font-size: 13.5px; color: var(--text2); padding: 4px 0; }
.ow-mono { font-variant-numeric: tabular-nums; letter-spacing: .2px; }
.ow-pos { color: var(--green); font-weight: 600; }
.ow-neg { color: var(--red); font-weight: 600; }
.ow-link {
  display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: none; color: var(--accent);
  font-size: 13.5px; font-weight: 500; cursor: pointer; text-decoration: none;
}
.ow-link:hover { text-decoration: underline; }
.ow-mini {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-left: 4px; padding: 0; vertical-align: middle;
  border: 0; border-radius: 6px; background: none; color: var(--text2); cursor: pointer;
}
.ow-mini:hover { background: var(--bg3); color: var(--text); }
.ow-mini.copy-id:hover { text-decoration: none; }

/* Items */
.ow-items { width: 100%; border-collapse: collapse; font-size: 14px; }
.ow-items th {
  padding: 8px; background: var(--bg3); border: 0; font-size: 13px; font-weight: 500; color: var(--text2);
  text-transform: none; letter-spacing: 0; text-align: left; white-space: nowrap;
}
.ow-items th:first-child { border-radius: 8px 0 0 8px; }
.ow-items th:last-child { border-radius: 0 8px 8px 0; }
.ow-items td { padding: 12px 8px; border-bottom: 1px solid var(--border); vertical-align: top; font-variant-numeric: tabular-nums; background: none; }
.ow-items .r { text-align: right; white-space: nowrap; }
.ow-strong { font-weight: 600; }
.ow-prod { display: flex; gap: 12px; min-width: 0; }
.ow-prod-ph { width: 56px; height: 56px; flex: none; border-radius: 10px; object-fit: cover; background-color: #fff; cursor: zoom-in; }
.ow-prod-ph.ow-noph { background-color: var(--bg3); cursor: default; }
.ow-prod-txt { min-width: 0; }
.ow-pn { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.ow-ps { margin-top: 3px; font-size: 13px; color: var(--text2); }
.ow-ps .copy-id { padding: 0 2px; }
.ow-items .oit-wh-sel { width: 100%; max-width: 150px; min-width: 104px; height: 32px; font-size: 13px; }
.ow-stock { display: flex; align-items: center; gap: 8px; margin-top: 5px; font-size: 12.5px; }
.ow-stock.is-ok { color: var(--green); }
.ow-stock.is-low { color: var(--orange); }
.ow-stock.is-none { color: var(--red); }
.ow-stock-multi { display: inline-flex; align-items: center; gap: 3px; color: var(--orange); cursor: help; }
.ow-items-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 10px 0; font-size: 16px; font-weight: 600; }
.ow-items-total b { font-size: 16px; font-variant-numeric: tabular-nums; }
.ow-more { margin-top: 12px; }
.ow-more > summary { display: flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; font-size: 13px; color: var(--text2); user-select: none; }
.ow-more > summary::-webkit-details-marker { display: none; }
.ow-more > summary:hover { color: var(--text); }
.ow-more-ic { width: 14px; height: 14px; transition: transform .12s; }
.ow-more[open] .ow-more-ic { transform: rotate(90deg); }
.ow-more > :not(summary) { margin-top: 10px; }
.ow-lines { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.ow-lines th { padding: 4px 8px; background: none; border: 0; border-bottom: 1px solid var(--border); font-size: 12.5px; font-weight: 500; color: var(--text2); text-transform: none; letter-spacing: 0; text-align: left; }
.ow-lines td { padding: 6px 8px; border-bottom: 1px solid var(--hairline); background: none; }
.ow-lines tfoot td { font-weight: 600; border-bottom: 0; }
.ow-lines .r { text-align: right; white-space: nowrap; }
.ow-line-name { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* Delivery + Processing */
.ow-carrier { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.ow-carrier-name { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.ow-carrier-name b { font-weight: 600; }
.ow-carrier-acc { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.ow-warn {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 500;
  background: var(--warning-bg); border: 1px solid var(--warning-border); color: var(--warning-text);
}
.ow-warn-sm { padding: 1px 7px; font-size: 12px; border-radius: 6px; }
.ow-kvs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }
.ow-kvs-proc { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.ow-k { margin-bottom: 3px; font-size: 13px; color: var(--text2); }
.ow-v { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.ow-v b { font-weight: 600; }
.ow-v .od-dstat { display: inline-block; padding: 3px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; line-height: 1.4; }
.ow-alert { margin-top: 12px; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--danger-text); }
.ow-acts { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 2px; margin: 14px -6px -4px; padding-top: 10px; border-top: 1px solid var(--border); }
.ow-acts .btn { margin-left: 4px; }
.ow-act {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 9px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font-size: 13.5px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.ow-act > .ow-ic:first-child { color: var(--text2); }
.ow-act:hover { background: var(--bg3); }
.ow-act-chev { transition: transform .12s; }
.ow-c-delivery:has(> .ow-del-more[open]) .ow-act-chev { transform: rotate(180deg); }
.ow-del-more > summary { display: none; }
.ow-del-more[open] { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.ow-comment { margin-top: 12px; font-size: 13.5px; overflow-wrap: anywhere; }

/* Customer */
.ow-cust { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ow-avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; flex: none; border-radius: 50%;
  background: var(--bg4); color: var(--text); font-size: 15px; font-weight: 600;
}
.ow-cust-txt { min-width: 0; }
.ow-cust-name { font-size: 15px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.ow-cust-phone { display: flex; align-items: center; margin-top: 3px; font-size: 14px; color: var(--text2); font-variant-numeric: tabular-nums; }
.ow-cust-phone a { color: var(--accent); }
.ow-cust-refund { margin-top: 10px; }

/* Payment */
.ow-pay-method { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.ow-pay-method b { font-weight: 600; overflow-wrap: anywhere; }
.ow-pay-ic { width: 20px; height: 20px; color: var(--orange); }
.ow-c-pay .ow-pay-ic { flex: none; }
.ow-pay-note { margin-top: 8px; font-size: 13.5px; color: var(--text2); }
.ow-pay-pill { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; padding: 3px 10px; border: 1px solid; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.ow-pay-pre { margin-top: 4px; }
.ow-pay-pre > div { margin-bottom: 0 !important; }
.ow-pay-pre > div > div:first-child { margin-bottom: 0 !important; font-size: 13.5px !important; }
.ow-collect {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border); font-size: 15px; font-weight: 600;
}
.ow-collect b { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ow-collect.is-paid b { color: var(--green); }
.ow-pay-acts { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-top: 12px; }
.ow-fiscal { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-left: auto; }
.ow-fiscal .btn { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; background: none; border-color: var(--border-strong) !important; color: var(--text) !important; font-weight: 500; }
.ow-fiscal .btn:hover:not(:disabled) { background: var(--bg3); }

/* Financials */
.ow-rate { padding: 3px 9px; border-radius: 7px; background: var(--bg3); border: 1px solid var(--border); color: var(--text2); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ow-fin-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 14px; }
.ow-fin-row > span { min-width: 0; color: var(--text2); overflow-wrap: anywhere; }
.ow-fin-row > span small { font-size: 11.5px; color: var(--text-muted); }
.ow-fin-row > b { flex: none; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ow-fin-row.is-neg > b { color: var(--red); }
.ow-fin-row.is-dim > b { color: var(--text2); }
.ow-fin-rule { margin: 8px 0; border-top: 1px solid var(--border); }
.ow-fin-net > span { color: var(--text); font-weight: 600; }
.ow-fin-net > span { flex: 1; }
.ow-fin-net > b { font-weight: 700; }
.ow-fin-net > b + b { min-width: 62px; text-align: right; }
.ow-profit {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 11px 12px; border-radius: 9px; font-size: 15px; font-weight: 600;
}
.ow-profit b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ow-profit small { margin-left: 8px; font-size: 12.5px; font-weight: 500; opacity: .85; }
.ow-profit.is-pos { background: rgba(61,214,140,.14); border: 1px solid rgba(61,214,140,.34); }
.ow-profit.is-pos b { color: var(--green); }
.ow-profit.is-neg { background: rgba(242,118,123,.13); border: 1px solid rgba(242,118,123,.34); }
.ow-profit.is-neg b { color: var(--red); }

/* Activity */
.ow-h-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.ow-h-row:first-child { border-top: 0; padding-top: 0; }
.ow-h-at { color: var(--text2); font-variant-numeric: tabular-nums; }
.ow-h-st { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.ow-h-by { margin-left: 4px; font-size: 13px; color: var(--text2); }
.ow-h-note { margin-top: 5px; color: var(--text2); overflow-wrap: anywhere; }

/* ── Narrower workspace: the right column drops under the main one ──────────── */
@container (max-width: 860px) {
  .ow-grid { grid-template-columns: minmax(0, 1fr); }
  .ow-col-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .ow-col-side > .ow-c-fin, .ow-col-side > .otc-card:not(.ow-card) { grid-column: 1 / -1; }
}
@container (max-width: 560px) {
  .ow-col-side { grid-template-columns: minmax(0, 1fr); }
  .ow-kvs { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .ow-items thead { display: none; }
  .ow-items, .ow-items tbody { display: block; }
  .ow-items tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
  .ow-items td { display: block; padding: 0; border: 0; }
  .ow-items td:nth-child(1), .ow-items td:nth-child(2) { grid-column: 1 / -1; }
  .ow-items td[data-l]::before { content: attr(data-l); display: block; margin-bottom: 2px; font-size: 12.5px; font-weight: 400; color: var(--text2); }
  .ow-items td.r { text-align: left; }
  .ow-items .oit-wh-sel { max-width: 100%; }
  .ow-items-total { padding-left: 0; padding-right: 0; }
  .ow-h-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}

/* ── Medium screens: icon rail, slimmer queue ───────────────────────────────── */
@media (max-width: 1365px) { .ow { grid-template-columns: 290px minmax(0, 1fr); } .ow-head { padding-left: 18px; padding-right: 18px; } .ow-body { padding-left: 18px; padding-right: 18px; } }

/* ── Narrow screens: the queue or the order, with a way back ────────────────── */
@media (max-width: 900px) {
  .ow { grid-template-columns: minmax(0, 1fr); }
  .ow[data-pane="queue"] .ow-detail { display: none; }
  .ow[data-pane="detail"] .ow-queue { display: none; }
  .ow-queue { border-right: 0; }
  .ow-crumb-ic { display: block; }
  .ow-crumb-sep, .ow-crumb-txt, .ow-head-close { display: none; }
  .ow-crumb { margin-bottom: 0; }
  .ow-crumb-back { min-height: 40px; }
  .ow-head-acts { flex: 1 1 100%; flex-wrap: nowrap; }
  .ow-head { padding: 10px 14px 0; }
  .ow-body { padding: 12px 14px 100px; }
  .ow-title { font-size: 24px; }
  .ow-head-top { gap: 10px; }
  .ow-title-wrap { flex-basis: 100%; }
  .ow-status { flex: 1 1 0; min-width: 0; max-width: none; }
  .ow-head-tabs { flex-wrap: wrap; }
  .ow-primary { flex: 1 1 100%; justify-content: center; order: -1; margin: 4px 0 0; }
  .ow-filters { left: 8px; width: calc(100% - 16px); max-height: calc(100% - 120px); }
}
/* Thumb-sized targets on a phone */
@media (max-width: 760px) {
  :root[data-ow] #page-orders.active { padding-bottom: 0; }
  .ow-detail { display: block; overflow-y: auto; }
  .ow-head { display: contents; }
  .ow-crumb { position: sticky; top: 0; z-index: 5; padding: 2px 14px; background: var(--bg); border-bottom: 1px solid var(--border); }
  .ow-crumb-num { display: block; margin-left: auto; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
  .ow-head-top { padding: 10px 14px 0; }
  .ow-head-tabs { padding: 0 14px; border-bottom: 1px solid var(--border); }
  .ow-body { overflow: visible; }
  .ow-q-list { padding-bottom: 60px; }
  .ow-q-pager { padding-right: 72px; }
  .ow-icon-btn { min-width: 40px; height: 40px; }
  .ow-btn, .ow-status { height: 42px; }
  .ow-act { height: 40px; }
  .ow-seg button { height: 38px; }
  .ow-tabs button { height: 44px; }
  .ow-mini { width: 32px; height: 32px; }
  .ow-primary { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .ow *, .ow-icon-btn { transition: none !important; scroll-behavior: auto !important; }
}
