:root {
  --navy: #0b2a6f;
  --navy-deep: #071a47;
  --navy-soft: #e8edf9;
  --red: #e6322e;
  --red-dark: #c21f1c;
  --white: #ffffff;
  --paper: #f4f6fb;
  --ink: #0e1b3d;
  --muted: #55627f;
  --line: #d6ddec;
  --ok: #0f7a4a;
  --radius: 14px;
  --font: 'Archivo', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}
body.has-bar { padding-bottom: 92px; }
h1, h2, h3, p { margin: 0; }
h1 { font-stretch: 112%; font-weight: 800; letter-spacing: -0.015em; line-height: 1.1; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--red-dark); }
.eyebrow-light { color: #fff; }

/* Botoes e campos */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 8px 18px;
  border: 1.5px solid transparent; border-radius: 10px;
  font-weight: 700; text-decoration: none; cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-large { min-height: 56px; font-size: 18px; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover:not(:disabled) { background: var(--red-dark); }
.btn-outline { background: #fff; border-color: var(--navy); color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: #fff; }
.link-button { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-weight: 600; }
.link-button:hover { color: var(--red-dark); }
.label { display: block; margin: 14px 0 6px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--navy); }
.input {
  width: 100%; min-height: 46px; padding: 10px 14px;
  background: #fff; border: 1.5px solid var(--line); border-radius: 10px;
}
.input:focus { border-color: var(--navy); outline: 3px solid rgba(11, 42, 111, .15); }
.textarea { resize: vertical; min-height: 96px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.hint:empty, .form-error:empty { display: none; }
.hint-bad, .form-error { color: var(--red-dark); font-weight: 600; font-size: 14px; }
.form-error { margin: 10px 0; }

/* Entrada */
.login { position: relative; min-height: 100vh; display: grid; place-items: center; overflow: hidden; background: var(--navy-deep); padding: 32px 16px; }
.mosaic { position: absolute; inset: -8%; display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; transform: rotate(-4deg) scale(1.08); }
.mosaic::after { content: ''; position: fixed; inset: 0; background: radial-gradient(ellipse at center, rgba(7, 26, 71, .94) 0 40%, rgba(7, 26, 71, .72) 80%); }
.mosaic-empty {
  transform: none; inset: 0; display: block;
  background:
    linear-gradient(115deg, transparent 0 62%, var(--red) 62% 64%, transparent 64% 67%, #fff 67% 67.6%, transparent 67.6%),
    linear-gradient(115deg, transparent 0 14%, var(--red) 14% 17%, transparent 17%),
    var(--navy);
}
.mosaic-empty::after { background: radial-gradient(ellipse at center, rgba(7, 26, 71, .65), rgba(7, 26, 71, .1) 80%); }
.mosaic-col { display: flex; flex-direction: column; gap: 14px; animation: drift 90s linear infinite; }
.mosaic-col.reverse { animation-direction: reverse; }
.mosaic-tile { position: relative; aspect-ratio: 3 / 4; flex: none; border-radius: var(--radius); background-size: cover; background-position: center; background-color: var(--navy); overflow: hidden; }
.mosaic-tile span { position: absolute; left: 10px; right: 10px; bottom: 10px; color: #fff; font-weight: 800; text-transform: uppercase; font-stretch: 112%; }
@keyframes drift { to { transform: translateY(-50%); } }
@media (prefers-reduced-motion: reduce) { .mosaic-col { animation: none; } }

.login-panel { position: relative; z-index: 1; width: min(440px, 100%); text-align: center; color: #fff; }
.login-logo { width: 210px; margin: 0 auto 14px; }
.login-panel h1 { font-size: clamp(30px, 6vw, 40px); margin-top: 8px; }
.road-rule { display: block; width: 84px; height: 4px; margin: 14px auto; background: repeating-linear-gradient(90deg, var(--red) 0 16px, transparent 16px 22px); }
.login-stats { color: #d5def3; font-size: 15px; margin-bottom: 18px; }
.login-card { background: #fff; color: var(--ink); border-radius: 18px; border-top: 5px solid var(--red); padding: 20px 22px 22px; text-align: left; box-shadow: 0 24px 60px rgba(0, 0, 0, .4); }
.login-lead { font-size: 14px; color: var(--muted); text-align: center; }
.login-card .label:first-of-type { margin-top: 14px; }
.login-card .btn-red { margin-top: 16px; }
.login-whats { display: block; text-align: center; margin-top: 12px; font-size: 14px; font-weight: 600; color: var(--navy); }
.lookup-card { margin: 10px 0 0; padding: 12px 14px; background: var(--navy-soft); border-radius: 10px; display: grid; gap: 6px; }
.lookup-field { display: grid; grid-template-columns: 98px 1fr; gap: 8px; font-size: 13px; }
.lookup-field dt { color: var(--muted); font-weight: 600; }
.lookup-field dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

/* Topo */
.topbar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr minmax(0, 560px) 1fr; align-items: center; gap: 16px; padding: 8px 24px; background: var(--navy); }
.topbar-logo img { height: 48px; width: auto; }
.search { grid-column: 2; }
.search-input { width: 100%; min-height: 42px; padding: 8px 18px; border: 0; border-radius: 999px; background: #fff; }
.search-input:focus { outline: 3px solid var(--red); }

.content { max-width: 1240px; margin: 0 auto; padding: 28px 24px 40px; min-height: 60vh; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: clamp(28px, 4vw, 40px); margin-top: 4px; }
.lead { color: var(--muted); margin-top: 6px; max-width: 62ch; }

/* Categorias */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.category-card { position: relative; display: block; aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden; background: var(--navy); color: #fff; text-decoration: none; }
.category-media { position: absolute; inset: 0; background-size: cover; background-position: center; transition: transform .25s; }
.category-media-empty { background: linear-gradient(115deg, transparent 0 70%, var(--red) 70% 74%, transparent 74%), var(--navy); }
.category-card::after { content: ''; position: absolute; inset: 40% 0 0; background: linear-gradient(to top, rgba(7, 26, 71, .95), transparent); }
.category-card:hover .category-media { transform: scale(1.05); }
.category-count { position: absolute; z-index: 1; top: 10px; left: 10px; padding: 3px 10px; border-radius: 999px; background: rgba(7, 26, 71, .85); font-size: 12px; font-weight: 700; }
.category-name { position: absolute; z-index: 1; left: 12px; right: 12px; bottom: 14px; padding-bottom: 7px; border-bottom: 3px solid var(--red); font-size: 20px; font-weight: 800; font-stretch: 112%; text-transform: uppercase; line-height: 1.1; overflow-wrap: anywhere; }

/* Banner */
.banner { position: relative; aspect-ratio: 3.2 / 1; min-height: 170px; width: 100%; margin-bottom: 18px; border-radius: 18px; overflow: hidden; background-size: cover; background-position: center; background-color: var(--navy); }
.banner-plain { display: grid; place-items: center; text-align: center; color: #fff; background: linear-gradient(115deg, transparent 0 76%, var(--red) 76% 79%, transparent 79% 82%, #fff 82% 82.6%, transparent 82.6%), var(--navy); }
.banner-title { padding: 34px 20px; }
.banner-title h1 { font-size: clamp(30px, 5vw, 52px); text-transform: uppercase; }
.banner-title p { color: #d5def3; margin-top: 6px; }
.banner-chip { position: absolute; z-index: 1; top: 14px; left: 14px; padding: 5px 14px; border-radius: 999px; background: rgba(7, 26, 71, .85); color: #fff; font-size: 13px; font-weight: 700; text-decoration: none; }
a.banner-chip:hover { background: var(--red); }
.banner-chip-right { left: auto; right: 14px; }

/* Produtos */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 14px; }
.product-card { display: flex; flex-direction: column; padding: 14px; background: #fff; border: 1.5px solid transparent; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(14, 27, 61, .08); }
.product-card.in-cart { border-color: var(--red); }
.product-image { display: grid; place-items: center; height: 150px; margin-bottom: 10px; }
.product-image img { max-height: 150px; object-fit: contain; }
.box-icon { width: 72px; fill: var(--navy-soft); stroke: var(--navy); stroke-width: 1.4; stroke-linejoin: round; opacity: .55; }
.product-code { font-size: 12px; font-weight: 700; color: var(--red-dark); }
.product-name { font-size: 14px; font-weight: 600; line-height: 1.25; min-height: 3.75em; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.product-price { font-size: 18px; font-weight: 800; color: var(--navy); margin: 4px 0 10px; }
.card-control { margin-top: auto; }
.stepper { display: grid; grid-template-columns: 40px minmax(36px, 1fr) 40px; align-items: stretch; min-height: 42px; background: var(--navy-soft); border: 1.5px solid var(--navy); border-radius: 10px; overflow: hidden; }
.step { background: none; border: 0; font-size: 20px; font-weight: 700; color: var(--navy); cursor: pointer; }
.step:hover { background: var(--navy); color: #fff; }
.step-input { width: 100%; min-width: 0; background: none; border: 0; text-align: center; font-weight: 800; }
.step-input:focus { background: #fff; outline: none; }

.next-category { display: block; margin-top: 28px; padding: 18px 22px; background: #fff; border-left: 5px solid var(--red); border-radius: var(--radius); text-decoration: none; }
.next-category strong { display: block; font-size: 22px; font-stretch: 112%; text-transform: uppercase; color: var(--navy); }
.next-category:hover strong { color: var(--red-dark); }

.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; max-width: 1240px; margin: 0 auto; padding: 16px 24px 24px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

/* Barra do pedido */
.order-bar { position: fixed; z-index: 30; inset: auto 0 0; display: flex; align-items: center; gap: 16px; min-height: 76px; padding: 8px 24px; background: var(--navy-deep); box-shadow: 0 -6px 20px rgba(7, 26, 71, .3); }
.bar-pallets { flex: 1; display: flex; gap: 12px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.bar-pallet { flex: none; width: 68px; text-align: center; color: #fff; text-decoration: none; }
.bar-pallet-icon { position: relative; display: block; width: 44px; margin: 0 auto; }
.pallet { width: 100%; height: auto; }
.bar-badge { position: absolute; top: -7px; right: -11px; min-width: 20px; padding: 0 5px; border-radius: 999px; background: var(--red); font-size: 11px; font-weight: 800; line-height: 20px; }
.bar-pallet-name { display: block; font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-total { flex: none; display: flex; flex-direction: column; align-items: center; padding: 7px 18px; border-radius: 10px; background: var(--red); color: #fff; text-decoration: none; }
.bar-total:hover { background: var(--red-dark); }
.bar-total strong { font-size: 18px; font-weight: 800; }
.bar-total span { font-size: 12px; font-weight: 600; }

/* Conferencia */
.order-page { max-width: 780px; margin: 0 auto; }
.order-group { margin-bottom: 18px; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 3px rgba(14, 27, 61, .08); }
.order-group-head { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 14px; padding: 12px 16px; background: var(--navy); color: #fff; }
.order-group-head h2 { font-size: 18px; font-stretch: 112%; font-weight: 800; text-transform: uppercase; }
.order-group-head p { font-size: 13px; color: #d5def3; }
.order-group-head > strong { font-size: 18px; }
.order-line { display: grid; grid-template-columns: 56px 1fr 130px 96px; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); }
.order-code { font-size: 13px; font-weight: 700; color: var(--red-dark); }
.order-name strong { display: block; font-size: 14px; font-weight: 600; line-height: 1.25; }
.order-name span { font-size: 12px; color: var(--muted); }
.order-subtotal { text-align: right; font-size: 15px; }
.order-summary { padding: 20px 22px; background: #fff; border-top: 5px solid var(--red); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(14, 27, 61, .08); }
.summary-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.summary-total span { color: var(--muted); }
.summary-total strong { font-size: 30px; font-weight: 800; color: var(--navy); }
.frete { margin-top: 8px; font-size: 14px; font-weight: 600; color: var(--muted); }
.frete-ok { color: var(--ok); }
.order-summary .btn-large { margin-top: 12px; }
.summary-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 12px; }
.summary-note { margin-top: 14px; font-size: 13px; color: var(--muted); }

.empty-state { max-width: 560px; margin: 8vh auto; text-align: center; padding: 0 16px; }
.empty-state h1 { font-size: clamp(28px, 4vw, 38px); margin: 6px 0 10px; }
.empty-state p { color: var(--muted); }
.empty-state p.eyebrow { color: var(--red-dark); }
.empty-state .btn { margin-top: 20px; }
.sent-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

@media (max-width: 720px) {
  .topbar { grid-template-columns: auto 1fr; padding: 8px 16px; gap: 10px; }
  .topbar-logo img { height: 40px; }
  .search { grid-column: 2; }
  .content { padding: 18px 16px 32px; }
  .category-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .category-name { font-size: 15px; font-stretch: 90%; overflow-wrap: break-word; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .product-card { padding: 10px; }
  .product-image { height: 110px; }
  .product-image img { max-height: 110px; }
  .stepper { grid-template-columns: 34px minmax(30px, 1fr) 34px; }
  .banner { aspect-ratio: 2 / 1; min-height: 150px; }
  .order-bar { padding: 8px 12px; gap: 10px; }
  .bar-pallet { width: 56px; }
  .bar-total { padding: 7px 12px; }
  .bar-total strong { font-size: 16px; }
  .order-group-head { grid-template-columns: 44px 1fr auto; gap: 10px; padding: 10px 12px; }
  .order-line { grid-template-columns: 1fr 96px; grid-template-areas: 'name name' 'step sub'; padding: 10px 12px; gap: 8px; }
  .order-code { display: none; }
  .order-name { grid-area: name; }
  .order-line .stepper { grid-area: step; }
  .order-subtotal { grid-area: sub; align-self: center; }
  .order-line .stepper { max-width: 150px; }
  .summary-total strong { font-size: 24px; }
  .mosaic { grid-template-columns: repeat(3, 1fr); }
  .mosaic-col:nth-child(n + 4) { display: none; }
}
