﻿.app-shell { min-height: 100vh; max-width: 100%; }

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 35;
  background: #00277680;
  backdrop-filter: blur(2px);
}

.nav-overlay.is-visible {
  display: block;
}

body.nav-open {
  overflow: hidden;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  padding: .6rem .75rem;
  border-radius: var(--radius);
  transition: background .15s ease, color .15s ease;
}

.app-topnav__grid .nav-link {
  padding: 0;
}

.nav-link:hover {
  background: var(--nav-hover-bg);
  color: var(--nav-active-text);
}

.nav-link.is-active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  font-weight: 600;
}

.app-main {
  margin-left: 0;
  min-height: 100vh;
  max-width: 100%;
  container-type: inline-size;
  container-name: app-main;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.app-content {
  display: flex;
  flex-direction: column;
  gap: var(--gap-blocks);
  padding: var(--space-block);
  max-width: var(--content-max);
  margin-inline: auto;
  overflow-x: hidden;
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  align-self: center;
  box-sizing: border-box;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  max-width: 100%;
  align-self: center;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-header);
  overflow-x: clip;
  overflow-y: visible;
}

.app-header__shell {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding: 0.6rem var(--space-block) 0;
  box-sizing: border-box;
  min-width: 0;
  overflow-x: clip;
  container-type: inline-size;
  container-name: app-header;
}

.app-header__shell:has(.app-topnav.is-open) {
  padding-bottom: 0.65rem;
}

.app-header__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 3.5rem;
}

.app-topnav {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    visibility 0.28s ease,
    padding 0.28s ease,
    margin 0.28s ease,
    max-height 0.32s ease;
  margin-top: 0;
  padding-top: 0;
  border-top: 0 solid transparent;
}

.app-topnav.is-open {
  max-height: 36rem;
  opacity: 1;
  visibility: visible;
  overflow: visible;
  margin-top: 0.55rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.app-topnav__grid {
  --topnav-cols: var(--topnav-count, 7);
  --topnav-btn-min-h: 4.35rem;
  --topnav-icon-size: 1.125rem;
  --topnav-font-size: 0.72rem;
  --topnav-label-lines: 2.35em;
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 0.4rem;
  grid-template-columns: repeat(var(--topnav-cols), minmax(0, 1fr));
  align-items: stretch;
}

.app-header__start {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-width: 0;
  flex: 0 1 auto;
  max-width: 100%;
  overflow: hidden;
}

.app-header__page {
  flex: 1 1 6rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: .05rem;
  padding-inline: .15rem;
  text-align: center;
}

.app-header__title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  font-size: clamp(.95rem, 2.5vw, 1.2rem);
  font-weight: 700;
  line-height: 1.25;
  white-space: normal;
  text-align: center;
  overflow: visible;
  color: var(--text);
  max-width: 100%;
  flex-wrap: wrap;
}

.app-header__title-icon {
  width: 1.15em;
  height: 1.15em;
  flex-shrink: 0;
  display: block;
  fill: none;
  stroke: currentColor;
  pointer-events: none;
}

.app-header__title-text {
  min-width: 0;
  overflow: visible;
  white-space: normal;
  word-break: break-word;
}

/* Botões do topo — altura, borda e ícones alinhados */
.menu-toggle,
.btn-header-tool,
.app-header__user-block {
  box-sizing: border-box;
  height: var(--header-tool-h, 2.55rem);
  min-height: var(--header-tool-h, 2.55rem);
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--header-tool-h, 2.55rem);
  min-width: var(--header-tool-h, 2.55rem);
  padding: 0;
  border: 1px solid var(--card-border);
  background: var(--input-bg);
  color: var(--text);
  border-radius: var(--radius);
  font-size: 1.15rem;
  line-height: 1;
  align-self: center;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  z-index: 1;
  box-shadow: 0 1px 0 #ffffff80 inset;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.menu-toggle[aria-expanded="true"] {
  background: var(--nav-active-bg);
  border-color: var(--brand);
  color: var(--nav-active-text);
}

