:root {
  --g9:#1d372b;
  --g7:#34584a;
  --sage:#8ea693;
  --sl:#e8eee7;
  --bg:#f8f8f4;
  --card:#fff;
  --ink:#1c2420;
  --mut:#6a746d;
  --line:#e5e8e0;
  --r:16px;
  --sh:0 1px 2px rgba(29,55,43,.05),0 6px 18px rgba(29,55,43,.06);
}

* {
  box-sizing:border-box;
  margin:0;
}

body {
  font:15px/1.5 Manrope,system-ui,-apple-system,"Segoe UI",sans-serif;
  background:var(--bg);
  color:var(--ink);
  -webkit-font-smoothing:antialiased;
  overflow-wrap:anywhere;
}

button,input,select,textarea {
  font:inherit;
  color:inherit;
}

:focus-visible {
  outline:2px solid var(--g7);
  outline-offset:2px;
}

.app {
  display:grid;
  grid-template-columns:250px minmax(0,1fr);
  min-height:100vh;
}

aside {
  background:var(--g9);
  color:#dfe8e1;
  padding:26px 16px;
  position:sticky;
  top:0;
  height:100vh;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.logo {
  display:flex;
  align-items:center;
  gap:10px;
  padding:0 10px 22px;
  font-weight:800;
  font-size:18px;
  color:#fff;
  letter-spacing:-.02em;
}

.logo i {
  width:30px;
  height:30px;
  border-radius:10px 10px 10px 2px;
  background:var(--sage);
  display:block;
}

.nav a {
  display:flex;
  align-items:center;
  gap:12px;
  padding:11px 12px;
  border-radius:12px;
  color:#c4d2c8;
  text-decoration:none;
  font-weight:600;
  transition:.2s;
}

.nav a:hover {
  background:rgba(255,255,255,.07);
}

.nav a.on {
  background:#fff;
  color:var(--g9);
}

.side-foot {
  margin-top:auto;
  padding:10px;
  font-size:12px;
  color:#8fa596;
}

main {
  padding:34px clamp(16px,3.5vw,44px) 60px;
  max-width:1180px;
  width:100%;
}

h1 {
  font-size:26px;
  letter-spacing:-.02em;
  font-weight:800;
}

h2 {
  font-size:17px;
  font-weight:700;
  letter-spacing:-.01em;
}

.top {
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:14px;
  flex-wrap:wrap;
  margin-bottom:24px;
}

.sub {
  color:var(--mut);
  font-size:14px;
  margin-top:2px;
}

.card {
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--r);
  box-shadow:var(--sh);
  padding:20px;
}

.grid {
  display:grid;
  gap:16px;
}

.stats {
  grid-template-columns:repeat(auto-fit,minmax(170px,1fr));
  margin-bottom:16px;
}

.stat {
  padding:18px;
  border-radius:14px;
}

.stat b {
  display:block;
  font-size:28px;
  font-weight:800;
  letter-spacing:-.02em;
  margin-top:4px;
}

.stat span {
  color:var(--mut);
  font-size:13px;
  font-weight:600;
}

.stat.big {
  background:var(--g9);
  color:#fff;
  border-color:var(--g9);
}

.stat.big span {
  color:#b9cbbf;
}

.two {
  grid-template-columns:1.5fr 1fr;
}

.btn {
  display:inline-flex;
  align-items:center;
  gap:8px;
  white-space:nowrap;
  color:var(--ink);
  border:1px solid var(--line);
  background:#fff;
  padding:10px 16px;
  border-radius:12px;
  cursor:pointer;
  font-weight:600;
  transition:.2s;
  text-decoration:none;
}

.btn:hover {
  border-color:var(--sage);
  background:var(--sl);
}

.btn.pri {
  background:var(--g7);
  border-color:var(--g7);
  color:#fff;
}

.btn.pri:hover {
  background:var(--g9);
}

.btn.wa {
  background:#25a65b;
  border-color:#25a65b;
  color:#fff;
}

.btn.wa:hover {
  background:#1e8f4d;
}

.btn.sm {
  padding:7px 10px;
  border-radius:10px;
  font-size:13px;
}

.btn.ghost {
  border-color:transparent;
  background:transparent;
  color:var(--mut);
}

