/* TheaCRM v2.8.477 – mobile bottom app nav + email toolbar layer fix + chat access
   Spodní mobilní lišta je kompaktní: Domů / Hledat / Přidat / Pošta / Menu.
   Pravé spodní Menu otevírá ikonkovou mřížku modulů. Desktop zůstává beze změny. */

:root{
  --thea-mobile-bottom-nav-height: 62px;
  --thea-mobile-bottom-nav-bg: rgba(255,255,255,.97);
  --thea-mobile-bottom-nav-border: rgba(16,24,40,.10);
  --thea-mobile-bottom-nav-text: #667085;
  --thea-mobile-bottom-nav-active: #1f6b3a;
  --thea-mobile-bottom-nav-add: #3c7a3a;
  --thea-mobile-bottom-nav-shadow: 0 -8px 24px rgba(15,23,42,.10);
  --thea-mobile-menu-blue: #1f6b3a;
  --thea-mobile-menu-card-bg: #f3faf5;
}

.thea-mobile-bottom-nav,
.thea-mobile-quick-add-backdrop,
.thea-mobile-main-menu,
.thea-mobile-main-menu-backdrop{
  display:none;
}

@media (max-width: 767.98px){
  /* Menu je na mobilu přesunuté do pravého spodního rohu. */
  .header .menu-toggle{
    display:none !important;
  }

  /* v2.6.230 – compose-safe: při psaní e-mailu nepřekrývat tlačítko Odeslat. */
  .thea-mobile-bottom-nav-disabled.thea-has-mobile-bottom-nav,
  .thea-mobile-bottom-nav-disabled .thea-has-mobile-bottom-nav,
  body.thea-mobile-bottom-nav-disabled.thea-has-mobile-bottom-nav{
    padding-bottom:0 !important;
  }
  .thea-mobile-bottom-nav-disabled .thea-mobile-bottom-nav,
  .thea-mobile-bottom-nav-disabled .thea-mobile-quick-add-backdrop,
  .thea-mobile-bottom-nav-disabled .thea-mobile-main-menu,
  .thea-mobile-bottom-nav-disabled .thea-mobile-main-menu-backdrop,
  body.thea-mobile-bottom-nav-disabled .thea-mobile-bottom-nav,
  body.thea-mobile-bottom-nav-disabled .thea-mobile-quick-add-backdrop,
  body.thea-mobile-bottom-nav-disabled .thea-mobile-main-menu,
  body.thea-mobile-bottom-nav-disabled .thea-mobile-main-menu-backdrop{
    display:none !important;
  }
  body.thea-mobile-bottom-nav-disabled #compose-form,
  body.thea-mobile-bottom-nav-disabled .compose-shell{
    padding-bottom:5.8rem !important;
  }

  .thea-has-mobile-bottom-nav{
    padding-bottom: calc(var(--thea-mobile-bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  }

  .thea-has-mobile-bottom-nav .content,
  .thea-has-mobile-bottom-nav main.content,
  .thea-has-mobile-bottom-nav .main-content,
  .thea-has-mobile-bottom-nav .page-content,
  .thea-has-mobile-bottom-nav .app-content,
  .thea-has-mobile-bottom-nav #content,
  .thea-has-mobile-bottom-nav .thea-content{
    padding-bottom: calc(var(--thea-mobile-bottom-nav-height) + 14px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .thea-mobile-bottom-nav{
    position:fixed;
    left:0;
    right:0;
    bottom:0;
    min-height:calc(var(--thea-mobile-bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    padding:5px max(8px, env(safe-area-inset-left, 0px)) calc(5px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-right, 0px));
    display:grid;
    grid-template-columns:repeat(5, minmax(0, 1fr));
    align-items:end;
    gap:2px;
    background:var(--thea-mobile-bottom-nav-bg);
    border-top:1px solid var(--thea-mobile-bottom-nav-border);
    box-shadow:var(--thea-mobile-bottom-nav-shadow);
    backdrop-filter:blur(16px);
    -webkit-backdrop-filter:blur(16px);
    z-index:1125;
  }

  .thea-mobile-bottom-nav__item,
  .thea-mobile-bottom-nav__center{
    min-width:0;
    min-height:48px;
    border:0;
    background:transparent;
    color:var(--thea-mobile-bottom-nav-text);
    text-decoration:none;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:1px;
    border-radius:15px;
    font-size:10px;
    font-weight:750;
    line-height:1.05;
    position:relative;
    -webkit-tap-highlight-color:transparent;
  }

  button.thea-mobile-bottom-nav__item{
    appearance:none;
    font-family:inherit;
  }

  .thea-mobile-bottom-nav__item i{
    font-size:20px;
    line-height:1;
  }

  .thea-mobile-bottom-nav__menu i{
    font-size:24px;
  }

  .thea-mobile-bottom-nav__item span:not(.thea-mobile-bottom-nav__badge),
  .thea-mobile-bottom-nav__center-label{
    max-width:100%;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  .thea-mobile-bottom-nav__item:hover,
  .thea-mobile-bottom-nav__item:focus,
  .thea-mobile-bottom-nav__item.is-active,
  .thea-mobile-bottom-nav__menu[aria-expanded="true"]{
    color:var(--thea-mobile-bottom-nav-active);
    background:rgba(31,107,58,.08);
  }

  .thea-mobile-bottom-nav__item.is-disabled{
    opacity:.42;
    pointer-events:none;
  }

  .thea-mobile-bottom-nav__badge{
    position:absolute;
    top:3px;
    right:calc(50% - 22px);
    min-width:16px;
    height:16px;
    padding:0 4px;
    border-radius:999px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    font-size:9px;
    line-height:1;
    color:#fff;
    background:#dc3545;
    box-shadow:0 0 0 2px #fff;
  }

  .thea-mobile-bottom-nav__center{
    justify-content:flex-start;
    padding-top:0;
    gap:0;
  }

  .thea-mobile-bottom-nav__add{
    width:44px;
    height:44px;
    min-width:44px;
    min-height:44px;
    margin-top:-18px;
    border-radius:16px;
    border:4px solid #fff;
    background:rgba(31,107,58,.08);
    color:var(--thea-mobile-bottom-nav-active);
    display:inline-flex;
    align-items:center;
    justify-content:center;
    box-shadow:0 8px 18px rgba(31,107,58,.16);
    transition:transform .12s ease, box-shadow .12s ease, background-color .12s ease;
    -webkit-tap-highlight-color:transparent;
  }

  .thea-mobile-bottom-nav__add i{
    font-size:25px;
    line-height:1;
    transition:transform .16s ease;
  }

  .thea-mobile-bottom-nav__add:active{
    transform:scale(.96);
  }

  .thea-mobile-bottom-nav__add.is-open i{
    transform:rotate(45deg);
  }

  .thea-mobile-bottom-nav__add.is-disabled,
  .thea-mobile-bottom-nav__add:disabled{
    background:#eef2f4;
    color:#98a2b3;
    box-shadow:none;
    opacity:.72;
  }

  .thea-mobile-bottom-nav__center-label{
    margin-top:0;
    font-size:10px;
    font-weight:800;
    color:var(--thea-mobile-bottom-nav-text);
  }

  .thea-mobile-quick-add-backdrop,
  .thea-mobile-main-menu-backdrop{
    position:fixed;
    inset:0;
    display:block;
    background:rgba(15,23,42,.20);
    z-index:1120;
  }
  .thea-mobile-quick-add-backdrop[hidden],
  .thea-mobile-main-menu-backdrop[hidden]{
    display:none !important;
  }

  .thea-mobile-quick-add{
    position:fixed;
    left:50%;
    bottom:calc(var(--thea-mobile-bottom-nav-height) + 12px + env(safe-area-inset-bottom, 0px));
    width:min(92vw, 360px);
    max-height:min(62vh, 420px);
    overflow:auto;
    transform:translate(-50%, 12px) scale(.98);
    transform-origin:bottom center;
    opacity:0;
    pointer-events:none;
    background:#fff;
    color:#1f2937;
    border:1px solid rgba(16,24,40,.10);
    border-radius:22px;
    box-shadow:0 20px 50px rgba(15,23,42,.24);
    padding:8px;
    z-index:1130;
    transition:opacity .14s ease, transform .14s ease;
  }

  .thea-mobile-bottom-nav.is-quick-add-open .thea-mobile-quick-add{
    opacity:1;
    pointer-events:auto;
    transform:translate(-50%, 0) scale(1);
  }

  .thea-mobile-quick-add__title{
    padding:8px 12px 7px;
    color:#667085;
    font-size:12px;
    font-weight:800;
    text-transform:uppercase;
    letter-spacing:.04em;
  }

  .thea-mobile-quick-add a{
    display:flex;
    align-items:center;
    gap:12px;
    min-height:46px;
    padding:10px 12px;
    border-radius:16px;
    color:#1f2937;
    text-decoration:none;
    font-size:15px;
    font-weight:700;
  }

  .thea-mobile-quick-add a i{
    width:28px;
    height:28px;
    border-radius:12px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    background:#eef7f0;
    color:#1f6b3a;
    font-size:17px;
    flex:0 0 auto;
  }

  .thea-mobile-quick-add a:active,
  .thea-mobile-quick-add a:hover,
  .thea-mobile-quick-add a:focus{
    background:#f2f7f3;
  }



  /* v2.8.474 – layer fix: e-mailový klient má vlastní sticky toolbar s vysokým z-indexem.
     Při otevřeném hlavním mobilním menu musí být menu nad obsahem stránky,
     ale spodní navigace zůstává stále dostupná jako v nativní aplikaci. */
  body.thea-mobile-main-menu-open .thea-mobile-main-menu-backdrop{
    z-index:4300;
  }
  body.thea-mobile-main-menu-open .thea-mobile-main-menu{
    z-index:4310;
  }
  body.thea-mobile-main-menu-open .thea-mobile-bottom-nav{
    z-index:4320;
  }
  body.thea-mobile-main-menu-open.thea-email-ui-page .email-toolbar,
  body.thea-mobile-main-menu-open.thea-email-ui-page #toolbar-default,
  body.thea-mobile-main-menu-open.thea-email-ui-page .email-action-more,
  body.thea-mobile-main-menu-open.thea-email-ui-page .email-triage-dropdown,
  body.thea-mobile-main-menu-open.thea-email-ui-page .pager-bar .dropdown{
    z-index:1 !important;
    pointer-events:none !important;
  }
  body.thea-mobile-main-menu-open.thea-email-ui-page .email-toolbar .dropdown-menu,
  body.thea-mobile-main-menu-open.thea-email-ui-page .email-action-more-menu,
  body.thea-mobile-main-menu-open.thea-email-ui-page .email-triage-menu,
  body.thea-mobile-main-menu-open.thea-email-ui-page .pager-bar .dropdown-menu{
    display:none !important;
  }

  .thea-mobile-main-menu{
    position:fixed;
    inset:0;
    display:block;
    overflow:auto;
    background:#fff;
    color:#101828;
    z-index:1140;
    padding:calc(14px + env(safe-area-inset-top, 0px)) 18px calc(var(--thea-mobile-bottom-nav-height) + 22px + env(safe-area-inset-bottom, 0px));
    transform:translateY(18px);
    opacity:0;
    pointer-events:none;
    transition:opacity .16s ease, transform .16s ease;
  }
  .thea-mobile-main-menu[hidden]{
    display:none !important;
  }
  body.thea-mobile-main-menu-open .thea-mobile-main-menu{
    opacity:1;
    transform:translateY(0);
    pointer-events:auto;
  }

  .thea-mobile-main-menu__head{
    min-height:48px;
    display:flex;
    align-items:center;
    gap:12px;
    margin-bottom:14px;
  }
  .thea-mobile-main-menu__head strong{
    display:block;
    color:var(--thea-mobile-menu-blue);
    font-size:30px;
    font-weight:900;
    line-height:1.05;
    letter-spacing:-.03em;
  }
  .thea-mobile-main-menu__head span{
    display:block;
    color:#667085;
    font-size:12px;
    font-weight:700;
  }
  .thea-mobile-main-menu__back{
    width:42px;
    height:42px;
    border:0;
    border-radius:14px;
    background:transparent;
    color:var(--thea-mobile-menu-blue);
    display:inline-flex;
    align-items:center;
    justify-content:center;
    font-size:27px;
  }

  .thea-mobile-main-menu__account{
    display:flex;
    align-items:center;
    gap:12px;
    min-height:74px;
    margin:0 -18px 18px;
    padding:12px 22px;
    border-top:1px solid rgba(16,24,40,.08);
    border-bottom:1px solid rgba(16,24,40,.08);
    color:#101828;
    text-decoration:none;
    background:#fff;
  }
  .thea-mobile-main-menu__avatar{
    width:48px;
    height:48px;
    border-radius:999px;
    background:#eef7f0;
    color:var(--thea-mobile-menu-blue);
    display:inline-flex;
    align-items:center;
    justify-content:center;
    font-size:28px;
    flex:0 0 auto;
  }
  .thea-mobile-main-menu__account span:nth-child(2){
    min-width:0;
    flex:1 1 auto;
  }
  .thea-mobile-main-menu__account strong,
  .thea-mobile-main-menu__account small{
    display:block;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .thea-mobile-main-menu__account strong{
    color:var(--thea-mobile-menu-blue);
    font-size:17px;
    font-weight:900;
  }
  .thea-mobile-main-menu__account small{
    color:#667085;
    font-size:12px;
    font-weight:700;
  }
  .thea-mobile-main-menu__account > i{
    color:var(--thea-mobile-menu-blue);
    font-size:21px;
  }

  .thea-mobile-main-menu__grid{
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
    gap:14px;
  }
  .thea-mobile-main-menu__card{
    min-height:108px;
    border-radius:18px;
    background:var(--thea-mobile-menu-card-bg);
    color:var(--thea-mobile-menu-blue);
    text-decoration:none;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:9px;
    position:relative;
    font-weight:900;
    font-size:18px;
    line-height:1.05;
    text-align:center;
    box-shadow:inset 0 0 0 1px rgba(31,107,58,.03);
    -webkit-tap-highlight-color:transparent;
  }
  .thea-mobile-main-menu__card i{
    font-size:28px;
    line-height:1;
    font-weight:400;
  }
  .thea-mobile-main-menu__card span{
    max-width:92%;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .thea-mobile-main-menu__card em{
    position:absolute;
    top:10px;
    right:12px;
    min-width:19px;
    height:19px;
    padding:0 5px;
    border-radius:999px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    background:#dc3545;
    color:#fff;
    font-style:normal;
    font-size:10px;
    line-height:1;
    box-shadow:0 0 0 2px #fff;
  }
  .thea-mobile-main-menu__card:active,
  .thea-mobile-main-menu__card:hover,
  .thea-mobile-main-menu__card:focus{
    background:#eaf6ed;
  }
  .thea-mobile-main-menu__card.is-muted{
    color:#667085;
    background:#f6f8fa;
  }

  /* Když je otevřený starý boční panel, spodní lišta nebude konkurovat overlayi. */
  .sidebar.open ~ .thea-mobile-bottom-nav{
    transform:translateY(110%);
    pointer-events:none;
  }
}

@media (max-width: 370px){
  .thea-mobile-bottom-nav{
    padding-left:5px;
    padding-right:5px;
  }
  .thea-mobile-bottom-nav__item,
  .thea-mobile-bottom-nav__center-label{
    font-size:9px;
  }
  .thea-mobile-bottom-nav__item i{
    font-size:19px;
  }
  .thea-mobile-main-menu{
    padding-left:14px;
    padding-right:14px;
  }
  .thea-mobile-main-menu__grid{
    gap:10px;
  }
  .thea-mobile-main-menu__card{
    min-height:98px;
    font-size:16px;
  }
}

@media (prefers-color-scheme: dark) and (max-width: 767.98px){
  :root{
    --thea-mobile-bottom-nav-bg:rgba(18,22,33,.96);
    --thea-mobile-bottom-nav-border:rgba(255,255,255,.10);
    --thea-mobile-bottom-nav-text:#aeb7c4;
    --thea-mobile-bottom-nav-active:#9ee6b6;
    --thea-mobile-bottom-nav-shadow:0 -12px 30px rgba(0,0,0,.38);
    --thea-mobile-menu-blue:#9ee6b6;
    --thea-mobile-menu-card-bg:#18251e;
  }

  .thea-mobile-bottom-nav__item:hover,
  .thea-mobile-bottom-nav__item:focus,
  .thea-mobile-bottom-nav__item.is-active,
  .thea-mobile-bottom-nav__menu[aria-expanded="true"]{
    background:rgba(158,230,182,.10);
  }

  .thea-mobile-bottom-nav__add{
    border-color:#121621;
    background:rgba(158,230,182,.10);
    color:#9ee6b6;
  }

  .thea-mobile-bottom-nav__badge,
  .thea-mobile-main-menu__card em{
    box-shadow:0 0 0 2px #121621;
  }

  .thea-mobile-quick-add,
  .thea-mobile-main-menu{
    background:#121621;
    color:#e9ecef;
    border-color:#2a2f3a;
  }

  .thea-mobile-main-menu__account{
    background:#121621;
    border-color:#2a2f3a;
    color:#e9ecef;
  }

  .thea-mobile-main-menu__avatar,
  .thea-mobile-quick-add a i{
    background:#213529;
    color:#9ee6b6;
  }

  .thea-mobile-main-menu__head span,
  .thea-mobile-main-menu__account small,
  .thea-mobile-quick-add__title{
    color:#9aa4b2;
  }

  .thea-mobile-main-menu__card:active,
  .thea-mobile-main-menu__card:hover,
  .thea-mobile-main-menu__card:focus,
  .thea-mobile-quick-add a:active,
  .thea-mobile-quick-add a:hover,
  .thea-mobile-quick-add a:focus{
    background:#202f26;
  }

  .thea-mobile-main-menu__card.is-muted{
    color:#aeb7c4;
    background:#1b2030;
  }

  .thea-mobile-quick-add a{
    color:#e9ecef;
  }
}


/* v2.8.476 – Hlavní mobilní menu je overlay NAD obsahem, ale spodní navigace zůstává stále viditelná.
   Odborný název této komponenty: mobilní spodní navigace / Bottom Navigation Bar. */
@media (max-width: 767.98px){
  body.thea-mobile-main-menu-open .thea-mobile-bottom-nav{
    display:grid !important;
    visibility:visible !important;
    transform:none !important;
    pointer-events:auto !important;
    z-index:4320 !important;
  }

  body.thea-mobile-main-menu-open .thea-mobile-main-menu{
    padding-bottom:calc(var(--thea-mobile-bottom-nav-height, 62px) + 22px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.thea-chat-thread-with-mobile-nav .thea-mobile-bottom-nav,
  body:has(.thea-chat-page.thea-chat-thread-page) .thea-mobile-bottom-nav{
    display:grid !important;
    visibility:visible !important;
    transform:none !important;
    pointer-events:auto !important;
  }
}


/* TheaCRM v2.8.477 – chat-safe overlay fix
   V detailu interního chatu může composer/shell vytvořit vlastní stacking context.
   Hlavní mobilní menu proto při otevření vynutíme jako top-level overlay
   a Bottom Navigation Bar necháme viditelný nad ním. */
@media (max-width: 767.98px){
  body.thea-mobile-main-menu-open,
  html.thea-mobile-main-menu-open{
    overflow:hidden !important;
  }

  body.thea-mobile-main-menu-open .thea-mobile-main-menu-backdrop,
  .thea-mobile-main-menu-backdrop.is-open{
    display:block !important;
    visibility:visible !important;
    opacity:1 !important;
    pointer-events:auto !important;
    position:fixed !important;
    inset:0 !important;
    z-index:4300 !important;
  }

  body.thea-mobile-main-menu-open .thea-mobile-main-menu,
  .thea-mobile-main-menu.is-open{
    display:block !important;
    visibility:visible !important;
    opacity:1 !important;
    transform:none !important;
    pointer-events:auto !important;
    position:fixed !important;
    inset:0 !important;
    z-index:4310 !important;
    max-width:none !important;
    max-height:none !important;
  }

  body.thea-mobile-main-menu-open .thea-mobile-bottom-nav,
  .thea-mobile-bottom-nav.is-main-menu-open{
    display:grid !important;
    visibility:visible !important;
    opacity:1 !important;
    transform:none !important;
    pointer-events:auto !important;
    z-index:4320 !important;
  }

  body.thea-mobile-main-menu-open.thea-chat-thread-with-mobile-nav .thea-chat-shell,
  body.thea-mobile-main-menu-open:has(.thea-chat-page.thea-chat-thread-page) .thea-chat-shell,
  body.thea-mobile-main-menu-open.thea-chat-thread-with-mobile-nav .thea-chat-composer,
  body.thea-mobile-main-menu-open:has(.thea-chat-page.thea-chat-thread-page) .thea-chat-composer{
    z-index:1 !important;
    pointer-events:none !important;
  }
}

/* TheaCRM v2.8.505 – quick-add layer fix
   Quick-add menu is rendered inside .thea-mobile-bottom-nav. The backdrop is a
   sibling outside the nav. The whole nav must therefore rise above the backdrop
   while quick-add is open; otherwise the backdrop intercepts taps on links. */
@media (max-width: 767.98px){
  .thea-mobile-bottom-nav.is-quick-add-open{
    z-index: calc(var(--thea-z-quick-add, 1250) + 20) !important;
  }
  .thea-mobile-bottom-nav.is-quick-add-open .thea-mobile-quick-add{
    z-index: calc(var(--thea-z-quick-add, 1250) + 30) !important;
    pointer-events: auto !important;
  }
  .thea-mobile-bottom-nav.is-quick-add-open .thea-mobile-quick-add a,
  .thea-mobile-bottom-nav.is-quick-add-open .thea-mobile-quick-add [data-thea-quick-add-link]{
    pointer-events: auto !important;
    position: relative;
    z-index: 1;
  }
  .thea-mobile-quick-add-backdrop:not([hidden]){
    z-index: calc(var(--thea-z-quick-add, 1250) + 5) !important;
  }
}
