/* Estrutura exclusiva para telefone. O desktop continua usando a barra lateral original. */
.mobile-app-bar,
.mobile-tab-bar,
.mobile-more-layer {
  display: none;
}

@media (max-width: 720px), (max-width: 950px) and (max-height: 520px) {
  body.mobile-sheet-open {
    overflow: hidden !important;
  }

  .app-shell > .sidebar {
    display: none !important;
  }
  .app-shell > .workspace {
    padding-top: calc(74px + env(safe-area-inset-top));
  }
  .workspace > .workspace-header {
    display: none !important;
  }

  .mobile-app-bar {
    position: fixed;
    z-index: 950;
    inset: 0 0 auto;
    min-height: calc(62px + env(safe-area-inset-top));
    padding: max(8px, env(safe-area-inset-top)) 14px 8px;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 11px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid #e1e7f0;
    box-shadow: 0 8px 24px rgba(23, 36, 59, 0.08);
    backdrop-filter: blur(16px);
  }

  .mobile-brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid #e0e6ef;
    border-radius: 13px;
    background: #fff;
  }

  .mobile-brand-mark img {
    width: 36px;
    height: 30px;
    object-fit: contain;
  }
  .mobile-bar-copy {
    min-width: 0;
  }
  .mobile-bar-copy small {
    display: block;
    color: #7c899d;
    font-size: 8px;
    font-weight: 850;
    letter-spacing: 0.11em;
  }
  .mobile-bar-copy strong {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: #17233a;
    font-size: 16px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-round-button {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid #dce3ed;
    border-radius: 13px;
    background: #f7f9fc;
    color: #2f4f7d;
    font-size: 21px;
    font-weight: 800;
  }

  .mobile-tab-bar {
    position: fixed;
    z-index: 1000;
    inset: auto 0 0;
    height: calc(70px + env(safe-area-inset-bottom));
    padding: 6px 7px max(6px, env(safe-area-inset-bottom));
    box-sizing: border-box;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 3px;
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid #dfe5ee;
    box-shadow: 0 -10px 28px rgba(23, 36, 59, 0.12);
    backdrop-filter: blur(18px);
  }

  .mobile-tab {
    position: relative;
    min-width: 0;
    min-height: 56px;
    padding: 5px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #7a879a;
  }

  .mobile-tab-icon {
    height: 22px;
    display: grid;
    place-items: center;
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
  }
  .mobile-tab small {
    max-width: 100%;
    overflow: hidden;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-tab.active {
    color: #234f91;
    background: #edf3fc;
  }
  .mobile-tab.active::after {
    content: '';
    position: absolute;
    bottom: max(3px, env(safe-area-inset-bottom));
    width: 22px;
    height: 3px;
    border-radius: 3px;
    background: #e7ad32;
  }
  .mobile-tab[hidden] {
    display: none !important;
  }

  .mobile-more-layer:not([hidden]) {
    position: fixed;
    z-index: 1300;
    inset: 0;
    display: block;
  }
  .mobile-more-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(11, 19, 33, 0.58);
    backdrop-filter: blur(3px);
  }
  .mobile-more-sheet {
    position: absolute;
    inset: auto 0 0;
    max-height: min(84dvh, 760px);
    padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
    overflow-y: auto;
    box-sizing: border-box;
    border-radius: 24px 24px 0 0;
    background: #f7f9fc;
    box-shadow: 0 -24px 60px rgba(7, 14, 26, 0.3);
    animation: mobile-sheet-in 0.2s ease-out;
  }

  @keyframes mobile-sheet-in {
    from {
      transform: translateY(22%);
      opacity: 0.4;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
  .mobile-sheet-handle {
    width: 42px;
    height: 4px;
    margin: 0 auto 11px;
    border-radius: 9px;
    background: #c9d1dd;
  }
  .mobile-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .mobile-sheet-head small {
    color: #77869b;
    font-size: 8px;
    font-weight: 850;
    letter-spacing: 0.11em;
  }
  .mobile-sheet-head h2 {
    margin: 3px 0 0;
    color: #17233a;
    font-size: 21px;
  }
  .mobile-sheet-head > button {
    width: 44px;
    height: 44px;
    border: 1px solid #dde4ee;
    border-radius: 13px;
    background: #fff;
    color: #55677f;
    font-size: 24px;
  }

  .mobile-user-card {
    margin: 15px 0;
    padding: 12px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border: 1px solid #e0e6ef;
    border-radius: 15px;
    background: #fff;
  }

  .mobile-user-card > span {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: #18243b;
    color: #fff;
    font-weight: 850;
  }
  .mobile-user-card div {
    min-width: 0;
  }
  .mobile-user-card strong,
  .mobile-user-card small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-user-card strong {
    color: #1b2940;
    font-size: 13px;
  }
  .mobile-user-card small {
    margin-top: 3px;
    color: #78869a;
    font-size: 10px;
  }
  .mobile-user-card button {
    min-width: 55px;
    min-height: 44px;
    border: 1px solid #ecd0d0;
    border-radius: 10px;
    background: #fff6f6;
    color: #a82f35;
    font-size: 11px;
    font-weight: 800;
  }

  .mobile-module-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }
  .mobile-module-grid > button {
    min-width: 0;
    min-height: 98px;
    padding: 13px;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: center;
    column-gap: 10px;
    border: 1px solid #dfe6ef;
    border-radius: 15px;
    background: #fff;
    color: #20304a;
    text-align: left;
    box-shadow: 0 4px 14px rgba(23, 36, 59, 0.04);
  }

  .mobile-module-grid > button > span {
    grid-row: 1 / 3;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: #edf3fc;
    color: #345e9c;
    font-size: 17px;
    font-weight: 850;
  }
  .mobile-module-grid strong {
    align-self: end;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-module-grid small {
    align-self: start;
    margin-top: 3px;
    overflow: hidden;
    color: #7b899d;
    font-size: 9px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-module-grid > button.active {
    border-color: #91ace0;
    background: #f3f7fe;
    box-shadow: inset 0 0 0 1px #91ace0;
  }
  .mobile-module-grid > button[hidden] {
    display: none !important;
  }

  .workspace {
    padding-bottom: calc(90px + env(safe-area-inset-bottom)) !important;
  }
  .view.active-view {
    animation: mobile-view-in 0.18s ease-out;
  }
  @keyframes mobile-view-in {
    from {
      opacity: 0.45;
      transform: translateY(5px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

@media (max-width: 340px) {
  .mobile-app-bar {
    grid-template-columns: 38px minmax(0, 1fr) 44px;
    padding-inline: 9px;
    gap: 8px;
  }
  .mobile-brand-mark {
    width: 38px;
    height: 38px;
  }
  .mobile-round-button {
    width: 44px;
    height: 44px;
  }
  .mobile-tab small {
    font-size: 8px;
  }
  .mobile-module-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 950px) and (max-height: 520px) and (orientation: landscape) {
  .mobile-app-bar {
    min-height: calc(54px + env(safe-area-inset-top));
    padding-block: max(5px, env(safe-area-inset-top)) 5px;
  }
  .mobile-brand-mark {
    width: 38px;
    height: 38px;
  }
  .mobile-round-button {
    width: 44px;
    height: 44px;
  }
  .app-shell > .workspace {
    padding-top: calc(62px + env(safe-area-inset-top));
  }
  .mobile-more-sheet {
    max-height: 94dvh;
  }
  .mobile-module-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
