.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr);
  min-height: 100vh;
  background: #061e3a;
  color: #fff;
  overflow: hidden;
}

.auth-gate.hidden { display: none; }

.modal-backdrop { z-index: 320; }
.toast-region { z-index: 340; }

.corner-emblem {
  position: absolute;
  top: 26px;
  left: 30px;
  z-index: 2;
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 12px 34px rgba(0,0,0,.2);
}

.auth-brand {
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 7vw;
  background: radial-gradient(circle at 52% 45%, #0b3d70 0, #061e3a 62%);
}

.auth-brand img {
  width: min(760px, 100%);
  max-height: 76vh;
  object-fit: contain;
  border-radius: 36px;
  box-shadow: 0 38px 90px rgba(0,0,0,.22);
}

.auth-actions {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(38px, 7vw, 100px);
  color: #061e3a;
  background: #fff7eb;
}

.auth-actions h1 {
  margin: 0 0 12px;
  font-size: clamp(32px, 4vw, 55px);
  line-height: 1;
  letter-spacing: -2.5px;
}

.auth-actions p {
  margin: 0 0 30px;
  color: #64748b;
  line-height: 1.7;
  font-size: 14px;
}

.auth-primary,
.auth-secondary {
  width: 100%;
  min-height: 54px;
  border-radius: 15px;
  font-weight: 800;
  cursor: pointer;
  margin-bottom: 11px;
}

.auth-tertiary {
  border-color: transparent;
  background: transparent;
  color: #0b3d91;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  width: 100%;
  padding-right: 78px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  padding: 7px 9px;
  background: #edf2f9;
  color: #0b3d91;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

.forgot-button,
.register-inline {
  border: 0;
  background: transparent;
  color: #0b3d91;
  font-size: 10px;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

.login-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
}

.auth-primary {
  border: 0;
  color: #fff;
  background: #e85d2a;
  box-shadow: 0 12px 28px rgba(232,93,42,.23);
}

.auth-secondary {
  color: #061e3a;
  background: #fff;
  border: 1px solid #e2d8c9;
}

.driver-entry {
  align-self: center;
  margin-top: 22px;
  padding: 8px;
  border: 0;
  color: #64748b;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.app-locked {
  visibility: hidden;
  height: 100vh;
  overflow: hidden;
}

.header-emblem {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 13px;
}

.header-location {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.account-button {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 5px 12px 5px 5px;
  background: #fff;
  color: #061e3a;
  cursor: pointer;
  box-shadow: 0 5px 20px rgba(6,30,58,.08);
}

.account-button span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #0b3d91;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.account-button b {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.admin-access {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  background: #061e3a;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.admin-access span:first-child { color: #d4af37; font-size: 19px; }

.logout-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #64748b;
  font-size: 20px;
  cursor: pointer;
}

.location-box {
  padding: 16px;
  border: 1px solid #dce5ee;
  border-radius: 14px;
  background: #f7fafc;
}

.location-box strong {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
}

.location-box p {
  margin: 0 0 12px;
  font-size: 10px;
}

.location-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: #138a5b;
  font-size: 10px;
  font-weight: 800;
}

.sidebar .side-brand {
  height: 65px;
  padding: 0 7px 18px;
  overflow: hidden;
}

.sidebar .brand-mark {
  display: block;
  width: 120px;
  height: 52px;
  color: transparent;
  overflow: hidden;
  background: url("assets/logo-azul-marinho.png") center / contain no-repeat;
}

.sidebar .brand-mark > * { visibility: hidden; }

@media (max-width: 800px) {
  .auth-gate {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(300px, 48vh) 1fr;
    overflow: auto;
  }
  .auth-brand { padding: 70px 32px 20px; }
  .auth-brand img {
    width: min(440px, 100%);
    max-height: 38vh;
    border-radius: 24px;
  }
  .auth-actions {
    padding: 34px 24px 46px;
    border-radius: 28px 28px 0 0;
  }
  .corner-emblem {
    top: 18px;
    left: 18px;
    width: 46px;
    height: 46px;
  }
  .header-location,
  .brand-tagline,
  .account-button b { display: none; }
}

/* Ajustes responsivos para celular, tablet e telas amplas. */
html,
body { max-width: 100%; overflow-x: hidden; }

button,
a,
input,
select,
textarea { touch-action: manipulation; }

.topbar {
  padding-left: max(5vw, env(safe-area-inset-left));
  padding-right: max(5vw, env(safe-area-inset-right));
}

.cart-drawer {
  padding-right: max(28px, env(safe-area-inset-right));
  padding-bottom: max(28px, env(safe-area-inset-bottom));
}

@media (min-width: 1500px) {
  .hero,
  .section { padding-left: max(7vw, calc((100vw - 1440px) / 2)); padding-right: max(7vw, calc((100vw - 1440px) / 2)); }
  .benefit-banner { margin-left: max(7vw, calc((100vw - 1440px) / 2)); margin-right: max(7vw, calc((100vw - 1440px) / 2)); }
  .dashboard-main { max-width: 1500px; width: 100%; margin: 0 auto; }
}

@media (max-width: 900px) {
  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    padding-top: 48px;
  }
  .hero-content { max-width: 720px; }
  .hero-photo { height: clamp(320px, 58vw, 480px); background-size: cover; background-position: 30% 50%; }
  .floating-card { left: 20px; }
  .benefit-banner { grid-template-columns: auto 1fr; }
  .benefit-banner > button { grid-column: 1 / -1; justify-self: stretch; }
}

