/* WINDEV Dealer Portal v1.6.4 — isolated enterprise sidebar + light-theme refinement */

/* --------------------------------------------------------------------------
   Sidebar isolation
   This component intentionally does not use Bootstrap accordion markup.
   Legacy global nav/accordion rules must not be able to change its layout.
   -------------------------------------------------------------------------- */
body.homeaid-system .app-sidebar,
body.homeaid-system .app-mobile-sidebar{
  --sidebar-item-height:44px;
  --sidebar-gap:.44rem;
  --sidebar-panel:rgba(255,255,255,.035);
  --sidebar-hover:rgba(255,255,255,.065);
  --sidebar-muted:rgba(240,244,248,.62);
  --sidebar-subtle:rgba(240,244,248,.40);
  --sidebar-line:rgba(255,255,255,.085);
}

body.homeaid-system .app-sidebar{
  display:flex;
  flex-direction:column;
  overflow:hidden;
  background:
    radial-gradient(circle at 18% -6%,rgba(216,182,52,.08),transparent 28%),
    linear-gradient(180deg,#0B0E11 0%,#0A0D10 100%);
}
body.homeaid-system .app-sidebar .sidebar-brand{
  flex:0 0 var(--ha-header-height);
  min-height:var(--ha-header-height);
  padding:0 .9rem;
  gap:.72rem;
  background:rgba(255,255,255,.012);
}
body.homeaid-system .app-sidebar .brand-mark,
body.homeaid-system .app-mobile-sidebar .brand-mark{
  width:36px;height:36px;flex-basis:36px;border-radius:11px;
  box-shadow:0 8px 24px rgba(216,182,52,.15);
}
body.homeaid-system .app-sidebar .brand-name,
body.homeaid-system .app-mobile-sidebar .brand-name{
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  max-width:158px;
  font-size:.72rem;
  line-height:1.08;
  letter-spacing:.045em;
}
body.homeaid-system .app-sidebar .brand-subtitle,
body.homeaid-system .app-mobile-sidebar .brand-subtitle{
  color:rgba(255,255,255,.45);
  font-size:.62rem;
  line-height:1.25;
}

body.homeaid-system nav.sidebar-scroll,
body.homeaid-system .app-mobile-sidebar nav.sidebar-scroll{
  display:block!important;
  position:static!important;
  inset:auto!important;
  width:100%!important;
  min-width:0!important;
  min-height:0!important;
  flex:1 1 auto!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  margin:0!important;
  padding:.85rem .66rem 1rem!important;
  gap:0!important;
  align-items:stretch!important;
  justify-content:flex-start!important;
  flex-wrap:nowrap!important;
  background:transparent!important;
}
body.homeaid-system .sidebar-nav-root,
body.homeaid-system .sidebar-nav-groups,
body.homeaid-system .sidebar-nav-group,
body.homeaid-system .sidebar-group-panel,
body.homeaid-system .sidebar-group-links{
  display:block!important;
  position:static!important;
  width:100%!important;
  max-width:none!important;
  min-width:0!important;
  margin-left:0!important;
  margin-right:0!important;
  float:none!important;
}
body.homeaid-system .sidebar-nav-root{padding:0!important}
body.homeaid-system .sidebar-section-label{
  display:block!important;
  margin:0 0 .38rem!important;
  padding:.28rem .72rem .48rem!important;
  color:rgba(255,255,255,.34)!important;
  font-size:.59rem!important;
  line-height:1.2!important;
  font-weight:850!important;
  letter-spacing:.20em!important;
  text-transform:uppercase!important;
}
body.homeaid-system .sidebar-nav-groups{
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  gap:var(--sidebar-gap)!important;
}
body.homeaid-system .sidebar-nav-group{
  border:1px solid transparent;
  border-radius:.86rem;
  background:transparent;
  overflow:hidden;
  transition:background 160ms ease,border-color 160ms ease;
}
body.homeaid-system .sidebar-nav-group.is-open{
  background:rgba(255,255,255,.025);
  border-color:rgba(255,255,255,.045);
}
body.homeaid-system .sidebar-group-toggle{
  -webkit-appearance:none;
  appearance:none;
  display:grid!important;
  grid-template-columns:32px minmax(0,1fr) 18px!important;
  align-items:center!important;
  gap:.65rem!important;
  width:100%!important;
  min-height:54px!important;
  margin:0!important;
  padding:.52rem .62rem!important;
  border:0!important;
  border-radius:.78rem!important;
  background:transparent!important;
  color:#F3F5F7!important;
  text-align:left!important;
  box-shadow:none!important;
  cursor:pointer;
  transition:background 160ms ease,color 160ms ease,transform 160ms ease!important;
}
body.homeaid-system .sidebar-group-toggle:hover,
body.homeaid-system .sidebar-group-toggle:focus-visible{
  background:var(--sidebar-hover)!important;
  color:#FFF!important;
  transform:none!important;
}
body.homeaid-system .sidebar-group-toggle:focus-visible{
  outline:2px solid rgba(241,207,75,.88)!important;
  outline-offset:-2px!important;
}
body.homeaid-system .sidebar-nav-group.is-open>.sidebar-group-toggle{
  background:rgba(255,255,255,.048)!important;
}
body.homeaid-system .sidebar-group-icon{
  width:32px;height:32px;
  display:grid;place-items:center;
  border:1px solid rgba(255,255,255,.06);
  border-radius:.68rem;
  background:rgba(255,255,255,.045);
  color:rgba(255,255,255,.62);
}
body.homeaid-system .sidebar-nav-group.is-open .sidebar-group-icon{
  background:rgba(216,182,52,.11);
  border-color:rgba(216,182,52,.17);
  color:var(--ha-accent);
}
body.homeaid-system .sidebar-group-icon .app-icon{width:.88rem;height:.88rem}
body.homeaid-system .sidebar-group-copy{
  display:flex!important;
  min-width:0!important;
  flex-direction:column!important;
  gap:.10rem!important;
  line-height:1.15!important;
}
body.homeaid-system .sidebar-group-copy strong{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:rgba(255,255,255,.88)!important;
  font-size:.78rem!important;
  font-weight:790!important;
  letter-spacing:.005em!important;
}
body.homeaid-system .sidebar-group-copy small{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:var(--sidebar-subtle)!important;
  font-size:.60rem!important;
  font-weight:550!important;
  letter-spacing:.005em!important;
}
body.homeaid-system .sidebar-group-chevron{
  display:grid;place-items:center;
  color:rgba(255,255,255,.36);
  transition:transform 160ms ease,color 160ms ease;
}
body.homeaid-system .sidebar-group-chevron .app-icon{width:.66rem;height:.66rem}
body.homeaid-system .sidebar-nav-group.is-open .sidebar-group-chevron{
  transform:rotate(180deg);
  color:var(--ha-accent);
}
body.homeaid-system .sidebar-group-panel[hidden]{display:none!important}
body.homeaid-system .sidebar-group-panel{
  padding:.10rem .42rem .46rem .86rem!important;
}
body.homeaid-system .sidebar-group-links{
  padding:.12rem 0 .08rem .55rem!important;
  border-left:1px solid var(--sidebar-line)!important;
}
body.homeaid-system .sidebar-link{
  display:flex!important;
  align-items:center!important;
  gap:.58rem!important;
  width:100%!important;
  min-height:39px!important;
  margin:.16rem 0!important;
  padding:.48rem .58rem!important;
  border:1px solid transparent!important;
  border-radius:.66rem!important;
  background:transparent!important;
  color:var(--sidebar-muted)!important;
  text-decoration:none!important;
  font-size:.76rem!important;
  line-height:1.25!important;
  font-weight:680!important;
  text-align:left!important;
  white-space:normal!important;
  box-shadow:none!important;
  transform:none!important;
}
body.homeaid-system .sidebar-link .app-icon{
  width:.78rem!important;
  height:.78rem!important;
  margin:0!important;
  flex:0 0 .78rem!important;
  opacity:.70;
}
body.homeaid-system .sidebar-link:hover,
body.homeaid-system .sidebar-link:focus-visible{
  background:rgba(255,255,255,.055)!important;
  border-color:rgba(255,255,255,.045)!important;
  color:#FFF!important;
  transform:translateY(-1px)!important;
}
body.homeaid-system .sidebar-link:focus-visible{
  outline:2px solid rgba(241,207,75,.80)!important;
  outline-offset:-2px!important;
}
body.homeaid-system .sidebar-link.active{
  background:linear-gradient(135deg,#D8B634 0%,#F1CF4B 100%)!important;
  border-color:rgba(255,255,255,.09)!important;
  color:#17130A!important;
  font-weight:820!important;
  box-shadow:0 8px 22px rgba(216,182,52,.14)!important;
}
body.homeaid-system .sidebar-link.active .app-icon{opacity:1!important}

body.homeaid-system .sidebar-footer{
  flex:0 0 auto;
  margin:0!important;
  padding:.72rem!important;
  border-top:1px solid rgba(255,255,255,.07)!important;
  background:linear-gradient(180deg,rgba(10,13,16,.82),#0A0D10 24%);
}
body.homeaid-system .security-card{
  gap:.62rem;
  padding:.66rem;
  border-color:rgba(255,255,255,.075);
  background:rgba(255,255,255,.032);
  border-radius:.75rem;
}
body.homeaid-system .security-card .fw-semibold{font-size:.70rem;color:rgba(255,255,255,.88)}
body.homeaid-system .security-card .small{font-size:.60rem!important;line-height:1.35;color:rgba(255,255,255,.42)!important}
body.homeaid-system .security-icon{width:28px;height:28px;flex:0 0 28px;border-radius:.58rem}
body.homeaid-system .sidebar-logout-form{margin:.42rem 0 0!important}
body.homeaid-system .sidebar-logout{
  justify-content:flex-start!important;
  min-height:38px!important;
  padding:.46rem .60rem!important;
  color:rgba(255,255,255,.58)!important;
}
body.homeaid-system .sidebar-logout:hover{color:#FFF!important;background:rgba(220,53,69,.10)!important;border-color:rgba(220,53,69,.16)!important}

/* Mobile offcanvas: same component, no alternate navigation model. */
body.homeaid-system .app-mobile-sidebar{
  --bs-offcanvas-width:min(88vw,318px);
  background:#0B0E11!important;
}
body.homeaid-system .app-mobile-sidebar .offcanvas-header{
  min-height:64px;
  padding:0 .78rem;
  background:#0B0E11;
}
body.homeaid-system .app-mobile-sidebar .sidebar-brand{padding:0!important;min-height:auto!important;border:0!important}
body.homeaid-system .app-mobile-sidebar nav.sidebar-scroll{height:calc(100dvh - 64px)!important;padding-top:.72rem!important}

/* --------------------------------------------------------------------------
   Light mode legibility
   Sidebar deliberately stays dark. Content gets stronger hierarchy and contrast.
   -------------------------------------------------------------------------- */
[data-bs-theme="light"]{
  --ha-bg:#F3F5F8;
  --ha-surface:#FFFFFF;
  --ha-raised:#FFFFFF;
  --ha-soft:#EDF1F5;
  --ha-input:#FFFFFF;
  --ha-text:#1F2630;
  --ha-muted:#5B6672;
  --ha-subtle:#697581;
  --ha-border:#D4DAE2;
  --ha-border-strong:#C1C9D3;
  --ha-shadow:0 8px 26px rgba(28,39,52,.075);
}
[data-bs-theme="light"] body.homeaid-system{
  background:
    radial-gradient(circle at 98% 0,rgba(216,182,52,.045),transparent 25rem),
    #F3F5F8!important;
  color:#1F2630!important;
}
[data-bs-theme="light"] body.homeaid-system a:not(.sidebar-link):not(.public-brand-link):not(.btn):not(.dropdown-item){
  color:#715700;
}
[data-bs-theme="light"] body.homeaid-system a:not(.sidebar-link):not(.public-brand-link):not(.btn):not(.dropdown-item):hover{
  color:#4E3C00;
}
[data-bs-theme="light"] .eyebrow,
[data-bs-theme="light"] .premium-kicker{color:#826400!important}
[data-bs-theme="light"] body.homeaid-system .app-header{
  background:rgba(255,255,255,.93)!important;
  border-bottom-color:#D6DCE4!important;
  box-shadow:0 4px 18px rgba(31,42,55,.045)!important;
}
[data-bs-theme="light"] body.homeaid-system .app-content{color:#1F2630!important}
[data-bs-theme="light"] body.homeaid-system .premium-card,
[data-bs-theme="light"] body.homeaid-system .premium-metric,
[data-bs-theme="light"] body.homeaid-system .card,
[data-bs-theme="light"] body.homeaid-system .panel-card,
[data-bs-theme="light"] body.homeaid-system .table-card,
[data-bs-theme="light"] body.homeaid-system .stats>div{
  border-color:#D6DCE4!important;
  box-shadow:0 4px 16px rgba(31,42,55,.045)!important;
}
[data-bs-theme="light"] body.homeaid-system .premium-card-head,
[data-bs-theme="light"] body.homeaid-system .dealer-table-toolbar{
  background:#FBFCFD!important;
  border-color:#D9DFE6!important;
}
[data-bs-theme="light"] body.homeaid-system .premium-page-title p,
[data-bs-theme="light"] body.homeaid-system .page-title p,
[data-bs-theme="light"] body.homeaid-system .premium-card-head p,
[data-bs-theme="light"] body.homeaid-system .header-caption,
[data-bs-theme="light"] body.homeaid-system .role-copy span,
[data-bs-theme="light"] body.homeaid-system .text-body-secondary{
  color:#5D6874!important;
}
[data-bs-theme="light"] body.homeaid-system .form-label,
[data-bs-theme="light"] body.homeaid-system label:not(.btn){color:#2C3540!important;font-weight:720}
[data-bs-theme="light"] body.homeaid-system .form-text,
[data-bs-theme="light"] body.homeaid-system .field-help,
[data-bs-theme="light"] body.homeaid-system .fine,
[data-bs-theme="light"] body.homeaid-system small{color:#65717D}
[data-bs-theme="light"] body.homeaid-system .table{--bs-table-color:#25303B;--bs-table-bg:#FFF;--bs-table-hover-color:#1E2832;--bs-table-hover-bg:#F7F9FB}
[data-bs-theme="light"] body.homeaid-system .table thead th{
  background:#EEF2F6!important;
  color:#465361!important;
  border-bottom-color:#C9D1DB!important;
  letter-spacing:.055em;
}
[data-bs-theme="light"] body.homeaid-system .table tbody td{color:#27333E!important;border-bottom-color:#DEE4EA!important}
[data-bs-theme="light"] body.homeaid-system .table tbody tr:last-child td{border-bottom-color:transparent!important}
[data-bs-theme="light"] body.homeaid-system td small,
[data-bs-theme="light"] body.homeaid-system .request-ref-line,
[data-bs-theme="light"] body.homeaid-system .activity-item small{color:#556472!important}
[data-bs-theme="light"] body.homeaid-system .request-ref-line b{color:#2F3C48!important}
[data-bs-theme="light"] body.homeaid-system .form-control,
[data-bs-theme="light"] body.homeaid-system .form-select,
[data-bs-theme="light"] body.homeaid-system input,
[data-bs-theme="light"] body.homeaid-system select,
[data-bs-theme="light"] body.homeaid-system textarea{
  background:#FFF!important;
  color:#202832!important;
  border-color:#C5CED8!important;
}
[data-bs-theme="light"] body.homeaid-system .form-control:hover,
[data-bs-theme="light"] body.homeaid-system .form-select:hover,
[data-bs-theme="light"] body.homeaid-system input:hover,
[data-bs-theme="light"] body.homeaid-system select:hover,
[data-bs-theme="light"] body.homeaid-system textarea:hover{border-color:#AEB9C5!important}
[data-bs-theme="light"] body.homeaid-system .form-control:focus,
[data-bs-theme="light"] body.homeaid-system .form-select:focus,
[data-bs-theme="light"] body.homeaid-system input:focus,
[data-bs-theme="light"] body.homeaid-system select:focus,
[data-bs-theme="light"] body.homeaid-system textarea:focus{
  border-color:#A98510!important;
  box-shadow:0 0 0 .22rem rgba(216,182,52,.18)!important;
}
[data-bs-theme="light"] body.homeaid-system .machine-code-emphasis,
[data-bs-theme="light"] body.homeaid-system .activation-code-emphasis,
[data-bs-theme="light"] body.homeaid-system .table-machine-code,
[data-bs-theme="light"] body.homeaid-system .machine-inline code,
[data-bs-theme="light"] body.homeaid-system [data-machine-code]{
  background:#FFF6CF!important;
  border-color:#DCC14E!important;
  color:#5F4900!important;
  font-weight:820!important;
}
[data-bs-theme="light"] body.homeaid-system .status-warning{color:#694900!important;background:#FFF3C7!important;border-color:#E3C352!important}
[data-bs-theme="light"] body.homeaid-system .status-success{color:#155C36!important;background:#E7F6EC!important;border-color:#B4DBC3!important}
[data-bs-theme="light"] body.homeaid-system .status-danger{color:#972634!important;background:#FDECEF!important;border-color:#E7B4BC!important}
[data-bs-theme="light"] body.homeaid-system .status-muted{color:#4F5D69!important;background:#EEF1F4!important;border-color:#D5DCE3!important}
[data-bs-theme="light"] body.homeaid-system .dt-container,
[data-bs-theme="light"] body.homeaid-system .dt-local-container,
[data-bs-theme="light"] body.homeaid-system .dataTables_wrapper{color:#465461!important}
[data-bs-theme="light"] body.homeaid-system .dt-container label,
[data-bs-theme="light"] body.homeaid-system .dt-local-toolbar,
[data-bs-theme="light"] body.homeaid-system .dt-local-footer{color:#52606D!important}
[data-bs-theme="light"] body.homeaid-system .page-link,
[data-bs-theme="light"] body.homeaid-system .dt-paging-button,
[data-bs-theme="light"] body.homeaid-system .dt-local-paging .btn{
  color:#3F4C59!important;
  background:#FFF!important;
  border-color:#D0D7E0!important;
}
[data-bs-theme="light"] body.homeaid-system .page-item.active .page-link,
[data-bs-theme="light"] body.homeaid-system .dt-paging-button.current,
[data-bs-theme="light"] body.homeaid-system .dt-local-paging .btn.btn-primary{
  color:#17130A!important;
  background:linear-gradient(135deg,#D8B634,#F1CF4B)!important;
  border-color:#C5A52A!important;
}

@media(max-width:991.98px){
  body.homeaid-system .app-sidebar{display:none!important}
  body.homeaid-system .app-shell{margin-left:0!important}
}
@media(min-width:992px){
  body.homeaid-system .app-sidebar{display:flex!important}
}
@media(prefers-reduced-motion:reduce){
  body.homeaid-system .sidebar-group-toggle,
  body.homeaid-system .sidebar-group-chevron,
  body.homeaid-system .sidebar-link{transition:none!important}
  body.homeaid-system .sidebar-link:hover{transform:none!important}
}