.btn-header-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0 0.65rem;
  margin: 0;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 1px 0 #ffffff80 inset;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-header-tool--ghost:hover,
.btn-header-tool--ghost:focus-visible {
  background: var(--nav-hover-bg);
  border-color: var(--brand);
  color: var(--nav-active-text);
}

.theme-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: var(--header-tool-h, 2.55rem);
  min-height: var(--header-tool-h, 2.55rem);
  padding: 0 0.45rem 0 0.5rem;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  box-shadow: 0 1px 0 #ffffff80 inset;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  box-sizing: border-box;
}

.theme-select-wrap:hover,
.theme-select-wrap:focus-within {
  background: var(--nav-hover-bg);
  border-color: var(--brand);
  color: var(--nav-active-text);
}

.theme-select-wrap__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  pointer-events: none;
}

.theme-select-wrap__icon .btn__icon {
  width: 1.05em;
  height: 1.05em;
}

.theme-select-wrap .theme-select,
.theme-select-wrap select.theme-select {
  border: 0;
  background-color: transparent;
  box-shadow: none;
  height: 100%;
  min-height: 0;
  min-width: 5.25rem;
  max-width: 7.5rem;
  padding: 0 1.35rem 0 0;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234a6288' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.1rem center;
  background-size: 12px 8px;
}

html[data-theme="dark"] .theme-select-wrap {
  box-shadow: 0 1px 0 #ffffff0a inset;
}

html[data-theme="dark"] .theme-select-wrap select.theme-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23a8c0e8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
}

.btn-header-tool .btn__icon,
.btn-header-tool__icon {
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
}

.btn-header-tool__label {
  line-height: 1;
}

html[data-theme="dark"] .menu-toggle,
html[data-theme="dark"] .btn-header-tool--ghost {
  box-shadow: 0 1px 0 #ffffff0a inset;
}

.app-header__user-block {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  flex-shrink: 1;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--input-bg);
  box-shadow: 0 1px 0 #ffffff80 inset;
  overflow: hidden;
}

