/* =================================================================
   Maria Rica — Admin Dashboard styles
   ================================================================= */

.admin-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }

/* ---------- sidebar ---------- */
.side {
  position: sticky; top: 0; align-self: start;
  height: 100vh;
  padding: 1.8rem 1.4rem;
  display: flex; flex-direction: column; gap: 2rem;
  background: linear-gradient(180deg, rgba(255,255,255,.75), rgba(251,244,241,.55));
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--line);
  z-index: 10;
}
.side .brand { display: flex; align-items: center; gap: .7rem; }
.side .brand .mark { width: 38px; height: 38px; flex: none; }
.side .brand b { font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; color: var(--ink); line-height: 1; }
.side .brand b span { color: var(--rose); font-style: italic; display: block; font-size: 1.05rem; }

.side nav { display: flex; flex-direction: column; gap: .3rem; }
.side nav a {
  display: flex; align-items: center; gap: .7rem;
  padding: .7rem .9rem; border-radius: var(--r-sm);
  font-size: .92rem; color: var(--ink-soft);
  transition: all .3s var(--ease);
}
.side nav a:hover { background: rgba(244,213,220,.5); color: var(--ink); }
.side nav a svg { color: var(--gold-deep); }
.side .spacer { flex: 1; }
.side .view-site { font-size: .82rem; letter-spacing: .08em; color: var(--gold-deep); }

/* ---------- main ---------- */
.main { padding: 2.2rem clamp(1.2rem, 4vw, 3rem) 4rem; position: relative; z-index: 2; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.8rem; }
.page-head h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(2rem, 4vw, 2.8rem); color: var(--ink); line-height: 1; }
.page-head p { color: var(--ink-soft); font-size: .92rem; }

/* stat cards */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2rem; }
.stat {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 1.2rem 1.3rem; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: .25rem;
}
.stat .ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; margin-bottom: .5rem; }
.stat .ico.g { background: rgba(194,161,91,.16); color: var(--gold-deep); }
.stat .ico.r { background: rgba(201,135,154,.18); color: var(--rose-deep); }
.stat .ico.s { background: rgba(74,47,44,.1); color: var(--ink); }
.stat b { font-family: var(--font-display); font-weight: 600; font-size: 2rem; color: var(--ink); line-height: 1; }
.stat span { font-size: .8rem; letter-spacing: .04em; color: var(--ink-soft); }

.layout { display: grid; grid-template-columns: 380px 1fr; gap: 1.6rem; align-items: start; }

/* ---------- form panel ---------- */
.panel {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: 1.5rem;
}
.panel.sticky { position: sticky; top: 1.5rem; }
.panel h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; color: var(--ink); margin-bottom: .3rem; }
.panel .hint { font-size: .82rem; color: var(--ink-soft); margin-bottom: 1.2rem; }

.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-deep); margin-bottom: .4rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: .7rem .85rem;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--cream); color: var(--ink);
  transition: border .3s, box-shadow .3s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(194,161,91,.18); background: var(--white);
}
.field textarea { resize: vertical; min-height: 70px; }

/* linha de opção liga/desliga (checkbox + texto) */
.field label.check-line {
  display: flex; align-items: flex-start; gap: .6rem;
  text-transform: none; letter-spacing: 0;
  font-size: .92rem; font-weight: 600; color: var(--ink);
  cursor: pointer; margin-bottom: 0;
}
.field .check-line input[type="checkbox"] {
  width: 18px; height: 18px; flex: none; margin-top: .1rem;
  accent-color: var(--gold-deep); cursor: pointer;
}
.field .check-line small {
  display: block; margin-top: .2rem;
  font-size: .78rem; font-weight: 400; color: var(--ink-soft);
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }

/* medidas (busto/cintura/quadril) com sufixo "cm" dentro do campo */
.measure { position: relative; }
.measure input { padding-right: 2.6rem; }
.measure input::-webkit-outer-spin-button, .measure input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.measure input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.measure .unit {
  position: absolute; right: .8rem; top: 50%; transform: translateY(-50%);
  font-size: .78rem; color: var(--ink-soft); pointer-events: none;
}

