/* Shared shell fixes. Keep profile media inside its own layout cell. */
.av-standalone .av-nav-user { display:flex; align-items:center; gap:8px; min-width:0; height:auto; position:relative; }
.av-standalone .av-nav-profile { display:flex; align-items:center; gap:10px; min-width:0; flex:1; text-decoration:none; }
.av-standalone .av-nav-avatar { display:flex; align-items:center; justify-content:center; width:38px; height:38px; min-width:38px; flex:0 0 38px; overflow:hidden; border-radius:50%; }
.av-standalone .av-nav-avatar img { display:block; position:static; width:100%; height:100%; max-width:100%; max-height:100%; object-fit:cover; margin:0; }
.av-standalone .av-nav-profile-copy { min-width:0; flex:1; overflow:hidden; }
.av-standalone .av-nav-profile-copy strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; line-height:1.5; }
.av-standalone .av-nav-profile-copy small { font-size:11px; }
.av-standalone .av-workspace-tools { display:flex; align-items:center; gap:10px; min-width:0; }
.av-standalone .av-workspace-tools-spacer { flex:1; }
.av-standalone .av-workspace-store { max-width:180px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }
.av-mobile-bar { display:none; }
.av-standalone .av-drawer-overlay[hidden] { display:none!important; }
@media(max-width:1024px) {
 .av-standalone:not(.av-login) { padding-top:calc(60px + env(safe-area-inset-top,0px))!important; }
 .av-standalone .av-mobile-bar { display:flex!important; position:fixed; inset:0 0 auto; align-items:center; justify-content:space-between; gap:12px; min-height:60px; padding:calc(8px + env(safe-area-inset-top,0px)) 14px 8px; box-sizing:border-box; background:#fff; border-bottom:1px solid #e1e7f1; z-index:1000; color:#172133; }
 .av-standalone.av-standalone .av-mobile-bar .av-menu-toggle { display:flex!important; align-items:center; justify-content:center; width:44px!important; min-width:44px; min-height:44px; padding:0!important; border:1px solid #d3dbeb!important; border-radius:8px!important; background:#f5f7fb!important; color:#38507f!important; font-size:14px!important; font-weight:700; }
 .av-standalone .av-mobile-bar .av-menu-toggle svg { width:20px; height:20px; flex:none; }
 .av-standalone .av-workspace-tools .av-menu-toggle { display:none!important; }
 .av-standalone .av-nav { z-index:1002!important; top:0!important; height:100vh!important; height:100dvh!important; padding-top:calc(12px + env(safe-area-inset-top,0px))!important; padding-bottom:calc(22px + env(safe-area-inset-bottom,0px))!important; box-sizing:border-box; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
 .av-standalone .av-drawer-overlay:not([hidden]) { display:block!important; position:fixed; inset:0; z-index:1001!important; background:rgba(15,23,42,.45); }
 .av-standalone .av-menu-close { flex:0 0 44px; width:44px; min-height:44px; }
 .av-standalone .av-nav>a,.av-standalone .av-nav-group>summary,.av-standalone .av-nav-group>a,.av-standalone .av-nav-subgroup>summary,.av-standalone .av-nav-subgroup>a { min-height:44px; font-size:14px; box-sizing:border-box; }
 .av-standalone .av-nav-user { flex:none; }
}

/* The white brand header sits above the blue navigation surface. */
@media screen {
 .av-standalone #av-sidebar.av-nav {
   --drawer-blue:#2462be;
   background:var(--drawer-blue)!important;
   color:white!important;
   border-right:0;
   scrollbar-color:#93b6eb var(--drawer-blue);
 }
 .av-standalone #av-sidebar .av-sidebar-heading {
   background:white!important; border:0; justify-content:space-between;
 }
 .av-standalone #av-sidebar .av-sidebar-heading>a { color:#192b47!important; -webkit-text-fill-color:currentColor!important; white-space:nowrap; }
 .av-standalone #av-sidebar .av-sidebar-heading>a b { color:#2462be!important; -webkit-text-fill-color:currentColor!important; }
 .av-standalone #av-sidebar :where(a,summary,strong,small,.av-nav-subgroup,.av-nav-profile-copy span) {
   color:white!important; -webkit-text-fill-color:currentColor!important;
 }
 .av-standalone #av-sidebar :is(a,summary) svg {
   display:block!important; visibility:visible!important; opacity:1!important;
   color:inherit!important; stroke:currentColor!important; flex-shrink:0;
 }
 .av-standalone #av-sidebar :is(a,summary) span { color:inherit!important; }
 .av-standalone #av-sidebar summary::after { color:inherit!important; }
 .av-standalone #av-sidebar :is(a,summary):hover { background:#194f9f!important; color:white!important; }
 .av-standalone #av-sidebar a.active,
 .av-standalone #av-sidebar a.active:hover {
   border-radius:12px; background:white!important; color:#14478e!important; font-weight:650;
 }
 .av-standalone #av-sidebar .av-nav-user,
 .av-standalone #av-sidebar .av-nav-bottom {
   background:transparent!important; border-color:#ffffff45!important;
 }
 .av-standalone #av-sidebar .av-nav-profile-copy b {
   color:#154789!important; background:#e8f1ff!important;
 }
 .av-standalone #av-sidebar .av-nav-subgroup { margin:4px 0 4px 12px; }
 .av-standalone #av-sidebar .av-nav-subgroup>summary {
   display:flex; align-items:center; gap:8px; min-height:44px; padding:10px 12px; cursor:pointer;
 }
 .av-standalone #av-sidebar .av-sidebar-heading>a:hover { background:#edf4ff!important; color:#154789!important; }
 .av-standalone #av-sidebar :is(a,summary):focus-visible { outline:2px solid #ffdc85!important; outline-offset:-2px; }
 .av-standalone.av-standalone .av-create-toolbar>.av-inline-create>summary svg { display:block!important; color:inherit!important; stroke:currentColor!important; }
}
@media screen and (min-width:1025px) {
 .av-standalone #av-sidebar { border-top-right-radius:32px; }
 .av-standalone #av-sidebar .av-menu-close { display:none!important; }
}
@media screen and (max-width:1024px) {
 .av-standalone #av-sidebar.av-nav { padding-top:0!important; }
 .av-standalone #av-sidebar .av-sidebar-heading {
   position:relative; display:flex!important; width:auto; box-sizing:content-box;
   height:54px; padding:env(safe-area-inset-top,0px) 14px 0;
   margin:0 -12px 0; flex:none;
 }
 .av-standalone #av-sidebar .av-sidebar-heading::after {
   content:""; position:absolute; right:0; top:100%; width:32px; height:32px;
   pointer-events:none;
   background:radial-gradient(circle at left bottom,transparent 31px,white 32px);
 }
 .av-standalone #av-sidebar .av-nav-user { padding-top:18px; }
 .av-standalone #av-sidebar .av-menu-close {
   margin-left:auto; background:#edf3ff!important; color:#164989!important;
   border:0!important; border-radius:50%!important;
 }
}

