/* TheaCRM v2.8.531 – unified topbar actions + mobile search/right actions
   Jeden zdroj stylu pro horní akce: globální hledání, obálka a zvoneček.
   Cíl: nepoužívat zároveň Bootstrap badge/position utility + lokální inline styly. */
:root{
  --thea-topbar-action-size: 40px;
  --thea-topbar-action-radius: 14px;
  --thea-topbar-icon-size: 1.22rem;
  --thea-topbar-action-color: #212529;
  --thea-topbar-action-hover-bg: rgba(47, 112, 57, .10);
  --thea-topbar-action-active-bg: #eaf6ee;
  --thea-topbar-action-active-ring: rgba(47, 112, 57, .26);
  --thea-topbar-badge-bg: #dc3545;
  --thea-topbar-badge-color: #fff;
  --thea-topbar-dropdown-width: min(390px, calc(100vw - 24px));
}

.header{
  background:#f5f5f5 !important;
  border-bottom:1px solid #e9ecef;
}
.header .brand,
.header .menu-toggle,
.header .actions i{
  color:var(--thea-topbar-action-color) !important;
}
.header .actions{
  gap:.35rem !important;
  align-items:center;
}
.header .thea-topbar-search-center{
  grid-column:2;
  justify-self:center;
  min-width:0;
  width:min(460px, 42vw);
  align-items:center;
  justify-content:center;
}
.header .actions{
  grid-column:3;
  justify-self:end;
}
.header .thea-topbar-search-box{
  width:100%;
  min-height:42px;
  border:1px solid #dfe8e2;
  border-radius:999px;
  background:#fff;
  color:#1d2d22;
  display:inline-flex;
  align-items:center;
  justify-content:flex-start;
  gap:.55rem;
  padding:.35rem .55rem .35rem .85rem;
  box-shadow:0 8px 24px rgba(15, 23, 42, .06);
  line-height:1;
  text-align:left;
  white-space:nowrap;
  overflow:hidden;
  transition:border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.header .thea-topbar-search-box:hover{
  border-color:var(--border-color, #c8ddcf);
  background:var(--thea-primary-soft-2, #fbfdfb);
  box-shadow:0 10px 28px rgba(15, 23, 42, .08);
}
.header .thea-topbar-search-box:focus-visible{
  outline:0;
  box-shadow:0 0 0 3px var(--thea-topbar-action-active-ring), 0 10px 28px rgba(15, 23, 42, .08);
}
.header .thea-topbar-search-box i{
  color:var(--thea-topbar-search-icon-color, var(--primary-color, #2f7040));
  flex:0 0 auto;
}
.header .thea-topbar-search-placeholder{
  min-width:0;
  flex:1 1 auto;
  overflow:hidden;
  text-overflow:ellipsis;
  color:#5f6f66;
  font-weight:650;
  font-size:.94rem;
}
.header .thea-topbar-search-shortcut{
  flex:0 0 auto;
  border:1px solid #e3ece6;
  border-radius:999px;
  padding:.18rem .45rem;
  background:#f6faf7;
  color:#7a877f;
  font-size:.72rem;
  font-weight:800;
}
.header .actions > .thea-topbar-mobile-search-button{
  display:none !important;
}
.header .actions > a,
.header .actions > button,
.header .thea-topbar-action,
.header .thea-global-search-trigger{
  width:var(--thea-topbar-action-size) !important;
  height:var(--thea-topbar-action-size) !important;
  min-width:var(--thea-topbar-action-size) !important;
  padding:0 !important;
  border:0 !important;
  border-radius:var(--thea-topbar-action-radius) !important;
  background:transparent !important;
  color:var(--thea-topbar-action-color) !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  line-height:1 !important;
  text-decoration:none !important;
  position:relative !important;
  box-shadow:none !important;
  opacity:1 !important;
  transition:background-color .15s ease, box-shadow .15s ease, transform .15s ease;
  -webkit-tap-highlight-color:transparent;
}
.header .actions > a:hover,
.header .actions > button:hover,
.header .thea-topbar-action:hover,
.header .thea-global-search-trigger:hover{
  background:var(--thea-topbar-action-hover-bg) !important;
  opacity:1 !important;
}
.header .actions > a:focus-visible,
.header .actions > button:focus-visible,
.header .thea-topbar-action:focus-visible,
.header .thea-global-search-trigger:focus-visible{
  outline:0;
  box-shadow:0 0 0 3px var(--thea-topbar-action-active-ring) !important;
}
.header .actions > a > i,
.header .actions > button > i,
.header .thea-topbar-action > i,
.header .thea-global-search-trigger > i{
  font-size:var(--thea-topbar-icon-size) !important;
  line-height:1 !important;
  display:block;
}
#notifIcon.notif-active,
#mailIcon.mail-active,
.header .thea-topbar-action[aria-expanded="true"]{
  background:var(--thea-topbar-action-active-bg) !important;
  box-shadow:0 0 0 2px var(--thea-topbar-action-active-ring) inset !important;
}

/* Jednotný badge pro obálku i zvoneček. Nepotřebuje Bootstrap position utility. */
.header .topbar-count-badge,
.header .thea-topbar-badge,
.header .mail-exclaim-badge,
#mailNewBadge{
  position:absolute !important;
  top:2px !important;
  right:1px !important;
  left:auto !important;
  transform:none !important;
  min-width:18px !important;
  height:18px !important;
  padding:0 5px !important;
  border-radius:999px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  font-size:10.5px !important;
  font-weight:800 !important;
  line-height:1 !important;
  letter-spacing:-.02em;
  background:var(--thea-topbar-badge-bg) !important;
  color:var(--thea-topbar-badge-color) !important;
  border:2px solid #fff !important;
  box-shadow:none !important;
  pointer-events:none;
}
.header .topbar-count-badge:empty,
.header .topbar-count-badge[hidden],
.header .thea-topbar-badge:empty,
.header .thea-topbar-badge[hidden],
#mailNewBadge[hidden]{
  display:none !important;
}

/* Topbar dropdowny – společný vzhled pro e-maily i oznámení. */
#notificationDropdown.thea-top-dropdown,
#mailDropdown.thea-top-dropdown,
.thea-top-dropdown{
  position:fixed !important;
  display:none;
  z-index:var(--thea-z-dropdown, 1600) !important;
  top:auto;
  right:auto;
  bottom:auto;
  width:var(--thea-topbar-dropdown-width);
  max-height:calc(100vh - var(--navbar-height, 60px) - 16px);
  background:#fff;
  color:#212529;
  border:1px solid #e4ebe6;
  border-radius:18px;
  box-shadow:0 18px 54px rgba(17, 35, 24, .18);
  overflow:hidden;
}
.thea-top-dropdown .thea-top-dropdown-title{
  position:static !important;
  inset:auto !important;
  height:auto !important;
  min-height:0 !important;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.75rem;
  padding:.72rem .9rem;
  border-bottom:1px solid #edf2ee;
  font-weight:850;
  background:#fff !important;
  color:#17351f !important;
  z-index:auto !important;
}
#notificationDropdown.thea-top-dropdown ul,
#mailDropdown.thea-top-dropdown ul,
.thea-top-dropdown ul{
  list-style:none;
  margin:0;
  padding:.3rem .45rem;
  max-height:min(60vh, calc(100vh - var(--navbar-height, 60px) - 125px));
  overflow-y:auto;
}
#notificationDropdown.thea-top-dropdown li,
#mailDropdown.thea-top-dropdown li{
  padding:0;
  border-bottom:1px solid #f0f4f1;
}
#notificationDropdown.thea-top-dropdown li:last-child,
#mailDropdown.thea-top-dropdown li:last-child{
  border-bottom:none;
}
.thea-top-dropdown a{
  color:inherit;
}
.thea-top-dropdown a:hover{
  background:#f4faf6;
  border-radius:12px;
}

@media (max-width:767.98px){
  .header .header-row{
    grid-template-columns:minmax(0, 1fr) auto !important;
  }
  .header .thea-topbar-search-center{
    display:none !important;
  }
  .header .actions{
    grid-column:2 !important;
    justify-self:end !important;
    margin-left:auto !important;
    gap:.15rem !important;
  }
  .header .thea-global-search-trigger{
    display:none !important;
  }
  .header .actions > .thea-topbar-mobile-search-button{
    display:inline-flex !important;
  }
  .header .actions > a,
  .header .actions > button,
  .header .thea-topbar-action{
    width:38px !important;
    height:38px !important;
    min-width:38px !important;
    border-radius:13px !important;
  }
}

@media (min-width:768px){
  .header .actions > .thea-topbar-mobile-search-button{
    display:none !important;
  }
}

@media (prefers-color-scheme: dark){
  :root{
    --thea-topbar-action-color:#e9ecef;
    --thea-topbar-action-hover-bg:rgba(255,255,255,.08);
    --thea-topbar-action-active-bg:#203527;
    --thea-topbar-action-active-ring:rgba(90, 167, 111, .35);
  }
  .header{
    background:#1b1f2a !important;
    border-bottom-color:#2a2f3a !important;
  }
  .header .brand,
  .header .menu-toggle,
  .header .actions i{
    color:var(--thea-topbar-action-color) !important;
  }
  .header .thea-topbar-search-box{
    background:#151a22;
    border-color:#2a3630;
    color:#e9ecef;
    box-shadow:0 8px 24px rgba(0,0,0,.20);
  }
  .header .thea-topbar-search-box:hover{
    background:#18202a;
    border-color:#36533f;
  }
  .header .thea-topbar-search-placeholder{
    color:#c6d2cb;
  }
  .header .thea-topbar-search-shortcut{
    background:#202635;
    border-color:#2a3630;
    color:#aebbb3;
  }
  .header .topbar-count-badge,
  .header .thea-topbar-badge,
  .header .mail-exclaim-badge,
  #mailNewBadge{
    border-color:#1b1f2a !important;
  }
  .thea-top-dropdown{
    background:#161a24;
    color:#e9ecef;
    border-color:#2a2f3a;
    box-shadow:0 18px 54px rgba(0,0,0,.38);
  }
  .thea-top-dropdown .thea-top-dropdown-title{
    background:#161a24 !important;
    color:#e9ecef !important;
    border-bottom-color:#2a2f3a;
  }
  #notificationDropdown.thea-top-dropdown li,
  #mailDropdown.thea-top-dropdown li{
    border-bottom-color:#2a2f3a;
  }
  .thea-top-dropdown a:hover{
    background:#202635;
  }
}