/* image dropzone */
.dropzone {
  position: relative; border: 2px dashed var(--line); border-radius: var(--r-md);
  aspect-ratio: 3/4; max-height: 240px; overflow: hidden;
  display: grid; place-items: center; text-align: center;
  background: linear-gradient(135deg, var(--blush-soft), var(--cream-2));
  color: var(--rose-deep); cursor: pointer; transition: border .3s, background .3s;
}
.dropzone:hover { border-color: var(--gold); }
.dropzone.has-img { border-style: solid; }
.dropzone img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dropzone { cursor: default; }
.dropzone .ph { display: flex; flex-direction: column; align-items: center; gap: .7rem; font-size: .84rem; padding: 1rem; }
.dropzone .ph svg { opacity: .7; }
.dz-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.dz-actions .btn { z-index: 2; }
.dz-clear { position: absolute; top: .5rem; right: .5rem; z-index: 3; width: 28px; height: 28px; border-radius: 50%; background: rgba(74,47,44,.7); color: #fff; display: none; place-items: center; }
.dropzone.has-img .dz-clear { display: grid; }

/* multi-photo gallery */
.lbl-sub { text-transform: none; letter-spacing: 0; color: var(--ink-soft); font-size: .72rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .55rem; }
.gempty {
  grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: .4rem;
  padding: 1.6rem 1rem; text-align: center; font-size: .82rem; color: var(--rose-deep);
  border: 2px dashed var(--line); border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--blush-soft), var(--cream-2));
}
.gthumb { position: relative; aspect-ratio: 3/4; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.gthumb img { width: 100%; height: 100%; object-fit: cover; }
.gthumb .rm, .gthumb .setcap {
  position: absolute; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: .78rem; line-height: 1;
  color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.gthumb .rm { top: .3rem; right: .3rem; background: rgba(192,57,43,.92); }
.gthumb .setcap { top: .3rem; left: .3rem; background: rgba(74,47,44,.75); }
.gthumb .setcap:hover { background: var(--gold-deep); }
.gthumb .cap { position: absolute; top: .3rem; left: .3rem; padding: .1rem .5rem; border-radius: 999px; font-size: .64rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: #fff; background: linear-gradient(135deg, var(--gold), var(--gold-deep)); }
.gfull { grid-column: 1 / -1; text-align: center; font-size: .76rem; color: var(--ink-soft); }

.size-pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.size-pills button {
  padding: .45rem .75rem; border-radius: 999px; font-size: .84rem;
  border: 1px solid var(--line); background: var(--cream); color: var(--ink-soft); transition: all .25s;
}
.size-pills button.on { background: linear-gradient(135deg, var(--rose), var(--rose-deep)); color: #fff; border-color: transparent; }

.form-actions { display: flex; gap: .6rem; margin-top: 1.2rem; }
.form-actions .btn { flex: 1; }

/* ---------- product list ---------- */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.list-head h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.6rem; color: var(--ink); }
.list-tools { display: flex; gap: .5rem; align-items: center; }
.mini-search { display: flex; align-items: center; gap: .4rem; padding: .5rem .85rem; border: 1px solid var(--line); border-radius: 999px; background: var(--white); }
.mini-search input { border: none; outline: none; background: transparent; width: 150px; }

.prod-list { display: flex; flex-direction: column; gap: .8rem; }
.prow {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 1rem; align-items: center;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: .7rem .9rem; box-shadow: var(--shadow-sm);
  transition: transform .3s, box-shadow .3s;
}
.prow:hover { transform: translateX(3px); box-shadow: var(--shadow-md); }
.prow .thumb { width: 64px; height: 80px; border-radius: 10px; object-fit: cover; background: linear-gradient(135deg, var(--blush-soft), var(--cream-2)); display: grid; place-items: center; color: var(--rose); }
.prow .info b { font-family: var(--font-display); font-size: 1.25rem; color: var(--ink); display: block; line-height: 1.1; }
.prow .info .meta { font-size: .8rem; color: var(--ink-soft); display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .2rem; }
.prow .info .meta span { background: var(--cream-2); padding: .1rem .5rem; border-radius: 999px; }
.prow .info .price { color: var(--rose-deep); font-weight: 600; }
.tag-cod { background: var(--blush-soft) !important; color: var(--rose-deep); font-weight: 600; }
.tag-med { background: rgba(228,210,166,.35) !important; color: var(--gold-deep); }
.tag-sold { background: rgba(74,47,44,.12) !important; color: var(--ink); }
.prow .acts { display: flex; gap: .4rem; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--cream); color: var(--ink-soft); transition: all .25s; }
.icon-btn:hover { color: var(--ink); border-color: var(--gold); background: var(--white); }
.icon-btn.del:hover { color: #c0392b; border-color: #e8a39b; }
.icon-btn.on { background: var(--rose); color: #fff; border-color: transparent; }

.empty-list { text-align: center; padding: 3rem 1rem; color: var(--ink-soft); background: rgba(255,255,255,.5); border: 1px dashed var(--line); border-radius: var(--r-md); }
.empty-list .em { font-size: 2.4rem; }

/* ---------- lock screen ---------- */
.lock { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--cream); background-image: radial-gradient(40rem 30rem at 80% -10%, rgba(244,213,220,.7), transparent 60%); }
.lock .box { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 2.4rem; text-align: center; box-shadow: var(--shadow-lg); width: min(360px, 90vw); }
.lock h2 { font-family: var(--font-display); font-size: 2rem; color: var(--ink); margin: .8rem 0 .2rem; }
.lock p { color: var(--ink-soft); font-size: .88rem; margin-bottom: 1.2rem; }
.lock input { width: 100%; text-align: center; letter-spacing: .3em; padding: .8rem; border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: .9rem; }
.lock .err { color: #c0392b; font-size: .82rem; min-height: 1.2em; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translate(-50%, 120%); background: var(--ink); color: var(--cream); padding: .8rem 1.4rem; border-radius: 999px; box-shadow: var(--shadow-lg); z-index: 300; transition: transform .45s var(--ease); font-size: .9rem; }
.toast.show { transform: translate(-50%, 0); }

/* config modal */
.modal-bg { position: fixed; inset: 0; background: rgba(74,47,44,.4); backdrop-filter: blur(3px); display: none; place-items: center; z-index: 150; padding: 1rem; }
.modal-bg.show { display: grid; }
.modal { background: var(--white); border-radius: var(--r-lg); padding: 1.8rem; width: min(440px, 92vw); box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.modal h2 { font-family: var(--font-display); font-size: 1.7rem; color: var(--ink); margin-bottom: 1rem; }

/* select estilizado (categoria, marca, estado, status) */
.nselect { position: relative; }
.nselect > select { position: absolute; opacity: 0; width: 0; height: 0; padding: 0; border: 0; pointer-events: none; }
.nselect-trigger {
  width: 100%; display: flex; align-items: center; gap: .5rem;
  padding: .7rem .85rem; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--cream); color: var(--ink); text-align: left; font-size: 1rem; line-height: 1.4;
  transition: border .3s, box-shadow .3s, background .3s;
}
.nselect-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nselect-chev { flex: none; color: var(--ink-soft); transition: transform .25s; }
.nselect.open .nselect-trigger, .nselect-trigger:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(194,161,91,.18); background: #fff; }
.nselect.open .nselect-chev { transform: rotate(180deg); }
.nselect-menu {
  position: absolute; top: calc(100% + 5px); left: 0; right: 0; z-index: 40;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm);
  box-shadow: var(--shadow-md); max-height: 248px; overflow-y: auto; padding: .3rem; display: none;
  animation: nseldrop .16s ease;
}
@keyframes nseldrop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.nselect.open .nselect-menu { display: block; }
.nselect-item { display: block; width: 100%; text-align: left; padding: .58rem .7rem; border-radius: 9px; font-size: .95rem; color: var(--ink); transition: background .15s, color .15s; }
.nselect-item:hover { background: var(--blush-soft); color: var(--rose-deep); }
.nselect-item.sel { background: var(--cream-2); font-weight: 500; }

/* validação do código (duplicado) */
#codigo.ok  { border-color: #2e9e58; box-shadow: 0 0 0 3px rgba(46,158,88,.16); background: #fff; }
#codigo.dup { border-color: #c0392b; box-shadow: 0 0 0 3px rgba(192,57,43,.16); background: #fff; }
.field-msg { display: none; margin-top: .35rem; font-size: .78rem; color: #c0392b; font-weight: 500; }
.field-msg.show { display: block; animation: nseldrop .15s ease; }

/* estatísticas / tráfego */
.modal-stats { width: min(860px, 96vw); max-height: 92vh; overflow-y: auto; }
.stats-topbar { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.stats-topbar .stats-period { margin-bottom: 0; }
.btn-danger { color: #b03a2e; border-color: #e7bdb4; }
.btn-danger:hover { background: #fdf1ef; border-color: #d99a8e; }
.stats-period { display: inline-flex; gap: .3rem; padding: .25rem; background: var(--cream-2); border-radius: 999px; margin-bottom: 1.2rem; }
.stats-period button { padding: .4rem .9rem; border-radius: 999px; font-size: .84rem; color: var(--ink-soft); transition: all .2s; }
.stats-period button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 500; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1.4rem; }
.kpi { background: var(--cream); border: 1px solid var(--line); border-radius: var(--r-md); padding: .9rem 1rem; }
.kpi b { display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.9rem; line-height: 1; color: var(--ink); }
.kpi span { font-size: .76rem; color: var(--ink-soft); letter-spacing: .03em; }
.kpi.gold b { color: var(--gold-deep); } .kpi.rose b { color: var(--rose-deep); }
.chart { background: var(--cream); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1rem 1rem .65rem; }
.chart-bars { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 120px; }
.cbar { flex: 1; max-width: 90px; height: 100%; display: flex; align-items: flex-end; position: relative; }
.cbar-fill { width: 100%; min-width: 4px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--gold), var(--rose)); transition: height .4s var(--ease); }
.cbar-tip { display: none; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 5px; background: var(--ink); color: #fff; font-size: .7rem; padding: .2rem .45rem; border-radius: 6px; white-space: nowrap; z-index: 3; }
.cbar:hover .cbar-tip { display: block; }
.cbar:hover .cbar-fill { filter: brightness(1.08); }
.chart-x { display: flex; justify-content: space-between; margin-top: .45rem; font-size: .72rem; color: var(--ink-soft); }

/* abas das estatísticas: Resumo · Cliques · Visitas */
.stats-tabs { display: flex; gap: .25rem; margin: 1.3rem 0 0; border-bottom: 1px solid var(--line); }
.stab {
  padding: .55rem 1rem .6rem; font-size: .9rem; color: var(--ink-soft);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  transition: color .2s, border-color .2s, background .2s;
}
.stab:hover { color: var(--ink); background: var(--cream); }
.stab.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--gold); }

/* grade das estatísticas: seções viram cartões organizados */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.4rem; align-items: start; }
.stats-grid > .full { grid-column: 1 / -1; }
.stats-col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.stats-grid .stats-sec {
  margin-top: 0; min-width: 0;
  background: var(--cream); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 1rem 1.1rem;
}
.stats-grid .chart { background: transparent; border: none; padding: 0; }
.sec-scroll { max-height: 320px; overflow-y: auto; overscroll-behavior: contain; padding-right: .35rem; }
.sec-scroll::-webkit-scrollbar { width: 6px; }
.sec-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }

.stats-sec { margin-top: 1.5rem; }
.stats-sec h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; color: var(--ink); margin-bottom: .7rem; display: flex; align-items: center; gap: .4rem; }
/* barra compacta: nome · barra · número na mesma linha */
.bar-row { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(60px, 1fr) 2.2rem; gap: .6rem; align-items: center; padding: .42rem 0; border-bottom: 1px dashed var(--line); }
.bar-row:last-child { border-bottom: none; }
.bar-label { font-size: .88rem; color: var(--ink); min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bar-label small { color: var(--ink-soft); font-size: .74rem; margin-left: .4rem; }
.bar-track { height: 7px; border-radius: 999px; background: var(--cream-2); overflow: hidden; }
.stats-grid .bar-track { background: #fff; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--rose), var(--gold)); }
.bar-val { font-weight: 600; color: var(--rose-deep); font-size: .92rem; white-space: nowrap; text-align: right; }
.stats-empty { padding: 1.4rem; text-align: center; color: var(--ink-soft); background: var(--cream); border: 1px dashed var(--line); border-radius: var(--r-md); }
.timeline { display: flex; flex-direction: column; gap: .55rem; }
.tl-row { display: flex; align-items: center; gap: .7rem; font-size: .88rem; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; }
.tl-row .tl-main { flex: 1; color: var(--ink); }
.tl-row .tl-loc { color: var(--rose-deep); }
.tl-row .tl-when { color: var(--ink-soft); font-size: .78rem; white-space: nowrap; }
@media (max-width: 720px) { .stats-grid { grid-template-columns: 1fr; } .sec-scroll { max-height: 260px; } }
@media (max-width: 620px) { .kpis { grid-template-columns: repeat(2, 1fr); } }

/* ---------- modal: mensagens do WhatsApp ---------- */
.modal-msg { width: min(620px, 94vw); max-height: 92vh; overflow-y: auto; }
.msg-sub {
  font-family: var(--font-display); font-weight: 600; font-size: 1.12rem; color: var(--ink);
  margin: 1.2rem 0 .3rem; padding-top: 1.1rem; border-top: 1px dashed var(--line);
}
.msg-sub:first-of-type { margin-top: .2rem; padding-top: 0; border-top: none; }
#msgHi { min-height: 74px; font-size: .92rem; line-height: 1.5; }
.ph-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.ph {
  font-size: .78rem; font-weight: 600; color: var(--gold-deep);
  background: var(--cream); border: 1px solid var(--line); border-radius: 999px;
  padding: .34rem .7rem; cursor: pointer;
  transition: border .2s, background .2s, transform .2s;
}
.ph small { color: var(--ink-soft); font-weight: 400; margin-left: .25rem; }
.ph:hover { border-color: var(--gold); background: #fff; transform: translateY(-1px); }
#msgText { min-height: 200px; font-size: .92rem; line-height: 1.5; }
.msg-preview {
  background: #E7F8EF;                       /* verzinho de WhatsApp */
  border: 1px solid #bfe6d0; border-radius: var(--r-md);
  padding: .85rem 1rem; font-size: .88rem; line-height: 1.5;
  color: #1f3529; white-space: pre-wrap; word-break: break-word;
  max-height: 240px; overflow-y: auto;
}
.msg-actions { flex-wrap: wrap; gap: .5rem; }

/* miniatura clicável + visualizador ampliado */
.gthumb img { cursor: zoom-in; }
.img-lb {
  position: fixed; inset: 0; z-index: 300;
  display: none; align-items: center; justify-content: center;
  background: rgba(54,32,30,.85); backdrop-filter: blur(8px); padding: 4vh 4vw;
}
.img-lb.show { display: flex; animation: nseldrop .2s ease; }
.img-lb img { max-width: min(92vw, 680px); max-height: 90vh; border-radius: var(--r-md); box-shadow: var(--shadow-lg); object-fit: contain; }
.img-lb-close, .img-lb-nav {
  position: absolute; z-index: 2; color: #fff;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25);
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  font-size: 1.5rem; line-height: 1; transition: background .25s;
}
.img-lb-close:hover, .img-lb-nav:hover { background: rgba(255,255,255,.28); }
.img-lb-close { top: 4vh; right: 4vw; font-size: 1.2rem; }
.img-lb-nav { top: 50%; transform: translateY(-50%); font-size: 2rem; }
.img-lb-nav.prev { left: max(1rem, 2vw); }
.img-lb-nav.next { right: max(1rem, 2vw); }
.img-lb-dots { position: absolute; bottom: 4vh; left: 50%; transform: translateX(-50%); display: flex; gap: .45rem; }
.img-lb-dots span { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.4); }
.img-lb-dots span.on { background: var(--gold-soft); }
@media (max-width: 600px) {
  .img-lb-nav { width: 40px; height: 40px; font-size: 1.6rem; }
  .img-lb-close { top: 1rem; right: 1rem; }
}

/* modal do formulário (nova peça / editar) */
.modal-form { width: min(580px, 94vw); max-height: 92vh; overflow-y: auto; padding: 0; position: relative; }
.modal-form .panel { border: none; box-shadow: none; border-radius: 0; padding: 1.7rem 1.6rem 1.5rem; }
.modal-form #formTitle { padding-right: 2.2rem; }
.modal-x {
  position: absolute; top: .8rem; right: .9rem; z-index: 4;
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--cream-2); color: var(--ink); font-size: 1rem; transition: background .2s, transform .2s;
}
.modal-x:hover { background: var(--blush); transform: rotate(90deg); }

/* combobox (marca) */
.combo { position: relative; }
.combo input { width: 100%; padding-right: 2.4rem; }
.combo-toggle {
  position: absolute; top: 0; right: 0; height: 100%; width: 2.4rem;
  display: grid; place-items: center; color: var(--ink-soft);
  border-radius: 0 var(--r-sm) var(--r-sm) 0; transition: color .2s;
}
.combo-toggle:hover { color: var(--gold-deep); }
.combo.open .combo-toggle svg { transform: rotate(180deg); }
.combo-menu {
  position: absolute; top: calc(100% + 5px); left: 0; right: 0; z-index: 30;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm);
  box-shadow: var(--shadow-md); max-height: 230px; overflow-y: auto;
  padding: .3rem; display: none;
}
.combo.open .combo-menu { display: block; }
.combo-item {
  display: block; width: 100%; text-align: left;
  padding: .55rem .7rem; border-radius: 8px; font-size: .95rem; color: var(--ink);
  transition: background .15s;
}
.combo-item:hover, .combo-item.active { background: var(--blush-soft); color: var(--rose-deep); }
.combo-empty { padding: .7rem; font-size: .85rem; color: var(--ink-soft); text-align: center; }