.btn.dng:hover {
  background:#f5e3e0;
  border-color:#e3b9b3;
  color:#a4473d;
}

input,select,textarea {
  width:100%;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:11px;
  background:#fff;
}

input:focus,select:focus,textarea:focus {
  border-color:var(--sage);
  outline:none;
  box-shadow:0 0 0 3px var(--sl);
}

label {
  font-size:13px;
  font-weight:600;
  color:var(--mut);
  display:block;
  margin-bottom:5px;
}

.f {
  display:grid;
  gap:14px;
  grid-template-columns:repeat(auto-fit,minmax(200px,1fr));
}

.f .w {
  grid-column:1/-1;
}

.badge {
  font-size:12px;
  font-weight:700;
  padding:4px 10px;
  border-radius:99px;
  display:inline-block;
}

.s-Pendente {
  background:#f6efdc;
  color:#8a5f12;
}

.s-Aprovado {
  background:#dff0e5;
  color:#25694a;
}

.s-Recusado {
  background:#f5e3e0;
  color:#a4473d;
}

.s-Cancelado {
  background:#ececea;
  color:#5f6661;
}

.row {
  display:flex;
  align-items:center;
  gap:14px;
  padding:14px 4px;
  border-bottom:1px solid var(--line);
  flex-wrap:wrap;
}

.row:last-child {
  border:0;
}

.row .g {
  flex:1;
  min-width:150px;
}

.row small {
  color:var(--mut);
  display:block;
}

.row select {
  width:auto;
  padding:5px 8px;
  font-size:13px;
  font-weight:700;
  border-radius:99px;
}

.chips {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:14px;
}

.chip {
  border:1px solid var(--line);
  background:#fff;
  border-radius:99px;
  padding:6px 14px;
  cursor:pointer;
  font-weight:600;
  font-size:13px;
  color:var(--mut);
}

.chip.on {
  background:var(--g7);
  color:#fff;
  border-color:var(--g7);
}

.pgrid {
  grid-template-columns:repeat(auto-fill,minmax(210px,1fr));
}

.prod {
  padding:0;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.ph {
  height:130px;
  background:var(--sl);
  display:grid;
  place-items:center;
  font-size:38px;
  font-weight:800;
  color:var(--sage);
  background-size:cover;
  background-position:center;
}

.ph.zm {
  cursor:zoom-in;
  -webkit-touch-callout:none;
  -webkit-user-select:none;
  user-select:none;
  touch-action:pan-y;
}

.zoom {
  position:fixed;
  z-index:200;
  pointer-events:none;
  background:#fff;
  border-radius:var(--r);
  overflow:hidden;
  box-shadow:0 18px 50px rgba(29,55,43,.28),0 2px 6px rgba(29,55,43,.12);
  opacity:0;
  transform:scale(.88);
  transition:opacity .16s ease,transform .16s ease;
}

.zoom.on {
  opacity:1;
  transform:scale(1);
}

.zoom img {
  display:block;
  width:100%;
  max-height:min(62vh,520px);
  object-fit:contain;
  background:#fff;
}

.zoom .zc {
  display:flex;
  flex-direction:column;
  gap:2px;
  padding:12px 16px 14px;
  border-top:1px solid var(--line);
}

.zoom .zc small {
  color:var(--mut);
}

.zoom .zc span {
  font-weight:800;
  color:var(--g7);
}

.per {
  display:none;
  margin-left:6px;
  padding:1px 9px;
  border-radius:99px;
  background:var(--sl);
  color:var(--g7);
  font-size:12px;
  font-weight:700;
}

.per.on {
  display:inline-block;
}

.prod .in {
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:4px;
  flex:1;
}

.prod.off {
  opacity:.55;
}

.price {
  font-weight:800;
  color:var(--g7);
}

.bars rect {
  transition:.3s;
}

.donut {
  width:130px;
  height:130px;
  border-radius:50%;
  display:grid;
  place-items:center;
  margin:0 auto 14px;
}

.donut div {
  width:88px;
  height:88px;
  background:#fff;
  border-radius:50%;
  display:grid;
  place-items:center;
  font-weight:800;
  font-size:22px;
}

.leg {
  display:flex;
  justify-content:space-between;
  font-size:13px;
  padding:3px 0;
}

.leg i {
  display:inline-block;
  width:9px;
  height:9px;
  border-radius:50%;
  margin-right:8px;
}

.items .it {
  display:grid;
  grid-template-columns:1fr 80px 120px 100px 36px;
  gap:10px;
  align-items:center;
  padding:10px 0;
  border-bottom:1px solid var(--line);
}

.items .it:last-child {
  border:0;
}

.lb {
  font-size:11px;
  margin:0;
  font-weight:600;
}

.lb input {
  margin-top:2px;
  font-weight:400;
  color:var(--ink);
}

.tot {
  display:flex;
  justify-content:space-between;
  padding:6px 0;
  color:var(--mut);
}

.tot.fin {
  color:var(--g9);
  font-size:22px;
  font-weight:800;
  border-top:1px solid var(--line);
  margin-top:6px;
  padding-top:12px;
}

#modal {
  position:fixed;
  inset:0;
  background:rgba(20,32,26,.5);
  display:none;
  align-items:flex-start;
  justify-content:center;
  padding:4vh 14px;
  overflow:auto;
  z-index:50;
  backdrop-filter:blur(2px);
}