@media (max-width: 720px) {
  body { padding-bottom: env(safe-area-inset-bottom); }

  .topbar {
    min-height: 68px;
    height: auto;
    padding: 10px max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
  }
  .header-emblem { width: 42px; height: 42px; border-radius: 12px; }
  .account-button { padding: 4px; }
  .account-button span { width: 36px; height: 36px; }
  .icon-button,
  .logout-button { width: 42px; height: 42px; flex: 0 0 42px; }

  .hero { padding: 38px 18px 28px; gap: 30px; }
  .hero h1 { font-size: clamp(38px, 12vw, 52px); line-height: 1.02; }
  .hero p { font-size: 15px; }
  .hero-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .hero-actions button { min-height: 50px; }
  .hero-photo { height: clamp(285px, 78vw, 390px); border-radius: 28px 8px 28px 8px; }

  .benefit-banner { margin: 0 16px; padding: 22px 18px; gap: 16px; }
  .benefit-icon { width: 56px; height: 56px; border-radius: 16px; font-size: 28px; }
  .benefit-banner h2 { font-size: 20px; }

  .section { padding: 48px 16px; }
  .section-head h2 { font-size: 28px; }
  .category-tabs { scrollbar-width: thin; overscroll-behavior-inline: contain; }
  .category-tabs button { min-height: 42px; }
  .product-card { border-radius: 18px; }
  .product-visual { height: 155px; }
  .product-body { padding: 18px; }
  .add-button { width: 44px; height: 44px; }

  .dashboard-view.active { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .sidebar {
    justify-content: flex-start;
    gap: 4px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    padding: 7px max(8px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .side-link {
    flex: 0 0 66px;
    min-width: 66px;
    min-height: 56px;
    padding: 7px 5px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    text-align: center;
    font-size: 17px;
  }
  .side-link span {
    display: block;
    flex: 0;
    max-width: 62px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 8px;
    line-height: 1.1;
  }
  .side-link i { position: absolute; margin: -29px 0 0 30px; }
  .dashboard-main { padding: 26px 14px 30px; }
  .dash-head { margin-bottom: 22px; }
  .dash-head h1 { font-size: 30px; }
  .admin-head-actions > * { flex: 1; min-height: 44px; }
  .metric-card { min-height: 122px; }
  .panel { padding: 19px 16px; border-radius: 18px; }
  .panel-head { align-items: flex-start; }
  .table-wrap { margin-left: -16px; margin-right: -16px; padding: 0 16px 8px; overscroll-behavior-inline: contain; }
  .data-table { min-width: 720px; }
  .delivery-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .delivery-actions .primary,
  .delivery-actions .secondary { flex: 1 1 145px; min-height: 48px; }

  .modal-backdrop { align-items: end; padding: 0; }
  .modal {
    width: 100%;
    max-height: min(92dvh, 760px);
    padding: 28px 20px max(24px, env(safe-area-inset-bottom));
    border-radius: 26px 26px 0 0;
  }
  .cart-drawer { width: 100%; padding: 22px 18px max(22px, env(safe-area-inset-bottom)); }
  .toast-region { bottom: calc(82px + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .auth-gate { grid-template-rows: minmax(250px, 41dvh) 1fr; }
  .auth-brand { padding: 64px 24px 16px; }
  .auth-brand img { max-height: 31dvh; border-radius: 20px; }
  .auth-actions { padding: 30px 20px calc(34px + env(safe-area-inset-bottom)); }
  .auth-actions h1 { font-size: 31px; letter-spacing: -1.5px; }
  .auth-actions p { margin-bottom: 24px; font-size: 13px; }
  .corner-emblem { width: 44px; height: 44px; }
  .hero-actions { grid-template-columns: 1fr; }
  .hero-proof { gap: 7px; font-size: 10px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { padding: 15px 13px; }
  .metric-card strong { font-size: 20px; }
  .list-row { grid-template-columns: auto minmax(0, 1fr); }
  .list-row > strong { grid-column: 2; text-align: left; }
  .login-links { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 340px) {
  .metric-grid { grid-template-columns: 1fr; }
  .topbar { gap: 5px; }
  .header-emblem { width: 38px; height: 38px; }
  .account-button span,
  .icon-button,
  .logout-button { width: 38px; height: 38px; flex-basis: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
