    /* =============== SHELL — SIDEBAR + MAIN =============== */
    #app-shell {
      display: flex;
      width: var(--vw-safe);
      height: var(--vh-safe);
      overflow: hidden;
    }

    #app-shell.hidden {
      display: none;
    }

    #sidebar {
      width: var(--sb-w);
      flex-shrink: 0;
      height: var(--vh-safe);
      background: linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.32));
      border-right: 1px solid rgba(244, 201, 74, 0.14);
      display: flex;
      flex-direction: column;
      align-items: center;
      overflow-y: auto;
      overflow-x: hidden;
      scrollbar-width: thin;
      padding: clamp(20px, 4vh, 36px) 22px;
      padding-top: calc(clamp(20px, 4vh, 36px) + env(safe-area-inset-top));
      padding-left: calc(22px + env(safe-area-inset-left));
      gap: 4px;
      position: relative;
      z-index: 5;
      transition: transform 0.28s var(--ease);
    }

    #sidebar::before {
      content: '';
      position: absolute;
      inset: 0;
      background: radial-gradient(ellipse 100% 40% at 50% 0%, rgba(244, 201, 74, 0.09), transparent 65%);
      pointer-events: none;
    }

    #sidebar-close {
      display: none;
      position: absolute;
      top: calc(14px + env(safe-area-inset-top));
      right: 14px;
      width: 34px;
      height: 34px;
      border-radius: 50%;
      border: 1px solid var(--card-border-hover);
      background: rgba(255, 255, 255, 0.06);
      color: var(--cream);
      align-items: center;
      justify-content: center;
      z-index: 2;
    }

    #sidebar-close svg {
      width: 16px;
      height: 16px;
    }

    .sb-divider {
      width: 100%;
      height: 1px;
      margin: 18px 0;
      background: linear-gradient(to right, transparent, rgba(244, 201, 74, 0.28), transparent);
      flex-shrink: 0;
    }

    /* Perfil */
    #profile-widget {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      position: relative;
      z-index: 1;
    }

    #profile-photo {
      width: 84px;
      height: 84px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      background: linear-gradient(145deg, var(--purple-light), var(--purple));
      border: 3px solid var(--gold);
      box-shadow: 0 0 0 4px rgba(244, 201, 74, 0.12), 0 8px 26px rgba(0, 0, 0, 0.4);
      font-family: var(--serif);
      font-size: 2rem;
      font-weight: 700;
      color: var(--gold-light);
      overflow: hidden;
    }

    #profile-photo img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    #profile-name {
      font-family: var(--serif);
      font-size: 1.25rem;
      font-weight: 700;
      letter-spacing: -0.01em;
    }

    #status-chip {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      background: var(--amber-soft);
      border: 1px solid rgba(244, 201, 74, 0.28);
      border-radius: 50px;
      padding: 5px 13px;
      font-size: 0.68rem;
      font-weight: 600;
      letter-spacing: 1.4px;
      text-transform: uppercase;
      color: var(--cream);
    }

    #status-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--gold);
      box-shadow: 0 0 6px var(--gold);
      flex-shrink: 0;
    }

    /* Relógio */
    #clock-widget {
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 14px 0;
      position: relative;
      z-index: 1;
    }

    #clk-time {
      font-family: var(--serif);
      font-size: clamp(2.1rem, 7vh, 2.7rem);
      font-weight: 700;
      letter-spacing: -1px;
      line-height: 1;
      color: var(--cream);
    }

    #clk-colon {
      color: var(--gold);
      animation: blink 1s step-end infinite;
    }

    @keyframes blink {

      0%,
      100% {
        opacity: 1;
      }

      50% {
        opacity: 0.25;
      }
    }

    #clk-date {
      margin-top: 6px;
      font-size: 0.8rem;
      color: var(--gold-light);
      font-weight: 500;
      text-align: center;
      text-transform: capitalize;
    }

    /* Clima */
    #weather-widget {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 0;
      position: relative;
      z-index: 1;
    }

    #wx-icon {
      font-size: 1.9rem;
      line-height: 1;
    }

    #wx-temp {
      font-family: var(--serif);
      font-size: 1.3rem;
      font-weight: 700;
      color: var(--cream);
      line-height: 1;
    }

    #wx-desc {
      font-size: 0.7rem;
      color: var(--cream-soft);
      margin-top: 2px;
    }

    /* Player Áudio */
    #music-widget {
      width: 100%;
      padding: 14px 0 4px;
      position: relative;
      z-index: 1;
    }

    #mw-head {
      display: flex;
      align-items: center;
      gap: 9px;
      margin-bottom: 12px;
    }

    #mw-icon {
      width: 20px;
      height: 20px;
      color: var(--gold);
      flex-shrink: 0;
    }

    #mw-track {
      font-size: 0.85rem;
      font-weight: 500;
      color: var(--cream);
      margin-top: 4px;
    }

    #sb-waves {
      display: flex;
      align-items: flex-end;
      justify-content: center;
      gap: 4px;
      height: 26px;
      margin: 10px 0;
    }

    #sb-waves span {
      width: 3px;
      background: linear-gradient(180deg, var(--gold), var(--gold-deep));
      border-radius: 3px;
      height: 6px;
      transition: height 0.15s ease;
    }

    #sb-waves.playing span {
      animation: wave 1.1s ease-in-out infinite;
    }

    #sb-waves span:nth-child(1) {
      animation-delay: 0s;
    }

    #sb-waves span:nth-child(2) {
      animation-delay: 0.12s;
    }

    #sb-waves span:nth-child(3) {
      animation-delay: 0.24s;
    }

    #sb-waves span:nth-child(4) {
      animation-delay: 0.36s;
    }

    #sb-waves span:nth-child(5) {
      animation-delay: 0.48s;
    }

    @keyframes wave {

      0%,
      100% {
        height: 5px;
      }

      50% {
        height: 24px;
      }
    }

    #mw-play {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      border: 1px solid var(--card-border-hover);
      background: linear-gradient(145deg, var(--gold), var(--gold-deep));
      color: var(--purple-deep2);
      display: flex;
      align-items: center;
      justify-content: center;
      transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
      box-shadow: 0 6px 18px rgba(244, 201, 74, 0.25);
    }

    #mw-play:hover {
      transform: scale(1.06);
      box-shadow: 0 8px 24px rgba(244, 201, 74, 0.4);
    }

    #mw-play:active {
      transform: scale(0.94);
    }

    #mw-play svg {
      width: 20px;
      height: 20px;
    }

    #mw-controls {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
    }

    #mw-prev,
    #mw-next {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      border: 1px solid var(--card-border-hover);
      background: rgba(255, 255, 255, 0.04);
      color: var(--cream);
      display: flex;
      align-items: center;
      justify-content: center;
      transition: transform 0.18s var(--ease), background 0.18s var(--ease);
    }

    #mw-prev:hover,
    #mw-next:hover {
      background: rgba(255, 255, 255, 0.09);
      border-color: var(--gold);
    }

    #mw-prev:active,
    #mw-next:active {
      transform: scale(0.92);
    }

    #mw-prev svg,
    #mw-next svg {
      width: 14px;
      height: 14px;
    }

    /* Botões Sidebar */
    .sidebar-btn {
      width: 100%;
      padding: 10px 14px;
      margin-top: 6px;
      border: 1px solid var(--card-border-hover);
      background: rgba(255, 255, 255, 0.04);
      color: var(--cream);
      border-radius: 10px;
      font-size: 0.82rem;
      font-weight: 600;
      transition: all 0.2s var(--ease);
    }

    .sidebar-btn:hover {
      background: rgba(255, 255, 255, 0.08);
      border-color: var(--gold);
    }

    .sidebar-btn:active {
      transform: scale(0.98);
    }

    .sidebar-btn[hidden] {
      display: none;
    }

    .sidebar-btn-install {
      background: var(--amber-soft);
      border-color: var(--gold);
      color: var(--gold-light);
    }

    .sidebar-btn-install:hover {
      background: rgba(244, 201, 74, 0.2);
    }

    .sidebar-btn-logout {
      background: rgba(217, 140, 140, 0.1);
      border-color: rgba(217, 140, 140, 0.3);
      color: #d98c8c;
    }

    .sidebar-btn-logout:hover {
      background: rgba(217, 140, 140, 0.2);
      border-color: #d98c8c;
    }

    /* =============== MAIN CONTENT =============== */
    #main-content {
      flex: 1;
      min-width: 0;
      height: var(--vh-safe);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      padding-right: env(safe-area-inset-right);
    }

    /* Botão hambúrguer — só existe/aparece no mobile (ver media query) */
    #menu-toggle {
      display: none;
      width: 40px;
      height: 40px;
      border-radius: 10px;
      border: 1px solid var(--card-border-hover);
      background: rgba(255, 255, 255, 0.06);
      color: var(--gold-light);
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    #menu-toggle svg {
      width: 20px;
      height: 20px;
    }

    #main-header {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    #main-header-text {
      min-width: 0;
      flex: 1;
    }

    #offline-badge {
      flex-shrink: 0;
      font-size: var(--text-2xs);
      font-weight: 700;
      letter-spacing: 0.03em;
      text-transform: uppercase;
      color: var(--no);
      background: rgba(217, 140, 140, 0.14);
      border: 1px solid rgba(217, 140, 140, 0.4);
      border-radius: var(--radius-pill);
      padding: var(--sp-1) var(--sp-3);
    }

    /* Fundo escurecido atrás do menu quando aberto no mobile */
    #sidebar-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.55);
      z-index: 4;
      opacity: 0;
      transition: opacity 0.28s var(--ease);
    }

    #sidebar-backdrop.visible {
      opacity: 1;
    }

    #main-header {
      padding: clamp(10px, 2vh, 18px) clamp(24px, 3vw, 44px) 4px;
      flex-shrink: 0;
    }

    #main-header h1 {
      font-family: var(--serif);
      font-size: clamp(1.15rem, 2vw, 1.5rem);
      font-weight: 700;
      color: var(--gold-light);
      letter-spacing: -0.01em;
    }

    #cards-scroll {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      overflow-x: hidden;
      padding: var(--sp-1) clamp(20px, 2.6vw, 40px) var(--sp-4);
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: var(--sp-4);
    }

    .card {
      background: var(--card-bg);
      border: 1px solid var(--card-border);
      border-radius: var(--radius-lg);
      padding: var(--sp-4) var(--sp-5);
      backdrop-filter: blur(6px);
      box-shadow: var(--shadow-sm);
      transition: border-color 0.25s var(--ease), background 0.25s var(--ease), box-shadow 0.25s var(--ease);
      height: auto;
      min-height: 240px;
      overflow: hidden;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
    }

    .card:hover {
      border-color: var(--card-border-hover);
      background: var(--card-bg-2);
      box-shadow: var(--shadow-md);
    }

    .card h2 {
      font-family: var(--serif);
      font-size: var(--text-sm);
      font-weight: 700;
      color: var(--gold);
      margin-bottom: var(--sp-3);
      letter-spacing: 0.01em;
      text-transform: uppercase;
      flex-shrink: 0;
    }

    /* Carrossel de widgets (Ansiedade + Progresso + Streak).
       No desktop os dois níveis (wrapper e trilha) usam display:contents,
       então os 3 cards viram itens normais do grid — nenhuma diferença
       visual. Só no mobile (ver breakpoint abaixo) o wrapper vira o
       carrossel deslizável de fato. */
    #widget-carousel,
    #widget-carousel-track {
      display: contents;
    }

    #widget-carousel-dots {
      display: none;
    }

    @media (max-width: 900px) {

      html,
      body {
        overflow-y: auto;
        overflow-x: hidden;
        height: auto;
        min-height: 100%;
      }

      #app-shell {
        height: auto;
        min-height: var(--vh-safe);
        overflow-x: hidden;
        overflow-y: visible;
      }

      #main-content {
        height: auto;
        overflow-x: hidden;
        overflow-y: visible;
      }

      #cards-scroll {
        grid-template-columns: minmax(0, 1fr);
        overflow-x: hidden;
        overflow-y: visible;
        flex: none;
      }

      .card {
        height: auto;
        overflow: visible;
        min-width: 0;
      }

      /* Carrossel de widgets: vira um único item do grid mobile, com uma
         trilha horizontal deslizável (scroll-snap) dentro dele. Fica no
         mesmo espaço/largura do card normal — sem "sangrar" para fora,
         para não causar rolagem horizontal na página.
         min-width:0 em toda a cadeia é essencial aqui: sem isso, o
         "tamanho mínimo automático" de itens flex/grid usa o conteúdo
         (3 slides lado a lado) para calcular a largura mínima, e a
         página inteira acaba esticando para caber esse mínimo. */
      #widget-carousel {
        display: block;
        min-width: 0;
      }

      #widget-carousel-track {
        display: flex;
        overflow-x: auto;
        overflow-y: visible;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        min-width: 0;
      }

      #widget-carousel-track::-webkit-scrollbar {
        display: none;
      }

      .carousel-item {
        flex: 0 0 100%;
        scroll-snap-align: center;
        overflow: hidden;
        min-width: 0;
      }

      #widget-carousel-dots {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: var(--sp-2);
        margin-top: var(--sp-3);
      }

      #widget-carousel-dots .dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.18);
        border: none;
        padding: 0;
        transition: background 0.2s var(--ease), transform 0.2s var(--ease);
      }

      #widget-carousel-dots .dot.active {
        background: var(--gold);
        transform: scale(1.25);
      }
    }