.av-mobile-hold-label { display: none; }
@media screen and (max-width: 767px) {
  html:has(body.av-standalone) { scroll-padding-top: calc(64px + env(safe-area-inset-top, 0px)); }
  .av-standalone .av-mobile-bar :is(button,a),
  .av-standalone .av-page-content :is(.button,.av-action-trigger,.avs-button,.av-list-icon,.ref-back,.ref-collect) {
    min-height: 44px;
    touch-action: manipulation;
  }
  .av-standalone .av-page-content :is(.av-list-icon,.av-scan,.av-action-trigger) {
    min-width: 44px;
    min-height: 44px;
  }
  .av-standalone #av-content :is(.av-form,.av-filter,.ref-billing,.ref-search,.av-pnl-toolbar) :is(
    input:not([type=hidden],[type=radio],[type=checkbox],[type=submit],[type=button],[type=reset]), select, textarea
  ) {
    min-inline-size: 0;
    max-inline-size: 100%;
    font-size: 16px !important;
  }
  .av-standalone #av-content :is(.av-filter,.av-pnl-toolbar,.av-sales-export-tools,.av-pnl-dates) {
    flex-wrap: wrap;
    align-items: end;
    gap: 8px;
  }
  .av-standalone #av-content :is(.av-filter,.av-pnl-toolbar) > label { min-width: 0; }
  .av-standalone #av-content .ref-sale .ref-sale-stage .ref-dock {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 8px;
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--av-border);
    background: var(--av-page);
  }
  .av-standalone #av-content .ref-sale .ref-dock > :is(.ref-primary,.ref-hold) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: auto;
    min-height: 48px;
    line-height: 1.2;
    padding: 8px 12px !important;
    touch-action: manipulation;
  }
  .av-standalone #av-content .ref-sale .ref-dock > .ref-hold { min-width: 74px; }
  .av-standalone .av-mobile-hold-label { display: inline; }
  .av-standalone .ref-source-chips span { min-height: 44px; }
  .av-standalone .ref-sale-card > header > div:first-child { min-width: 0; }
  .av-standalone .ref-sale-card > header :is(small,.ref-status) { overflow-wrap: anywhere; }
}