/* TheaCRM v2.8.532 – mobile topbar + dashboard widget boundary hardening
   Oprava po desktopovém přesunu hledání: mobilní topbar drží akce vpravo
   a dashboard widgety na mobilu nesmí vytvořit vnitřní scroll/ujeté ohraničení. */
@media (max-width:767.98px){
  .header{
    width:100% !important;
    max-width:100vw !important;
    overflow:hidden !important;
    box-sizing:border-box !important;
    padding-left:max(12px, env(safe-area-inset-left, 0px)) !important;
    padding-right:max(12px, env(safe-area-inset-right, 0px)) !important;
  }
  .header .header-row{
    display:flex !important;
    grid-template-columns:none !important;
    align-items:center !important;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    gap:.5rem !important;
  }
  .header .thea-topbar-brand-block{
    flex:1 1 auto !important;
    min-width:0 !important;
    max-width:100% !important;
    overflow:hidden !important;
  }
  .header .brand{
    min-width:0 !important;
    max-width:100% !important;
    margin-left:0 !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
    white-space:nowrap !important;
  }
  .header .actions{
    grid-column:auto !important;
    flex:0 0 auto !important;
    display:inline-flex !important;
    align-items:center !important;
    justify-content:flex-end !important;
    margin-left:auto !important;
    min-width:max-content !important;
    max-width:48vw !important;
    gap:.18rem !important;
  }
  .header .actions > .thea-topbar-mobile-search-button{
    display:inline-flex !important;
  }
  .header .actions > a,
  .header .actions > button,
  .header .thea-topbar-action{
    width:38px !important;
    height:38px !important;
    min-width:38px !important;
    flex:0 0 38px !important;
  }

  html,
  body,
  #mainContent.content{
    max-width:100vw !important;
    overflow-x:hidden !important;
  }
  #mainContent.content > .container-fluid.mt-4,
  #mainContent.content > .container-fluid{
    width:100% !important;
    max-width:100% !important;
    margin-left:0 !important;
    margin-right:0 !important;
    padding-left:0 !important;
    padding-right:0 !important;
    overflow-x:hidden !important;
    box-sizing:border-box !important;
  }
  #mainContent.content > .container-fluid > .row{
    margin-left:0 !important;
    margin-right:0 !important;
    --bs-gutter-x:0 !important;
  }
  #mainContent.content > .container-fluid > .row > [class*="col-"]{
    padding-left:0 !important;
    padding-right:0 !important;
    min-width:0 !important;
  }
  #dashboard-grid,
  #dashboard-grid.grid-stack,
  #dashboard-grid.thea-dashboard-stable-grid{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    margin-left:0 !important;
    margin-right:0 !important;
    padding-left:0 !important;
    padding-right:0 !important;
    overflow:visible !important;
    box-sizing:border-box !important;
  }
  #dashboard-grid .grid-stack-item{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    padding:0 !important;
    margin:0 0 .75rem 0 !important;
    left:auto !important;
    right:auto !important;
    top:auto !important;
    transform:none !important;
    grid-column:1 / -1 !important;
    box-sizing:border-box !important;
  }
  #dashboard-grid .grid-stack-item-content{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
    overflow:visible !important;
    box-sizing:border-box !important;
  }
  #dashboard-grid .thea-dashboard-widget,
  #dashboard-grid .card.thea-dashboard-widget{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
    margin:0 !important;
    overflow:hidden !important;
    box-sizing:border-box !important;
    border:1px solid #e3ebe6 !important;
    border-radius:16px !important;
  }
  #dashboard-grid .thea-dashboard-widget > .card-header,
  #dashboard-grid .card.thea-dashboard-widget > .card-header,
  #dashboard-grid .thea-dashboard-widget > .card-footer,
  #dashboard-grid .card.thea-dashboard-widget > .card-footer{
    max-width:100% !important;
    min-width:0 !important;
    box-sizing:border-box !important;
  }
  #dashboard-grid .thea-dashboard-widget > .card-body,
  #dashboard-grid .card.thea-dashboard-widget > .card-body,
  #dashboard-grid .grid-stack-item-content > .thea-dashboard-widget .card-body,
  #dashboard-grid .grid-stack-item-content > .card.thea-dashboard-widget .card-body{
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    height:auto !important;
    max-height:none !important;
    overflow:visible !important;
    box-sizing:border-box !important;
  }
  #dashboard-grid .thea-widget-row,
  #dashboard-grid .thea-widget-list,
  #dashboard-grid .thea-widget-row-body{
    min-width:0 !important;
    max-width:100% !important;
    box-sizing:border-box !important;
  }
  #dashboard-grid .thea-widget-row{
    width:100% !important;
  }
  #dashboard-grid .thea-widget-row-body .fw-semibold,
  #dashboard-grid .thea-widget-row-body .text-truncate{
    min-width:0 !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
  }
  #dashboard-grid .thea-widget-invoices-tile .card-body > .row{
    display:grid !important;
    grid-template-columns:1fr !important;
    gap:.55rem !important;
    margin-left:0 !important;
    margin-right:0 !important;
    --bs-gutter-x:0 !important;
    --bs-gutter-y:0 !important;
  }
  #dashboard-grid .thea-widget-invoices-tile .card-body > .row > [class*="col-"]{
    width:100% !important;
    max-width:100% !important;
    flex:0 0 100% !important;
    padding-left:0 !important;
    padding-right:0 !important;
  }
}

@media (max-width:374.98px){
  .header .actions{
    max-width:52vw !important;
    gap:.08rem !important;
  }
  .header .actions > a,
  .header .actions > button,
  .header .thea-topbar-action{
    width:36px !important;
    height:36px !important;
    min-width:36px !important;
    flex-basis:36px !important;
  }
}


/* TheaCRM v2.8.532 – user color scheme variables */
.header .thea-topbar-search-box i{
  color:var(--thea-topbar-search-icon-color, var(--primary-color, #2e7d32)) !important;
}
.header .thea-topbar-search-box:hover{
  border-color:var(--border-color, #c8ddcf) !important;
  background:var(--thea-primary-soft-2, #fbfdfb) !important;
}
.header .thea-topbar-search-box:focus-visible{
  box-shadow:0 0 0 3px var(--thea-topbar-action-active-ring), 0 10px 28px rgba(15, 23, 42, .08) !important;
}
