:root {
  --primary: #0f766e; --primary-dark: #115e59; --primary-soft: #ccfbf1;
  --bg: #f6f7f9; --surface: #fff; --text: #0f172a; --muted: #64748b; --border: #e2e8f0;
  --danger: #dc2626; --radius: 14px;
  --shadow: 0 8px 30px rgba(15, 23, 42, .18);
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.35; padding-bottom: env(safe-area-inset-bottom);
}
body.lock { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; touch-action: manipulation; }
input { font: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.ico svg { width: 1.25em; height: 1.25em; display: block; stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid #5eead4; outline-offset: 2px; }

/* ---------- cabeçalho ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
  padding: calc(.6rem + env(safe-area-inset-top)) 1rem .7rem; display: grid; gap: .6rem; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; max-width: 1280px; margin: 0 auto; width: 100%; }
.brand { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand strong { font-size: 1.2rem; letter-spacing: -.02em; }
.brand span { font-size: .8rem; color: var(--muted); }
.cart-btn { display: flex; align-items: center; gap: .55rem; background: var(--text); color: #fff;
  border-radius: 999px; padding: .6rem 1rem; min-height: 46px; font-weight: 600; font-size: .9rem; white-space: nowrap; }
.cart-btn.bump { animation: bump .35s; }
@keyframes bump { 50% { transform: scale(1.08); background: var(--primary); } }
.search { position: relative; max-width: 1280px; margin: 0 auto; width: 100%; }
.search .ico { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { width: 100%; min-height: 46px; padding: .6rem 1rem .6rem 2.7rem; font-size: 1rem;
  border: 1px solid var(--border); border-radius: 999px; background: #fff; outline: none; }
.search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ---------- listagem ---------- */
main { max-width: 1280px; margin: 0 auto; padding: 1rem .75rem 4rem; }
.resumo { font-size: .85rem; color: var(--muted); margin: 0 .25rem .75rem; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 1rem; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(5, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; position: relative; content-visibility: auto; contain-intrinsic-size: 330px 520px; }
.card-img { display: block; width: 100%; aspect-ratio: 14 / 15; background: #eef0f3; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tag-in { position: absolute; top: .5rem; left: .5rem; background: var(--primary); color: #fff;
  font-size: .72rem; font-weight: 700; padding: .25rem .6rem; border-radius: 999px; }
.card-body { padding: .75rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.ref { font-weight: 800; letter-spacing: .02em; }
.nome { font-size: .85rem; font-weight: 600; text-transform: capitalize; }
.comp, .tams { font-size: .75rem; color: var(--muted); }
.cores { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.chip-mini { font-size: .72rem; background: #f1f5f9; border: 1px solid var(--border); border-radius: 999px; padding: .1rem .5rem; text-transform: capitalize; }
.preco { font-size: 1.15rem; font-weight: 800; margin-top: auto; padding-top: .35rem; }
.preco small { font-weight: 400; color: var(--muted); font-size: .72rem; }
.btn { display: flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; padding: .6rem 1rem;
  border-radius: 12px; font-weight: 700; width: 100%; transition: background .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-primary:disabled { background: #cbd5e1; cursor: not-allowed; }
.btn-ghost { background: #f1f5f9; }
.btn-danger { color: var(--danger); }
.vazio { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.sentinel { height: 1px; }

/* ---------- camadas ---------- */
.layer { position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .5); display: flex; }
.panel { background: var(--surface); display: flex; flex-direction: column; box-shadow: var(--shadow); max-height: 100%; min-height: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .85rem 1rem; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 1.1rem; }
.x { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.x:hover { background: #f1f5f9; }
.panel-body { overflow-y: auto; padding: 1rem; flex: 1; min-height: 0; overscroll-behavior: contain; }
.panel-foot { padding: .85rem 1rem calc(.85rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: #f8fafc; }

.layer-sheet { align-items: flex-end; justify-content: center; }
.layer-sheet .panel { width: 100%; max-width: 560px; max-height: 94dvh; border-radius: 20px 20px 0 0; animation: up .25s ease; }
@media (min-width: 700px) { .layer-sheet { align-items: center; } .layer-sheet .panel { border-radius: 20px; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.layer-drawer { justify-content: flex-end; }
.layer-drawer .panel { width: 100%; max-width: 480px; height: 100dvh; animation: left .25s ease; }
@keyframes left { from { transform: translateX(40px); opacity: 0; } }
.layer-dlg { align-items: center; justify-content: center; padding: 1rem; z-index: 60; }
.layer-dlg .panel { width: 100%; max-width: 400px; border-radius: 18px; padding: 1.4rem; gap: .9rem; text-align: center; animation: up .2s ease; }
.layer-dlg .acoes { display: grid; gap: .5rem; }
.sucesso-ico { width: 64px; height: 64px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; margin: 0 auto; }
.sucesso-ico svg { width: 34px; height: 34px; stroke: currentColor; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.link-btn { display: flex; align-items: center; justify-content: center; min-height: 48px; border-radius: 12px; font-weight: 700;
  background: var(--primary); color: #fff; text-decoration: none; }

/* ---------- produto (sheet) ---------- */
.prod-top { display: flex; gap: .9rem; margin-bottom: 1rem; }
.prod-top img { width: 112px; aspect-ratio: 14 / 15; object-fit: cover; border-radius: 10px; background: #eef0f3; flex: none; }
.prod-top .info { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.field-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1rem 0 .5rem; }
.cores-sel { display: flex; flex-wrap: wrap; gap: .5rem; }
.cor-opt { min-height: 46px; padding: .5rem 1.1rem; border: 2px solid var(--border); border-radius: 999px; font-weight: 700; text-transform: capitalize; background: #fff; }
.cor-opt[aria-checked="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.sizes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
@media (min-width: 460px) { .sizes { grid-template-columns: repeat(3, 1fr); } }
.size { border: 1px solid var(--border); border-radius: 12px; padding: .45rem; background: #fff; }
.size.has { border-color: var(--primary); background: #f0fdfa; }
.size-lbl { display: block; text-align: center; font-weight: 800; font-size: .9rem; margin-bottom: .3rem; }
.stepper { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: .2rem; }
.stepper button { height: 44px; border-radius: 10px; background: #f1f5f9; font-size: 1.5rem; font-weight: 700; line-height: 1; display: grid; place-items: center; user-select: none; }
.stepper button:active { background: var(--primary-soft); }
.stepper input { width: 100%; min-width: 0; height: 44px; text-align: center; font-size: 1.15rem; font-weight: 700;
  border: 1px solid var(--border); border-radius: 10px; background: #fff; outline: none; appearance: textfield; -moz-appearance: textfield; }
.stepper input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.tot-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .6rem; }
.tot-row b { font-size: 1.25rem; }
.hint { font-size: .8rem; color: var(--muted); }

/* ---------- pedido (gaveta) ---------- */
.line { display: grid; grid-template-columns: 64px 1fr; gap: .2rem .8rem; padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.line img { width: 64px; aspect-ratio: 14 / 15; object-fit: cover; border-radius: 8px; background: #eef0f3; }
.line .l-info { min-width: 0; }
.line .l-sizes { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .4rem; margin: .5rem 0; }
.line .size { padding: .3rem; }
.line .size-lbl { font-size: .75rem; margin-bottom: .2rem; }
.line .stepper { grid-template-columns: 32px 1fr 32px; }
.line .stepper button { height: 36px; font-size: 1.2rem; }
.line .stepper input { height: 36px; font-size: 1rem; }
.l-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.l-foot .sub { font-weight: 800; }
.l-acts { display: flex; gap: .25rem; }
.l-acts button { min-height: 40px; padding: 0 .7rem; border-radius: 10px; font-size: .85rem; font-weight: 600; display: flex; align-items: center; gap: .3rem; }
.l-acts button:hover { background: #f1f5f9; }
.l-acts .del { color: var(--danger); }
.l-acts .ico svg { width: 1em; height: 1em; }
.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; display: grid; gap: 1rem; justify-items: center; }
.empty .btn { width: auto; }
.resumo-ped { display: flex; justify-content: space-between; font-size: .95rem; color: var(--muted); }
.total-ped { display: flex; justify-content: space-between; font-size: 1.3rem; font-weight: 800; margin: .3rem 0 .8rem; }
.form-in { width: 100%; min-height: 48px; padding: .65rem .9rem; font-size: 1rem; border: 1px solid var(--border); border-radius: 12px; outline: none; background: #fff; margin-bottom: .5rem; }
.form-in:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-in.bad { border-color: var(--danger); }
.erro { color: var(--danger); font-size: .85rem; margin: -.1rem 0 .5rem; min-height: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.spin { width: 20px; height: 20px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80;
  background: var(--text); color: #fff; padding: .7rem 1.1rem; border-radius: 12px; display: flex; gap: 1rem; align-items: center;
  max-width: calc(100% - 2rem); box-shadow: var(--shadow); font-size: .9rem; }
.toast button { color: #5eead4; font-weight: 800; min-height: 36px; }

/* ---------- home ---------- */
.home { max-width: 560px; padding-top: 2rem; }
.home h1 { margin-bottom: 1.2rem; }
.home h2 { margin: 1.2rem 0 .5rem; font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.col-list { display: grid; gap: .6rem; }
.col-link { display: flex; justify-content: space-between; align-items: center; min-height: 60px; padding: 0 1.1rem;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); color: inherit; text-decoration: none; font-size: 1.05rem; }
.col-link:hover { border-color: var(--primary); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