#modal.open {
  display:flex;
}

.box {
  background:#fff;
  border-radius:20px;
  width:100%;
  max-width:640px;
  padding:24px;
  animation:pop .2s ease-out;
}

.box.wide {
  max-width:800px;
}

@keyframes pop {
  from {
    opacity:0;
    transform:translateY(10px);
  }
}

.sheet {
  padding:8px 6px;
  color:#222;
  -webkit-print-color-adjust:exact;
  print-color-adjust:exact;
}

.sheet .hd {
  display:flex;
  justify-content:space-between;
  border-bottom:3px solid var(--g7);
  padding-bottom:16px;
  margin-bottom:18px;
}

.sheet .brand {
  font-size:22px;
  font-weight:800;
  color:var(--g9);
}

.sheet table {
  width:100%;
  border-collapse:collapse;
  margin:14px 0;
}

.sheet th {
  background:var(--sl);
  text-align:left;
  padding:9px;
  font-size:13px;
}

.sheet td {
  padding:9px;
  border-bottom:1px solid var(--line);
  font-size:14px;
}

.sheet .r {
  text-align:right;
}

.cl {
  background:var(--bg);
  border-radius:12px;
  padding:12px 14px;
  font-size:14px;
}

#toast {
  position:fixed;
  bottom:90px;
  left:50%;
  transform:translateX(-50%);
  background:var(--g9);
  color:#fff;
  padding:10px 18px;
  border-radius:12px;
  opacity:0;
  transition:.3s;
  pointer-events:none;
  z-index:99;
}

#toast.on {
  opacity:1;
}

.empty {
  text-align:center;
  color:var(--mut);
  padding:36px 10px;
}

.bnav {
  display:none;
}

@media(max-width:860px) {
  .app {
    display:block;
  }
  aside {
    display:none;
  }
  main {
    padding:22px 14px 100px;
  }
  .two {
    grid-template-columns:1fr;
  }
  .bnav {
    display:flex;
    position:fixed;
    bottom:0;
    left:0;
    right:0;
    background:#fff;
    border-top:1px solid var(--line);
    z-index:40;
    padding:6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bnav a {
    flex:1;
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:2px;
    font-size:11px;
    font-weight:600;
    color:var(--mut);
    text-decoration:none;
    padding:6px 0;
    border-radius:12px;
  }
  .bnav a.on {
    color:var(--g9);
    background:var(--sl);
  }
  .items .it {
    grid-template-columns:1fr 1fr;
  }
  .items .it>:first-child {
    grid-column:1/-1;
    font-weight:700;
  }
  h1 {
    font-size:22px;
  }
  input,select,textarea {
    font-size:16px;
  }
  .btn {
    min-height:44px;
  }
  .btn.sm {
    min-height:40px;
    min-width:40px;
    padding:8px 12px;
    justify-content:center;
  }
  .chip {
    min-height:40px;
    padding:8px 16px;
  }
  .row select {
    min-height:40px;
    padding:8px 12px;
    font-size:14px;
  }
  .row>span:not(.badge) {
    display:flex;
    gap:8px;
    flex-wrap:wrap;
  }
  .items .it .btn.sm.ghost {
    justify-self:end;
  }
}

@media print {
  .app,.bnav,#toast,.noprint {
    display:none!important;
  }
  body {
    background:#fff;
  }
  #modal {
    position:static;
    display:block;
    background:none;
    padding:0;
    backdrop-filter:none;
    overflow:visible;
  }
  .box {
    box-shadow:none;
    max-width:none;
    padding:0;
    animation:none;
  }
  @page {
    margin:14mm;
  }
}

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