@media screen and (max-width: 767px) {
  .av-standalone #av-content .av-compact-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px 44px;
    align-items: stretch;
    gap: 6px;
  }
  .av-standalone #av-content .av-compact-filters > :is(label,.av-filter-options) {
    min-width: 0;
    margin: 0;
  }
  .av-standalone #av-content .av-compact-filters > label > input[type=search] {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 44px !important;
    font-size: 16px !important;
  }
  .av-standalone #av-content .av-compact-filters > .av-list-icon,
  .av-standalone #av-content .av-compact-filters > .av-filter-options > summary {
    box-sizing: border-box;
    position: relative;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0 !important;
    touch-action: manipulation;
  }
  .av-standalone #av-content .av-compact-filters .av-filter-count {
    position: absolute;
    inset: 2px 2px auto auto;
    min-width: 15px;
    padding: 0 3px;
    font-size: 10px;
    line-height: 15px;
  }
}

@media screen and (max-width: 767px) {
  .av-standalone #av-content :is(form.av-filter,form.av-form,.av-pnl-toolbar,.ref-billing) {
    box-sizing: border-box;
    min-inline-size: 0;
    max-inline-size: 100%;
  }
  .av-standalone #av-content :is(.av-filter,.av-form,.av-pnl-toolbar,.ref-billing) label {
    box-sizing: border-box;
    min-inline-size: 0;
    max-inline-size: 100%;
  }
  .av-standalone #av-content :is(.av-filter,.av-form,.av-pnl-toolbar,.ref-billing) :is(input[type=date],input[type=datetime-local],input[type=month],input[type=time]) {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    display: block;
    inline-size: 100% !important;
    min-inline-size: 0 !important;
    max-inline-size: 100% !important;
    min-block-size: 44px;
    padding-inline: 10px !important;
    text-align: start;
  }
  .av-standalone #av-content :is(input[type=date],input[type=datetime-local],input[type=month],input[type=time])::-webkit-date-and-time-value {
    min-inline-size: 0;
    margin: 0;
    text-align: start;
  }
  .av-standalone #av-content form.av-filter > :is(label,.av-sales-export-tools) {
    width: 100%;
    max-width: 100%;
  }
  .av-standalone #av-content .av-sales-export-tools > :is(a,button) {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
  }
}

.av-erp .av-party-directory {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}
.av-erp .av-party-directory :is(th,td):is(:first-child,:nth-child(3),:nth-child(n+5)) {
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
  font-variant-numeric: tabular-nums;
}
@media screen and (max-width: 767px) {
  .av-standalone #av-content .av-party-directory > table {
    table-layout: auto !important;
    width: 100%;
    min-width: 710px !important;
  }
  .av-standalone #av-content .av-party-directory :is(th,td):first-child { min-width: 58px; }
  .av-standalone #av-content .av-party-directory :is(th,td):nth-child(2) { min-width: 100px; }
  .av-standalone #av-content .av-party-directory :is(th,td):nth-child(3) { min-width: 112px; }
  .av-standalone #av-content .av-party-directory :is(th,td):nth-child(4) { min-width: 126px; max-width: 195px; }
}

.av-standalone #av-content .av-report-filters {
  flex-wrap: wrap;
  max-width: 100%;
}