.app-header__user-block .app-header__user {
  display: inline-flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  max-width: min(36vw, 10rem);
  padding: 0 0.55rem;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1;
  color: var(--chip-text);
  background: var(--chip-bg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-header-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  flex-shrink: 0;
  min-width: 0;
  height: 100%;
  padding: 0 0.55rem;
  border: 0;
  border-left: 1px solid var(--card-border);
  border-radius: 0;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  box-sizing: border-box;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-header-logout:hover {
  background: var(--brand-deep);
  color: var(--on-brand);
}

.btn-header-logout__label {
  line-height: 1;
}

html[data-theme="dark"] .app-header__user-block {
  box-shadow: 0 1px 0 #ffffff0a inset;
}

html[data-theme="dark"] .btn-header-logout:hover {
  background: var(--accent);
  color: var(--on-accent);
}

.app-header__tools {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: auto;
  align-self: center;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .4rem;
  max-width: 100%;
  --header-tool-h: 2.55rem;
}

/* Ferramentas do cabeçalho — padrão Carros (altura/borda uniformes) */
.app-header__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  height: var(--header-tool-h, 2.55rem);
  min-height: var(--header-tool-h, 2.55rem);
  box-sizing: border-box;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background: var(--input-bg);
  box-shadow: 0 1px 0 color-mix(in srgb, #fff 50%, transparent) inset;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.05em;
}

.app-header__btn--select {
  padding: 0;
  min-width: 5.75rem;
  cursor: pointer;
}

.app-header__btn--select .theme-select {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 5.75rem;
  min-height: 0;
  margin: 0;
  padding: 0.45rem 1.65rem 0.45rem 0.55rem;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  color: var(--text);
  color-scheme: light;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: 1.2;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234a6288' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 10px 6px;
}

html[data-theme="dark"] .app-header__btn--select .theme-select {
  color: #f5f8ff;
  color-scheme: dark;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23c0d4f0' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 10px 6px;
}

html[data-theme="dark"] .app-header__btn {
  box-shadow: 0 1px 0 #ffffff0a inset;
}

.nav-link--logout { margin-top: .75rem; border-top: 1px solid var(--border); padding-top: .85rem; }

.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-wrap {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  width: min(420px, 100%);
  max-width: 100%;
}

.login-page .app-footer {
  width: 100%;
  margin-top: auto;
}

.login-card {
  overflow: visible;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.login-card > .company-logo--login {
  align-self: center;
  margin-inline: auto;
}

.login-card__header {
  text-align: center;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: .75rem;
  margin-bottom: 0;
  width: 100%;
  align-self: stretch;
}

.login-card__body {
  padding-top: .85rem;
  width: 100%;
  align-self: stretch;
}

.login-card .app-title {
  margin-top: 0;
  margin-bottom: 0.35rem;
  text-align: center;
  line-height: 1.4;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  font-family: var(--font-app);
  text-transform: none;
  letter-spacing: normal;
}

.login-card .app-title-brand {
  margin: 0 0 0.5rem;
  text-align: center;
  line-height: 1.25;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--company-text);
}

.card--form-narrow {
  width: 100%;
  max-width: min(36rem, 100%);
}

.company-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  overflow: visible;
  line-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  position: relative;
  vertical-align: middle;
  flex: 0 0 auto;
  box-sizing: border-box;
}

.company-logo__media {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  justify-items: center;
  width: max-content;
  max-width: 100%;
  min-height: 0;
  line-height: 0;
  margin-inline: auto;
  color: var(--company-text);
}

.company-logo:not(.company-logo--live)::before,
.company-logo:not(.company-logo--live)::after {
  content: none;
  display: none;
}

.company-logo--sidebar {
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
}

.company-logo--login {
  width: fit-content;
  max-width: calc(100% - 0.5rem);
  margin: 0 auto 0.85rem;
}

.company-logo--login .company-logo-image,
.company-logo--sidebar .company-logo-image,
.company-logo--header .company-logo-image {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 4.25rem;
  margin: 0;
}

.company-logo-image {
  grid-area: 1 / 1;
  position: relative;
  z-index: 1;
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 4.25rem;
  margin: 0;
  object-fit: contain;
  object-position: center center;
  background: transparent;
}

.company-logo--header {
  flex: 0 0 auto;
  max-width: min(100%, calc(100vw - 11rem));
}

.app-header__start .company-logo--header {
  overflow: hidden;
  align-self: center;
}

.company-logo-image--dark {
  display: none;
}

.company-logo-image--svg,
svg.company-logo-image--svg {
  display: block;
  width: auto;
  max-width: min(100%, 18rem);
  height: auto;
  max-height: 4.5rem;
}

html[data-theme="dark"] .company-logo-image--light {
  display: none;
}

html[data-theme="dark"] .company-logo-image--dark {
  display: block;
}

@media (min-width: 1025px) {
  .app-header__bar {
    min-height: 4rem;
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr) minmax(0, auto);
    grid-template-areas: "start title tools";
    align-items: center;
    flex-wrap: nowrap;
  }

  .app-header__start {
    grid-area: start;
    max-width: min(100%, 22rem);
  }

  .app-header__page {
    grid-area: title;
    flex: none;
    padding-inline: 0.5rem;
    justify-self: center;
    text-align: center;
    width: 100%;
    max-width: 100%;
  }

  .app-header__tools {
    grid-area: tools;
    margin-left: 0;
    flex: none;
    max-width: min(100%, 28rem);
  }

  .app-header__title {
    font-size: 1.15rem;
    letter-spacing: 0.03em;
  }

  .company-logo--header .company-logo-image {
    max-height: 4.25rem;
  }

  .nav-overlay.is-visible {
    display: none;
  }

  body.nav-open {
    overflow: auto;
  }
}

