/* Estilos da tela "app" — extraído de app.html (Tarefa 1).
   Cores: só via var(--token) de css/tokens.css. */

    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    html, body {
      height: 100%;
      background: var(--navy);
      overflow: hidden;
      font-family: 'Poppins', sans-serif;
    }

    /* ── Layout principal ── */
    #app {
      display: flex;
      flex-direction: column;
      height: 100%;
      height: -webkit-fill-available;
    }

    /* ── Header topo ── */
    #top-header {
      flex-shrink: 0;
      height: 52px;
      padding-top: env(safe-area-inset-top);
      background: var(--branco-a97);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border-bottom: 1px solid var(--preto-a07);
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      z-index: 100;
    }

    #btn-menu {
      position: absolute;
      left: 16px;
      top: 50%;
      transform: translateY(-50%);
      background: none;
      border: none;
      cursor: pointer;
      padding: 8px;
      display: flex;
      flex-direction: column;
      gap: 5px;
      -webkit-tap-highlight-color: transparent;
    }

    #btn-menu span {
      display: block;
      width: 22px;
      height: 2px;
      background: var(--c-1a1a1a);
      border-radius: 2px;
      transition: all 0.25s ease;
    }

    #btn-menu.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    #btn-menu.open span:nth-child(2) { opacity: 0; }
    #btn-menu.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    #header-logo {
      font-size: 13px;
      font-weight: 700;
      letter-spacing: 2px;
      color: var(--c-1a1a1a);
    }

    #header-logo span {
      color: var(--laranja);
    }

    /* Badge de notificação no botão menu */
    #menu-badge {
      position: absolute;
      top: 10px;
      left: 30px;
      width: 8px;
      height: 8px;
      background: var(--vermelho);
      border-radius: 50%;
      border: 2px solid var(--superficie);
      display: none;
    }

    #menu-badge.visible { display: block; }

    /* ── Seções / iframes ── */
    #sections {
      flex: 1;
      position: relative;
      overflow: hidden;
    }

    .section {
      position: absolute;
      inset: 0;
      display: none;
    }

    .section.active {
      display: block;
    }

    iframe {
      width: 100%;
      height: 100%;
      border: none;
      background: var(--navy);
    }

    /* ── Loading overlay dentro da seção ── */
    .section-loading {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 14px;
      background: var(--navy);
      z-index: 10;
      transition: opacity 0.3s;
    }

    .section-loading.done {
      opacity: 0;
      pointer-events: none;
    }

    .spinner {
      width: 30px;
      height: 30px;
      border: 3px solid var(--border);
      border-top-color: var(--laranja);
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }

    @keyframes spin { to { transform: rotate(360deg); } }

    .loading-label {
      font-size: 12px;
      font-weight: 600;
      color: var(--texto-suave);
      letter-spacing: 1px;
    }

    /* ── Overlay escuro quando drawer aberto ── */
    #drawer-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: var(--preto-a45);
      z-index: 200;
    }

    #drawer-overlay.open { display: block; }

    /* ── Drawer lateral ── */
    #drawer {
      position: fixed;
      top: 0;
      left: 0;
      bottom: 0;
      width: 72%;
      max-width: 280px;
      background: var(--superficie);
      z-index: 300;
      transform: translateX(-100%);
      transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    #drawer.open {
      transform: translateX(0);
    }

    #drawer-header {
      padding: 20px 20px 16px;
      padding-top: calc(20px + env(safe-area-inset-top));
      border-bottom: 1px solid var(--glass-b);
    }

    #drawer-logo {
      font-size: 14px;
      font-weight: 700;
      letter-spacing: 2px;
      color: var(--c-1a1a1a);
    }

    #drawer-logo span { color: var(--laranja); }

    #drawer-tagline {
      font-size: 10px;
      color: var(--texto-suave);
      margin-top: 3px;
      font-weight: 500;
      letter-spacing: 0.5px;
    }

    #drawer-nav {
      flex: 1;
      overflow-y: auto;
      padding: 8px 0;
    }

    .drawer-item {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 14px 20px;
      cursor: pointer;
      border: none;
      background: none;
      width: 100%;
      text-align: left;
      color: var(--c-333333);
      font-family: 'Poppins', sans-serif;
      font-size: 14px;
      font-weight: 500;
      position: relative;
      transition: background 0.15s;
      -webkit-tap-highlight-color: transparent;
    }

    .drawer-item:hover { background: var(--preto-a03); }

    .drawer-item.active {
      color: var(--laranja);
      background: var(--laranja-a06);
    }

    .drawer-item.active::before {
      content: '';
      position: absolute;
      left: 0;
      top: 6px;
      bottom: 6px;
      width: 3px;
      background: var(--laranja);
      border-radius: 0 3px 3px 0;
    }

    .drawer-icon {
      width: 20px;
      height: 20px;
      flex-shrink: 0;
      opacity: 0.7;
    }

    .drawer-item.active .drawer-icon { opacity: 1; }

    .drawer-item-badge {
      width: 7px;
      height: 7px;
      background: var(--vermelho);
      border-radius: 50%;
      margin-left: auto;
      display: none;
    }

    .drawer-item-badge.visible { display: block; }

    .drawer-divider {
      height: 1px;
      background: var(--glass-b);
      margin: 6px 20px;
    }

    #drawer-footer {
      padding: 16px 20px;
      padding-bottom: calc(16px + env(safe-area-inset-bottom));
      border-top: 1px solid var(--glass-b);
    }

    #drawer-footer-text {
      font-size: 10px;
      color: var(--preto-a30);
      font-weight: 500;
    }

    /* ── Controle de tema (claro / auto / escuro) ── */
    #drawer-tema {
      padding: 14px 20px 4px;
      border-top: 1px solid var(--glass-b);
    }

    #drawer-tema-label {
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 1.5px;
      text-transform: uppercase;
      color: var(--preto-a30);
      margin-bottom: 8px;
    }

    #tema-seg {
      display: flex;
      background: var(--glass);
      border: 1px solid var(--glass-b);
      border-radius: 10px;
      padding: 3px;
      gap: 3px;
    }

    #tema-seg button {
      flex: 1;
      border: none;
      background: none;
      font-family: 'Poppins', sans-serif;
      font-size: 11px;
      font-weight: 600;
      color: var(--c-333333);
      padding: 7px 4px;
      border-radius: 8px;
      cursor: pointer;
      transition: background 0.15s, color 0.15s;
      -webkit-tap-highlight-color: transparent;
    }

    #tema-seg button.ativo {
      background: var(--laranja);
      color: var(--branco);
    }
  

    /* ── Onboarding de primeira vez (Fase 2) ── */
    #onboarding {
      display: none;
      position: fixed;
      inset: 0;
      background: var(--preto-a45);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      z-index: 400;
      align-items: center;
      justify-content: center;
      padding: 24px;
    }

    #onboarding.aberto { display: flex; }

    #ob-card {
      position: relative;
      background: var(--superficie);
      border: 1px solid var(--border);
      border-radius: 22px;
      box-shadow: 0 12px 48px var(--preto-a35);
      padding: 34px 28px 28px;
      width: 100%;
      max-width: 400px;
      animation: obEntrar 0.3s ease;
    }

    @keyframes obEntrar { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

    #ob-fechar {
      position: absolute;
      top: 12px;
      right: 16px;
      background: none;
      border: none;
      font-size: 22px;
      color: var(--muted2);
      cursor: pointer;
      padding: 4px 8px;
    }

    .ob-passo { display: none; }
    .ob-passo.active { display: block; }

    .ob-emoji { font-size: 40px; margin-bottom: 14px; }

    .ob-titulo {
      font-size: 20px;
      font-weight: 900;
      color: var(--text);
      margin-bottom: 10px;
      line-height: 1.25;
    }

    .ob-texto {
      font-size: 13px;
      color: var(--muted);
      line-height: 1.7;
      margin-bottom: 18px;
    }

    .ob-texto strong { color: var(--text); }

    .ob-input {
      width: 100%;
      background: var(--card2);
      border: 1.5px solid var(--border);
      border-radius: 10px;
      padding: 13px 15px;
      font-family: 'Poppins', sans-serif;
      font-size: 15px;
      font-weight: 600;
      color: var(--text);
      outline: none;
      margin-bottom: 14px;
      transition: border-color 0.2s;
    }

    .ob-input:focus { border-color: var(--laranja); }
    .ob-input::placeholder { color: var(--muted2); font-weight: 400; font-size: 13px; }

    .ob-btn {
      display: block;
      width: 100%;
      background: linear-gradient(135deg, var(--laranja) 0%, var(--laranja-hover) 100%);
      box-shadow: 0 8px 24px var(--border-orange), inset 0 1px 0 var(--branco-a15);
      color: var(--branco);
      font-family: 'Poppins', sans-serif;
      font-size: 13px;
      font-weight: 700;
      letter-spacing: 1px;
      text-transform: uppercase;
      padding: 15px;
      border-radius: 11px;
      border: none;
      cursor: pointer;
      transition: opacity 0.2s;
    }

    .ob-btn:hover { opacity: 0.88; }

    .ob-pular {
      display: block;
      width: 100%;
      text-align: center;
      margin-top: 12px;
      font-size: 12px;
      color: var(--muted);
      background: none;
      border: none;
      cursor: pointer;
      font-family: 'Poppins', sans-serif;
    }

    .ob-pular:hover { color: var(--text); }

    .ob-mapa { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

    .ob-item {
      display: flex;
      gap: 12px;
      align-items: flex-start;
      background: var(--glass);
      border: 1px solid var(--glass-b);
      border-radius: 12px;
      padding: 11px 14px;
      font-size: 12px;
      color: var(--muted);
      line-height: 1.5;
    }

    .ob-item span { font-size: 18px; }
    .ob-item strong { color: var(--text); }
