/* Incidentaloma Adrenal — layout web (tablet e desktop). No celular, mantém o visual do app. */

html.is-web-app {
  overflow-x: hidden;
}

/* Cabeçalho, barra lateral e extras da home só aparecem no desktop */
.desktop-only {
  display: none !important;
}

.layout__main {
  min-width: 0;
}

/* ===== Tablet: coluna centralizada ===== */
@media (min-width: 640px) and (max-width: 1023.98px) {
  html.is-web-app body {
    background: linear-gradient(160deg, #d6e6f6 0%, var(--bg) 55%, #dbe9f7 100%);
    padding: 2rem 1rem;
  }

  html.is-web-app #app {
    max-width: 560px;
    margin: 0 auto;
    min-height: calc(100dvh - 4rem);
    border-radius: var(--radius-lg);
    overflow: clip;
    box-shadow: var(--shadow-md);
  }
}

/* ===== Desktop ===== */
@media (min-width: 1024px) {
  .desktop-only {
    display: revert !important;
  }

  html.is-web-app body {
    background: var(--bg);
  }

  html.is-web-app #app,
  html.is-web-app #app:has(.screen--home) {
    max-width: none;
    background: transparent;
    min-height: 100dvh;
  }

  /* --- Cabeçalho do site --- */
  .site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
  }

  .site-header__inner {
    max-width: 1240px;
    height: 68px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }

  .site-header__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
  }

  .site-header__brand img {
    border-radius: 9px;
  }

  .site-header__brand strong {
    display: block;
    font-size: 1.05rem;
    color: var(--accent);
    letter-spacing: -0.02em;
  }

  .site-header__brand small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
  }

  .site-header__nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }

  .site-header__link {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.55rem 0.9rem;
    border-radius: 10px;
    cursor: pointer;
  }

  .site-header__link:hover {
    background: var(--accent-soft);
    color: var(--accent);
  }

  .site-header__link.is-active {
    color: var(--accent);
    background: var(--accent-soft);
  }

  .site-header__cta.btn {
    width: auto;
    min-width: 0;
    margin: 0 0 0 0.75rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }

  /* --- Grade principal --- */
  .layout {
    max-width: 1240px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
  }

  .layout--wide,
  .layout--home {
    grid-template-columns: minmax(0, 1fr);
  }

  .layout__main {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: clip;
  }

  .layout--home .layout__main {
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
  }

  /* --- Barra lateral --- */
  .sidebar {
    position: sticky;
    top: calc(68px + 2rem);
    display: flex !important;
    flex-direction: column;
    gap: 1rem;
    max-height: calc(100dvh - 68px - 4rem);
    overflow-y: auto;
  }

  .side-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.2rem;
    box-shadow: var(--shadow-sm);
  }

  .side-card__title {
    margin: 0 0 0.85rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
  }

  .stepper {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }

  .stepper__item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.45rem 0.5rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
  }

  .stepper__dot {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1.5px solid var(--border);
    background: var(--surface);
  }

  .stepper__item--current {
    background: var(--accent-soft);
    color: var(--accent);
  }

  .stepper__item--current .stepper__dot {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
  }

  .stepper__item--done {
    color: var(--flow-green-text);
  }

  .stepper__item--done .stepper__dot {
    background: var(--flow-green-soft);
    border-color: var(--flow-green);
    color: var(--flow-green-text);
  }

  .side-summary__group + .side-summary__group {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
  }

  .side-summary__label {
    margin: 0 0 0.35rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
  }

  .side-summary ul {
    margin: 0;
    padding-left: 1.05rem;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-body);
  }

  .side-summary li + li {
    margin-top: 0.3rem;
  }

  .side-summary__test {
    display: block;
    font-size: 0.72rem;
    color: var(--text-secondary);
  }

  .side-summary__empty {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
  }

  .side-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .side-actions .btn {
    margin: 0;
  }

  /* --- Telas do fluxo dentro do cartão principal --- */
  .topbar {
    position: static;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 2rem;
  }

  /* Marca já está no cabeçalho do site */
  .topbar__brand {
    display: none;
  }

  .topbar__title {
    margin: 0;
    font-size: 1.5rem;
  }

  .topbar__sub {
    font-size: 0.9rem;
  }

  .btn-icon {
    width: 44px;
    height: 44px;
  }

  .btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
  }

  .btn-icon--spacer {
    display: none;
  }

  /* Progresso e chip de fase já aparecem na barra lateral */
  .layout:not(.layout--wide) .flow-progress,
  .layout:not(.layout--wide) .phase-chip-wrap {
    display: none;
  }

  .screen-body {
    padding: 2rem;
  }

  .hint {
    font-size: 0.95rem;
  }

  .btn {
    width: auto;
    min-width: 15rem;
    padding-inline: 1.6rem;
  }

  .btn--primary:hover:not(:disabled),
  .btn--finalize:hover {
    filter: brightness(1.06);
  }

  .btn--ghost:hover {
    border-color: var(--accent);
    background: #fff;
  }

  .screen-body > .btn + .btn {
    margin-left: 0.5rem;
  }

  .action-stack {
    align-items: flex-start;
  }

  .hint--footer {
    text-align: left;
  }

  .nav-card {
    margin-bottom: 0;
  }

  .nav-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
  }

  .check-card:hover,
  .opt:hover {
    border-color: var(--accent-light);
  }

  .check-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
  }

  .choice-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
  }

  .choice-list .nav-card {
    align-content: flex-start;
    padding: 1.35rem 1.4rem;
  }

  .screen-body > .nav-card + .nav-card,
  .screen-body > .nav-card--compact {
    margin-bottom: 0.65rem;
  }

  .field-group {
    margin-bottom: 1.75rem;
  }

  .field-label {
    font-size: 0.95rem;
  }

  .opt {
    flex: 1 1 0;
    padding: 0.85rem 0.75rem;
    font-size: 0.9rem;
  }

  .flow-box {
    padding: 1.25rem 1.5rem;
    font-size: 0.95rem;
    max-width: 52rem;
  }

  /* Classificação, seguimento e conduta lado a lado */
  .result-stack--spaced {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
  }

  .preview-section {
    margin-bottom: 2.25rem;
  }

  /* --- Fluxograma em tela larga --- */
  .layout--wide .topbar {
    border-radius: 0;
  }

  .layout--wide .flow-viewport {
    height: calc(100dvh - 68px - 4rem - 330px);
    min-height: 420px;
    margin: 1.25rem 2rem 0;
  }

  .layout--wide .flow-viewport canvas {
    margin: 0 auto;
  }

  .layout--wide .flow-zoom-hint {
    margin-top: 0.75rem;
  }

  .layout--wide .flow-controls .btn {
    min-width: 48px;
    padding-inline: 1rem;
  }

  .layout--wide .flow-download,
  .layout--wide .screen-body--flow-back {
    display: inline-block;
    padding: 0.5rem 0 1.5rem 2rem;
  }

  .layout--wide .screen-body--flow-back {
    padding-left: 0.5rem;
  }

  .flow-download .btn {
    width: auto;
  }

  /* --- Home --- */
  .screen--home {
    min-height: auto;
    gap: 2rem;
  }

  .home-hero {
    padding: 2.5rem 0 0;
    text-align: left;
  }

  .home-hero__inner {
    max-width: 1176px;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 3.5rem;
    align-items: center;
  }

  .home-steps {
    order: 2;
  }

  .home-hero h1 {
    font-size: 3rem;
    margin-bottom: 1.25rem;
  }

  .lead {
    margin: 0 0 1rem;
    max-width: 34rem;
    font-size: 1.15rem;
  }

  .lead-muted {
    margin: 0 0 2rem;
    max-width: 34rem;
    font-size: 0.92rem;
  }

  .home-cta {
    flex-direction: row;
    max-width: none;
    margin: 0;
  }

  .home-cta .btn {
    width: auto;
    min-width: 13rem;
    white-space: nowrap;
  }

  .home-steps {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
  }

  .home-steps__heading {
    margin: 0 0 1.1rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
  }

  .home-steps__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
  }

  .home-steps__item {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
  }

  .home-steps__num {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-soft);
  }

  .home-steps__title {
    margin: 0;
    font-weight: 700;
    color: var(--text-body);
  }

  .home-steps__desc {
    margin: 0.15rem 0 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.45;
  }

  .home-preview {
    display: block !important;
    width: 100%;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
  }

  .home-preview:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
  }

  .home-preview__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.4rem;
    border-bottom: 1px solid var(--border);
  }

  .home-preview__title {
    font-weight: 700;
    color: var(--text-body);
  }

  .home-preview__link {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--accent);
  }

  .home-preview img {
    display: block;
    width: 100%;
    height: auto;
    padding: 1rem;
    background: #fff;
  }

  /* --- Diálogo --- */
  .dialog {
    max-width: 26rem;
  }

  .dialog__actions .btn {
    min-width: 0;
  }
}

@media (min-width: 1024px) {
  .screen-body.screen-body--early-finish {
    padding-top: 0;
  }

  .early-finish {
    align-items: flex-start;
  }
}