@media (max-width: 1024px) {
  .app-header__tools {
    max-width: 100%;
  }

  .app-header__user-block .app-header__user {
    max-width: min(28vw, 7.5rem);
    font-size: 0.72rem;
    padding: 0 0.45rem;
  }

  .btn-header-logout {
    font-size: 0.68rem;
    padding: 0 0.45rem;
  }

  .app-header__start {
    flex: 1 1 auto;
    max-width: min(100%, calc(100% - 9rem));
  }

  .company-logo--header .company-logo-image {
    max-height: clamp(2.35rem, 8.5vw, 3.15rem);
  }

  .app-header__title {
    font-size: clamp(0.82rem, 3.2vw, 1rem);
  }

  .app-header__title-icon {
    width: 1em;
    height: 1em;
  }
}

@container app-header (max-width: 52rem) {
  .app-topnav__grid {
    --topnav-cols: min(var(--topnav-count, 7), 4);
  }
}

@container app-header (max-width: 34rem) {
  .app-topnav__grid {
    --topnav-cols: min(var(--topnav-count, 7), 3);
  }
}

@container app-header (max-width: 22rem) {
  .app-topnav__grid {
    --topnav-cols: 2;
  }
}

.app-header__subtitle {
  margin: 0;
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.35;
  white-space: normal;
  overflow: visible;
  text-align: center;
  max-width: 100%;
  word-break: break-word;
}

.login-theme-toolbar {
  display: flex;
  justify-content: center;
  margin-top: 0.85rem;
}

/* Rodapé — créditos e empresa */
.app-footer {
  width: 100%;
  max-width: 100%;
  margin-top: auto;
  align-self: stretch;
  flex-shrink: 0;
  position: relative;
  padding: 0 var(--space-block) clamp(0.75rem, 2vw, 1rem);
  box-sizing: border-box;
}

.app-footer::before {
  content: "";
  display: block;
  height: 3px;
  max-width: var(--content-max);
  margin: 0 auto 0.7rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--accent) 50%, var(--brand) 100%);
  background-size: 200% 100%;
  box-shadow: 0 0 14px #009c3b2e;
}

.app-footer__shell {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  box-sizing: border-box;
}

.app-footer__bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.78rem 1.2rem;
  text-align: center;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--card-bg) 0%, var(--surface-solid) 52%, var(--card-bg) 100%);
  box-shadow: var(--shadow-card), 0 1px 0 #ffffff80 inset;
}

html[data-theme="dark"] .app-footer__bar {
  background: linear-gradient(135deg, #1a2840 0%, #121a2b 50%, #1a2840 100%);
  box-shadow: var(--shadow-card), 0 1px 0 #ffffff0d inset;
}

.app-footer__company {
  margin: 0;
  font-size: clamp(0.72rem, 1.6vw, 0.84rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--brand);
  line-height: 1.2;
  padding: 0.28rem 0.72rem;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--bandeira-branco) 0%, var(--brand-soft) 100%);
  border: 1px solid var(--logo-frame-border);
  box-shadow: 0 2px 10px #00277616;
}

html[data-theme="dark"] .app-footer__company {
  color: var(--on-brand);
  background: linear-gradient(180deg, var(--brand-mid) 0%, var(--brand) 100%);
  border-color: var(--brand-mid);
  box-shadow: 0 2px 10px #00000035;
}

.app-footer__credit {
  margin: 0;
  font-size: clamp(0.68rem, 1.4vw, 0.78rem);
  color: var(--muted);
  line-height: 1.45;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .35rem .5rem;
}

.app-footer__author.btn-ghost {
  font-size: inherit;
  text-transform: none;
  letter-spacing: normal;
  padding: .2rem .55rem;
  font-weight: 650;
  color: var(--accent);
  border-color: #009c3b55;
}

.app-footer__author.btn-ghost:hover {
  color: var(--accent-hover);
  border-color: currentColor;
}

html[data-theme="dark"] .app-footer__author.btn-ghost {
  color: var(--accent);
  border-color: #47d17a66;
}

html[data-theme="dark"] .app-footer__author.btn-ghost:hover {
  color: var(--accent-hover);
}