/* category manager */
.cat-add { display: flex; gap: .5rem; margin-bottom: 1rem; }
.cat-add input { flex: 1; padding: .65rem .85rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--cream); }
.cat-add input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(194,161,91,.18); background: #fff; }
.cat-list { display: flex; flex-direction: column; gap: .45rem; max-height: 46vh; overflow-y: auto; margin-bottom: 1rem; }
.cat-row { display: flex; align-items: center; gap: .7rem; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--cream); }
.cat-row.editing { background: #fff; border-color: var(--gold); }
.cat-name { flex: 1; font-weight: 500; color: var(--ink); }
.cat-count { font-size: .76rem; color: var(--ink-soft); background: var(--cream-2); padding: .1rem .55rem; border-radius: 999px; white-space: nowrap; }
.cat-edit { flex: 1; padding: .45rem .6rem; border: 1px solid var(--gold); border-radius: 8px; background: #fff; }
.cat-edit:focus { outline: none; box-shadow: 0 0 0 3px rgba(194,161,91,.18); }
.cat-acts { display: flex; gap: .35rem; }

/* system checks */
.sys-checks { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.sys-row { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--cream); font-size: .9rem; }
.sys-row .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; font-size: .8rem; }
.sys-row .dot.ok { background: #2e9e58; }
.sys-row .dot.no { background: #c0392b; }
.sys-row .dot.warn { background: var(--gold-deep); }
.sys-row b { color: var(--ink); }
.sys-row small { color: var(--ink-soft); display: block; }
.sys-msg { font-size: .88rem; line-height: 1.55; color: var(--ink); border-radius: var(--r-sm); padding: 0; }
.sys-msg.show { padding: .8rem 1rem; margin-bottom: .4rem; }
.sys-msg.ok { background: rgba(46,158,88,.12); }
.sys-msg.warn { background: rgba(194,161,91,.16); }
.sys-msg.err { background: rgba(192,57,43,.1); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) { .layout { grid-template-columns: 1fr; } .panel.sticky { position: static; } }
@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 1rem; border-right: none; border-bottom: 1px solid var(--line); }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .side .spacer { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  /* modal do formulário vira "bottom sheet" no celular */
  #formModal { padding: 0; align-items: end; }
  #formModal .modal-form { width: 100%; max-width: 100%; max-height: 92vh; border-radius: var(--r-lg) var(--r-lg) 0 0; animation: sheetUp .28s var(--ease); }
  @keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .modal-form .panel { padding: 1.5rem 1.15rem calc(1.3rem + env(safe-area-inset-bottom)); }
  .list-head { align-items: stretch; }
  .list-tools { flex-wrap: wrap; }
  .list-tools .mini-search { flex: 1; }
  .list-tools .mini-search input { width: 100%; }
  .list-tools #btnNova { flex: 1; }
}
@media (max-width: 480px) {
  .row2 { grid-template-columns: 1fr; }
  /* medidas: some o "cm" pra caber o placeholder (o rótulo já diz "em centímetros") */
  .measure input { padding-right: .85rem; }
  .measure .unit { display: none; }
  .prow { grid-template-columns: 54px 1fr; }
  .prow .acts { grid-column: 1 / -1; justify-content: flex-end; }
}
