.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background:
    linear-gradient(180deg, #fffaf4 0, #fff4e8 320px, #f8efe2 100%),
    var(--ec-bg);
}

.shell-header {
  display: grid;
  grid-template-columns: minmax(170px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 16px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--ec-line);
  background: rgba(255, 250, 244, 0.94);
  box-shadow: 0 8px 28px rgba(7, 29, 43, 0.06);
  position: sticky;
  top: 0;
  z-index: 2;
}

.shell-header h1 {
  margin: 2px 0 0;
  font-size: clamp(1.55rem, 2.4vw, 2.15rem);
  line-height: 1.05;
}

.shell-header .eyebrow {
  margin: 0;
  color: var(--ec-accent-dark);
}

.shell-auth,
.tabs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shell-auth {
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.shell-auth span {
  min-width: 88px;
  color: var(--ec-muted);
  font-size: 0.92rem;
  text-align: right;
}

.shell-auth button {
  min-height: 38px;
  padding: 0 15px;
}

.shell-auth button,
.tab {
  border: 1px solid var(--ec-accent);
  border-radius: var(--ec-radius);
  background: var(--ec-accent);
  color: #ffffff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.shell-auth button:hover:not(:disabled),
.tab:hover {
  border-color: var(--ec-accent-dark);
  background: var(--ec-accent-dark);
}

.shell-auth button.secondary {
  border-color: var(--ec-line-strong);
  background: #ffffff;
  color: var(--ec-ink);
}

.shell-auth button.secondary:hover:not(:disabled) {
  border-color: var(--ec-primary);
  background: var(--ec-primary-soft);
}

.shell-auth button:disabled {
  cursor: default;
  opacity: 0.55;
}

.tabs {
  flex: 1 1 auto;
  justify-content: center;
  overflow-x: auto;
  min-width: 0;
}

.tab {
  flex: 0 0 auto;
  padding: 9px 13px;
  text-decoration: none;
  white-space: nowrap;
}

.tab:not(.active) {
  border-color: transparent;
  background: transparent;
  color: var(--ec-ink);
}

.tab.active {
  box-shadow: 0 8px 18px rgba(255, 107, 43, 0.2);
}

.tab-stage {
  min-height: 0;
  padding: 0;
}

.auth-gate {
  display: grid;
  min-height: calc(100vh - 78px);
  place-items: center;
  padding: 32px;
  background:
    linear-gradient(135deg, rgba(255, 107, 43, 0.12), rgba(13, 74, 58, 0.08)),
    var(--ec-bg);
}

.auth-gate[hidden] {
  display: none;
}

.auth-gate > div {
  width: min(100%, 520px);
  padding: 30px;
  border: 1px solid var(--ec-line);
  border-radius: var(--ec-radius);
  background: var(--ec-surface);
  box-shadow: var(--ec-shadow);
}

.auth-gate h2 {
  margin: 6px 0 10px;
  color: var(--ec-ink);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.auth-gate p {
  color: var(--ec-muted);
  line-height: 1.5;
}

.auth-gate button {
  min-height: 42px;
  margin-top: 12px;
  padding: 0 18px;
  border: 1px solid var(--ec-accent);
  border-radius: var(--ec-radius);
  background: var(--ec-accent);
  color: #ffffff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.auth-gate button:hover {
  border-color: var(--ec-accent-dark);
  background: var(--ec-accent-dark);
}

.tab-stage iframe {
  display: block;
  width: 100%;
  height: calc(100vh - 78px);
  min-height: 640px;
  border: 0;
  background: var(--ec-bg);
}

.tab-stage iframe[hidden] {
  display: none;
}

@media (max-width: 860px) {
  .shell-header {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .tabs {
    justify-content: flex-start;
  }

  .shell-auth {
    justify-content: flex-start;
  }

  .shell-auth span {
    text-align: left;
  }

  .tab-stage iframe {
    height: calc(100vh - 192px);
    min-height: 600px;
  }

  .auth-gate {
    min-height: calc(100vh - 192px);
  }
}