/* ---------- logo e sidebar ---------- */
.side-foot .btn { margin-top: 10px; background: rgba(255,255,255,.08); color: #dfe8e1; border-color: transparent; }
.side-foot .btn:hover { background: rgba(255,255,255,.18); }
#whoami { font-weight: 700; color: #dfe8e1; margin-bottom: 2px; }

/* ---------- login e cadastro ---------- */
body.locked .app, body.locked .bnav { display: none; }
#auth { position: fixed; inset: 0; z-index: 200; display: none; overflow: auto; padding: 20px; color: #ffe9e9;
  background: radial-gradient(1200px 600px at 50% -10%, #5a0b16 0%, #240509 45%, #0e0205 100%); }
#auth.open { display: flex; }
.a-card { margin: auto; width: 100%; max-width: 400px; padding: 26px; border-radius: 22px;
  background: rgba(30,6,12,.72); border: 1px solid rgba(255,110,120,.25); backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(0,0,0,.5); }
#auth h1 { text-align: center; font-size: 24px; }
.a-sub { color: #e9a7ad; text-align: center; margin: 4px 0 18px; font-size: 14px; }
#auth label { color: #f3b9bd; }
#auth input:not([type=checkbox]) { background: rgba(0,0,0,.4); border: 1px solid rgba(255,120,130,.28); color: #fff;
  border-radius: 12px; padding: 12px 14px; font-size: 16px; margin-bottom: 12px; }
#auth input::placeholder { color: rgba(255,200,205,.45); }
#auth input:not([type=checkbox]):focus { border-color: #ff6b78; box-shadow: 0 0 0 3px rgba(255,80,95,.2); }
.a-pw { position: relative; }
.a-pw input { padding-right: 46px; }
.a-eye { position: absolute; right: 6px; top: 3px; background: none; border: 0; color: #f3b9bd; cursor: pointer; padding: 10px; }
.a-keep { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 0 0 14px; }
.a-keep input { width: auto; margin: 0; }
.a-auth { border: 1px dashed rgba(255,120,130,.4); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.a-auth small { display: block; color: #e9a7ad; margin-bottom: 8px; }
.a-btn { width: 100%; padding: 13px; border: 0; border-radius: 12px; cursor: pointer; color: #fff; font-weight: 700; font-size: 16px;
  background: linear-gradient(135deg, #e0303f, #9b1424); box-shadow: 0 6px 22px rgba(224,48,63,.35); }
.a-btn:hover { filter: brightness(1.1); }
.a-btn:disabled { opacity: .6; cursor: wait; }
.a-err, .a-ok { padding: 10px 12px; border-radius: 12px; font-size: 14px; margin-bottom: 12px; }
.a-err { background: rgba(255,70,80,.14); border: 1px solid rgba(255,90,100,.4); color: #ffd2d5; }
.a-ok { background: rgba(80,200,120,.14); border: 1px solid rgba(80,200,120,.4); color: #d4f5df; }
.a-link { text-align: center; margin-top: 14px; }
.a-linkbtn { background: none; border: 0; color: #ff9aa2; cursor: pointer; font-size: 14px; text-decoration: underline; }
@media print { #auth { display: none !important; } }

.sync {
  font-size:12px;
  color:var(--mut);
}

.sync.busy::before,
.sync.ok::before,
.sync.err::before {
  content:"";
  display:inline-block;
  width:8px;
  height:8px;
  border-radius:50%;
  margin-right:6px;
  background:#5a9a6b;
}

.sync.busy::before {
  background:#d9a441;
}

.sync.err {
  color:#a4473d;
}

.sync.err::before {
  background:#a4473d;
}