/* ===== DCV brand tokens ===== */
:root{
  --tblr-primary:#F6881F;
  --tblr-primary-rgb:246,136,31;
  --tblr-primary-fg:#ffffff;
  --tblr-focus-ring-color:rgba(246,136,31,.25);
  --tblr-focus-ring:0 0 0 .25rem rgba(246,136,31,.25);
  --dcv-black:#231f20;
  --dcv-tan:#F6EADE;
  --tblr-border-radius:8px;
  --tblr-border-radius-sm:6px;
  --tblr-border-radius-lg:12px;
  --dcv-rail:64px;
  --dcv-rail-open:250px;
}
[data-bs-theme="light"]{ --tblr-body-bg:#faf7f2; }
[data-bs-theme="light"] body{ background-color:#faf7f2; }
/* warm neutral dark theme (replaces Tabler's blue-slate) */
[data-bs-theme="dark"]{
  --tblr-body-bg:#1b1918;
  --tblr-body-bg-dark:#141211;
  --tblr-bg-surface:#242120;
  --tblr-bg-surface-secondary:#1f1c1b;
  --tblr-bg-surface-tertiary:#2b2725;
  --tblr-border-color:#332f2c;
  --tblr-border-color-translucent:rgba(255,255,255,.08);
}
[data-bs-theme="dark"] body{ background-color:#1b1918; }
[data-bs-theme="dark"] #topbar{ background:#1b1918;border-bottom:1px solid #332f2c; }
/* native controls (select option lists, date/calendar pickers) follow the platform theme,
   not the visitor's OS theme */
[data-bs-theme="dark"]{ color-scheme:dark; }
[data-bs-theme="light"]{ color-scheme:light; }
/* custom autocomplete dropdowns (category / classification search) were see-through — give
   them a solid surface that matches the platform */
.list-group.position-absolute{
  background:var(--tblr-bg-surface,#ffffff);
  border:1px solid var(--tblr-border-color);
  border-radius:var(--tblr-border-radius);
  overflow:hidden;
}
[data-bs-theme="light"] .list-group.position-absolute{ background:#ffffff; }
.list-group.position-absolute .list-group-item{ background:transparent; border-color:var(--tblr-border-color); }
.list-group.position-absolute .list-group-item-action:hover{ background:rgba(246,136,31,.12); }
/* primary button + accents */
.btn-primary{
  --tblr-btn-color:#fff;--tblr-btn-bg:#F6881F;--tblr-btn-border-color:#F6881F;
  --tblr-btn-hover-color:#fff;--tblr-btn-hover-bg:#e2760f;--tblr-btn-hover-border-color:#e2760f;
  --tblr-btn-active-bg:#c9660c;--tblr-btn-active-border-color:#c9660c;
}
a:not(.btn){ color:#d9760f; }
[data-bs-theme="dark"] a:not(.btn){ color:#F6881F; }
.page-pretitle{ letter-spacing:.04em; }
/* form controls: orange focus instead of Tabler blue */
.form-control:focus,.form-select:focus,.form-check-input:focus{
  border-color:#F6881F;
  box-shadow:0 0 0 .25rem rgba(246,136,31,.25);
}
.form-check-input:checked{ background-color:#F6881F;border-color:#F6881F; }
.page-link:focus{ box-shadow:0 0 0 .25rem rgba(246,136,31,.25); }
.btn:focus-visible,.btn-check:focus-visible+.btn{ box-shadow:0 0 0 .25rem rgba(246,136,31,.25); }
::selection{ background:rgba(246,136,31,.28); }

/* ===== Sidebar: dark brand rail, expands on hover ===== */
#sidebar{
  position:fixed;inset:0 auto 0 0;width:var(--dcv-rail);z-index:1040;
  background:var(--dcv-black);color:#cfc9c4;overflow:hidden;
  transition:width .18s ease;box-shadow:0 0 0 1px rgba(0,0,0,.05);
  display:flex;flex-direction:column;padding:0;
}
#sidebar:hover{ width:var(--dcv-rail-open);box-shadow:0 12px 40px -12px rgba(0,0,0,.45); }
#sidebar .sb-brand{
  display:flex;align-items:center;gap:.65rem;height:60px;padding:0 16px;flex:none;
  border-bottom:1px solid rgba(255,255,255,.08);color:#fff;font-weight:600;white-space:nowrap;
}
#sidebar .sb-brand .sb-logo{
  width:32px;height:32px;flex:none;border-radius:8px;background:var(--tblr-primary);
  display:flex;align-items:center;justify-content:center;color:#fff;font-weight:800;font-size:15px;
}
#sidebar .sb-brand .sb-word{ opacity:0;transition:opacity .15s ease; }
#sidebar:hover .sb-brand .sb-word{ opacity:1; }
#sidebar .sb-nav{ list-style:none;margin:0;padding:.5rem .5rem;flex:1;overflow-y:auto;overflow-x:hidden; }
#sidebar .sb-nav li+li{ margin-top:2px; }
#sidebar .sb-section{ font-size:.68rem;text-transform:uppercase;letter-spacing:.06em;color:#7c756f;padding:.75rem .75rem .35rem;white-space:nowrap;opacity:0;transition:opacity .15s; }
#sidebar:hover .sb-section{ opacity:1; }
#sidebar .sb-link{
  display:flex;align-items:center;gap:.75rem;height:42px;padding:0 .6rem;border-radius:8px;
  color:#cfc9c4;text-decoration:none;white-space:nowrap;position:relative;
}
#sidebar .sb-link:hover{ color:#fff;background:rgba(255,255,255,.06); }
#sidebar .sb-link .sb-ico{ width:24px;height:24px;flex:none;display:flex;align-items:center;justify-content:center; }
#sidebar .sb-link .sb-ico svg{ width:22px;height:22px;stroke:currentColor; }
#sidebar .sb-link .sb-text{ opacity:0;transition:opacity .15s ease; }
#sidebar:hover .sb-link .sb-text{ opacity:1; }
#sidebar .sb-link .sb-badge{ margin-left:auto;opacity:0;transition:opacity .15s; }
#sidebar:hover .sb-link .sb-badge{ opacity:1; }
#sidebar .sb-link.active{ color:#fff;background:rgba(246,136,31,.16);box-shadow:inset 3px 0 0 var(--tblr-primary); }
/* sub-menu (revealed with the rail on hover) */
#sidebar .sb-sub{ list-style:none;margin:2px 0 0;padding:0;max-height:0;overflow:hidden;transition:max-height .18s ease; }
/* Sub-items: collapsed by default. They open when you hover their parent section, and stay
   open for the section you're in (li.sb-open, set server-side) — whenever the rail is expanded. */
#sidebar:hover li.sb-has-sub:hover > .sb-sub,
#sidebar:hover li.sb-open > .sb-sub{ max-height:220px; }
#sidebar .sb-link .sb-caret{ margin-left:auto;width:16px;height:16px;flex:none;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .15s ease,transform .18s ease; }
#sidebar .sb-link .sb-caret svg{ width:14px;height:14px;stroke:currentColor; }
#sidebar:hover .sb-link .sb-caret{ opacity:.6; }
#sidebar:hover li.sb-has-sub:hover > .sb-link .sb-caret,
#sidebar:hover li.sb-open > .sb-link .sb-caret{ transform:rotate(90deg); }
#sidebar .sb-sublink{ display:block;padding:.38rem .75rem .38rem 3rem;margin:1px .25rem;color:#b8b0a8;text-decoration:none;font-size:.9rem;border-radius:8px;white-space:nowrap;opacity:0;transition:opacity .15s; }
#sidebar:hover .sb-sublink{ opacity:1; }
#sidebar .sb-sublink:hover{ color:#fff;background:rgba(255,255,255,.06); }
#sidebar .sb-sublink.active{ color:#fff;background:rgba(246,136,31,.12); }
#sidebar .sb-foot{ flex:none;border-top:1px solid rgba(255,255,255,.08);padding:.5rem; }

/* table-hover: Tabler rounds the top corners of every row's outer cells, which
   shows as notches on the hover highlight. Square the body rows' top corners
   (the header sits above, so no real corner is lost). */
.card-table.table-hover tbody tr td:first-child{ border-start-start-radius:0; }
.card-table.table-hover tbody tr td:last-child{ border-start-end-radius:0; }

/* catalog tree */
.tw-tree, .tw-children{ list-style:none; margin:0; padding:0; }
.tw-children .tw-children{ margin-left:1.1rem; border-left:1px solid var(--tblr-border-color); }
.tw-node{ display:flex; align-items:center; gap:.25rem; padding:.2rem .4rem; border-radius:6px; }
.tw-node:hover{ background:rgba(0,0,0,.04); }
:root:not([data-bs-theme="light"]) .tw-node:hover, [data-bs-theme="dark"] .tw-node:hover{ background:rgba(255,255,255,.05); }
.tw-node.tw-sel{ background:rgba(246,136,31,.16); }
.tw-toggle{ cursor:pointer; display:inline-flex; align-items:center; width:18px; color:var(--tblr-secondary); transition:transform .12s ease; }
li.open > .tw-node > .tw-toggle{ transform:rotate(90deg); }
.tw-space{ display:inline-block; width:18px; flex:none; }
.tw-name{ text-decoration:none; color:inherit; }
.tw-name:hover{ color:var(--tblr-primary); }
li:not(.open) > .tw-children{ display:none; }

/* content offset for the rail */
.dcv-shell{ margin-left:var(--dcv-rail); min-height:100vh; display:flex;flex-direction:column; transition:margin-left .18s ease; }

/* Sidebar pin: keep the rail expanded (desktop). Toggle lives in the brand row; state in localStorage 'dcv-sidebar'. */
#sidebar .sb-pin{
  margin-left:auto;width:30px;height:30px;flex:none;display:flex;align-items:center;justify-content:center;
  border:0;border-radius:8px;background:transparent;color:#9d958e;opacity:0;transition:opacity .15s ease,background .15s,color .15s;cursor:pointer;
}
#sidebar .sb-pin svg{ width:18px;height:18px;stroke:currentColor; }
#sidebar:hover .sb-pin{ opacity:1; }
#sidebar .sb-pin:hover{ color:#fff;background:rgba(255,255,255,.08); }
html.sb-pinned #sidebar .sb-pin{ color:var(--tblr-primary); }
@media (min-width:992px){
  html.sb-pinned #sidebar{ width:var(--dcv-rail-open); box-shadow:none; }
  html.sb-pinned .dcv-shell{ margin-left:var(--dcv-rail-open); }
  html.sb-pinned #sidebar .sb-pin,
  html.sb-pinned #sidebar .sb-word,
  html.sb-pinned #sidebar .sb-section,
  html.sb-pinned #sidebar .sb-link .sb-text,
  html.sb-pinned #sidebar .sb-link .sb-badge,
  html.sb-pinned #sidebar .sb-sublink{ opacity:1; }
  html.sb-pinned #sidebar li.sb-has-sub:hover > .sb-sub,
  html.sb-pinned #sidebar li.sb-open > .sb-sub{ max-height:220px; }
  html.sb-pinned #sidebar .sb-link .sb-caret{ opacity:.6; }
  html.sb-pinned #sidebar li.sb-has-sub:hover > .sb-link .sb-caret,
  html.sb-pinned #sidebar li.sb-open > .sb-link .sb-caret{ transform:rotate(90deg); }
}
@media (max-width:991.98px){ #sidebar .sb-pin{ display:none; } }

/* View-only accounts: actions stay visible but are visibly locked */
body[data-role="viewer"] .dcv-locked{ opacity:.55;cursor:not-allowed; }
.dcv-toast{ position:fixed;right:1rem;bottom:1rem;z-index:2000;max-width:360px;margin:0;box-shadow:0 10px 30px -10px rgba(0,0,0,.35);transition:opacity .2s; }
#topbar{ background:var(--tblr-body-bg); min-height:60px; }
[data-bs-theme="light"] #topbar{ background:#fffdfb;border-bottom:1px solid var(--tblr-border-color); }

/* theme toggle: show exactly one icon per theme */
#theme-toggle .ic-sun,#theme-toggle .ic-moon{ display:inline-flex;align-items:center;justify-content:center; }
#theme-toggle .ic-sun{ display:none; }
[data-bs-theme="dark"] #theme-toggle .ic-sun{ display:inline-flex; }
[data-bs-theme="dark"] #theme-toggle .ic-moon{ display:none; }

/* mobile */
#sb-backdrop{ display:none; }
@media (max-width:991.98px){
  #sidebar{ transform:translateX(-100%);width:var(--dcv-rail-open);transition:transform .2s ease; }
  #sidebar .sb-word,#sidebar .sb-section,#sidebar .sb-link .sb-text,#sidebar .sb-link .sb-badge,#sidebar .sb-sublink{ opacity:1; }
  #sidebar li.sb-open > .sb-sub,
  #sidebar li.sb-has-sub:hover > .sb-sub{ max-height:220px; }
  #sidebar .sb-link .sb-caret{ opacity:.6; }
  #sidebar li.sb-open > .sb-link .sb-caret,
  #sidebar li.sb-has-sub:hover > .sb-link .sb-caret{ transform:rotate(90deg); }
  body.sb-open #sidebar{ transform:translateX(0); }
  body.sb-open #sb-backdrop{ display:block;position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:1035; }
  .dcv-shell{ margin-left:0; }
}
.avatar-dcv{ background:var(--tblr-primary);color:#fff; }
.table thead th{ text-transform:uppercase;font-size:.72rem;letter-spacing:.02em;color:var(--tblr-secondary); }

/* ---- fixes ---- */
/* dark mode: warm-neutral form controls (were Tabler blue) */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select{
  background-color:#2a2724;
  border-color:#3d3835;
  color:#ece9e6;
}
[data-bs-theme="dark"] .form-control::placeholder{ color:#8f877f; }
[data-bs-theme="dark"] .input-icon-addon{ color:#8f877f; }
/* breathing room between the top bar and the page title */
.dcv-shell .page-header{ margin-top:1.25rem; }
/* button text stays white on the orange fill (anchors were inheriting link colour) */
.btn-primary,.btn-primary:hover,.btn-primary:focus{ color:#fff; }
/* top bar bottom border lines up with the sidebar brand divider (both 60px) */
#sidebar .sb-brand{ height:60px; }
/* expandable order rows */
.order-row{ cursor:pointer; }
.order-row .chev{ transition:transform .15s ease; vertical-align:middle; }
.order-row.open .chev{ transform:rotate(90deg); }
.order-detail > td{ background:var(--tblr-bg-surface-secondary); }
[data-bs-theme="light"] .order-detail > td{ background:#f6efe6; }
/* keep the expanded area's inner table square (no corner-rounding bleed) */
.order-detail .table,
.order-detail .table thead th,
.order-detail .table tbody td,
.order-detail .table tbody th{ border-radius:0; }
.order-detail .table thead th{ background:transparent; }
/* Tabler rounds corner cells to match the card; square the detail cell so the tint doesn't show notches */
.card-table td.order-detail-cell,
.order-detail > td{ border-radius:0 !important; }
/* product names may wrap to two lines instead of being cut off */
.prod-name{ display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; overflow-wrap:anywhere; }

/* Product editor: tabs + sticky save bar */
.dcv-tabs .nav-link{ cursor:pointer; }
.dcv-savebar{
  position:sticky;bottom:0;z-index:20;display:flex;align-items:center;gap:1rem;margin-top:.5rem;
  padding:.75rem 1rem;background:var(--tblr-bg-surface);border:1px solid var(--tblr-border-color);border-radius:var(--tblr-border-radius);
  box-shadow:0 -8px 24px -16px rgba(0,0,0,.35);
}
.spec-input.bol-req:placeholder-shown, input.cat-input.bol-req:placeholder-shown{ border-color:rgba(214,57,57,.45); }

/* HTML editor: both the code box and the preview can be resized by dragging the bottom edge */
.dcv-html-editor textarea{ resize:vertical; min-height:8rem; }
.dcv-html-frame{ resize:vertical; overflow:hidden; min-height:8rem; border:1px solid var(--tblr-border-color); border-radius:var(--tblr-border-radius); background:#fff; }
.dcv-html-frame iframe{ display:block; width:100%; height:100%; border:0; }
