/* ============================================================
   Almoxarife — Mock (mobile-first)
   ============================================================ */
:root {
  --bg: #0b1220;
  --bg-soft: #101a2e;
  --card: #16233c;
  --card-2: #1b2b48;
  --line: #263851;
  --txt: #e8eef7;
  --mut: #93a4bd;
  --acc: #f59e0b;
  --acc-2: #fbbf24;
  --grn: #34d399;
  --blu: #60a5fa;
  --ylw: #fbbf24;
  --red: #f87171;
  --rad: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px -12px rgba(0,0,0,.5);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  background: linear-gradient(180deg, #0b1220 0%, #0e1728 100%);
  color: var(--txt);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
a { color: var(--acc); text-decoration: none; }
p { margin: .3rem 0; }
.mut { color: var(--mut); }
.sm { font-size: 13px; }
.xs { font-size: 12px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt { margin-top: .8rem; }
.mb { margin-bottom: .8rem; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.app-main { flex: 1; padding: calc(env(safe-area-inset-top) + 12px) 14px calc(env(safe-area-inset-bottom) + 92px); max-width: 860px; width: 100%; margin: 0 auto; }
.app-main.wide { max-width: 1120px; }

/* headers por tela */
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.page-head h1 { font-size: 22px; margin: 0; flex: 1; }
.app-bar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
  background: rgba(11, 18, 32, .86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.app-bar .title { font-weight: 700; font-size: 17px; flex: 1; }
.app-bar .sub { font-size: 12px; color: var(--mut); }

/* ---------- sidebar (desktop ≥1024) ---------- */
.sidebar {
  display: none;
  position: fixed; left: 0; top: 0; bottom: 0; width: 228px; padding: 20px 12px;
  background: var(--bg-soft); border-right: 1px solid var(--line); z-index: 50;
  flex-direction: column; gap: 4px; overflow-y: auto;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.sidebar .brand .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--acc); color: #1a1204; display: grid; place-items: center; font-weight: 800; }
.sidebar .brand b { font-size: 16px; }
.sidebar .brand .sub { font-size: 11px; color: var(--mut); }
.sidebar .section-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--mut); padding: 12px 8px 4px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--txt); font-size: 14.5px; }
.side-link:hover { background: var(--card); }
.side-link.active { background: var(--card-2); box-shadow: inset 3px 0 0 var(--acc); font-weight: 600; }
.side-link .ic { width: 20px; text-align: center; }
.side-link .bdg { margin-left: auto; }
@media (min-width: 1024px) {
  .sidebar { display: flex; }
  body.has-sidebar > #app { margin-left: 228px; }
  body.has-sidebar .app-main { padding-bottom: calc(env(safe-area-inset-bottom) + 40px); }
  .app-shell.with-sidebar { padding-left: 228px; }
  .app-main { padding-bottom: calc(env(safe-area-inset-bottom) + 40px); }
}

/* telas pequenas em landscape / tablets estreitos: sidebar nunca come a tela */
@media (max-width: 1023px) {
  .sidebar { display: none !important; }
}

/* ---------- bottom nav (mobile) ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px);
  background: rgba(11, 18, 32, .92); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--mut); padding: 6px 8px; border-radius: 10px; min-width: 56px; position: relative; }
.bottom-nav a.active { color: var(--acc); }
.bottom-nav a .ic { font-size: 20px; }
.bottom-nav a .bdg { position: absolute; top: 0; right: 8px; }
@media (min-width: 1024px) { .bottom-nav { display: none; } }

/* ---------- cards & grids ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--rad); padding: 14px; box-shadow: var(--shadow); }
.card.tight { padding: 10px 12px; }
.card h2, .card h3 { display: flex; align-items: center; gap: 8px; }
.card h2 .right, .card h3 .right { margin-left: auto; font-weight: 500; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.grid4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .grid4 { grid-template-columns: repeat(4, 1fr); } }
.stat { display: block; }
.stat .n { font-size: 26px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.stat .l { font-size: 12px; color: var(--mut); margin-top: 2px; }
.stat .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* ---------- badges/chips ---------- */
.bdg { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; vertical-align: middle; }
.bdg.g { background: rgba(52,211,153,.14); color: var(--grn); border: 1px solid rgba(52,211,153,.35); }
.bdg.b { background: rgba(96,165,250,.14); color: var(--blu); border: 1px solid rgba(96,165,250,.35); }
.bdg.y { background: rgba(251,191,36,.13); color: var(--ylw); border: 1px solid rgba(251,191,36,.35); }
.bdg.r { background: rgba(248,113,113,.13); color: var(--red); border: 1px solid rgba(248,113,113,.35); }
.bdg.n { background: #24324c; color: var(--mut); border: 1px solid var(--line); }
.bdg .k { font-size: 10px; opacity: .8; }

.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; -ms-overflow-style: none; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--mut); font-size: 13.5px; font-weight: 600; min-height: 40px;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip.active { background: var(--acc); border-color: var(--acc); color: #1a1204; }
.chip .cnt { background: rgba(0,0,0,.25); border-radius: 999px; padding: 0 7px; font-size: 11.5px; }
.chip:not(.active) .cnt { background: var(--card-2); color: var(--txt); }

/* ---------- listas ---------- */
.row-item {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--rad);
  margin-bottom: 10px; width: 100%; text-align: left; color: var(--txt);
}
button.row-item { cursor: pointer; }
button.row-item:active { transform: scale(.99); }
.row-item .ic-box { width: 46px; height: 46px; border-radius: 12px; background: var(--card-2); display: grid; place-items: center; font-size: 22px; flex: none; }
.row-item .txt { flex: 1; min-width: 0; }
.row-item .txt b { display: block; }
.row-item .txt .sub { color: var(--mut); font-size: 12.5px; }
.row-item .right { text-align: right; }
.rows > .row-item:last-child { margin-bottom: 0; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--txt); font-size: 15px; font-weight: 650; text-align: center;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--acc); border-color: var(--acc); color: #1a1204; }
.btn.green { background: rgba(52,211,153,.16); border-color: rgba(52,211,153,.4); color: var(--grn); }
.btn.red { background: rgba(248,113,113,.14); border-color: rgba(248,113,113,.4); color: var(--red); }
.btn.ghost { background: transparent; }
.btn.block { display: flex; width: 100%; }
.btn.sm-btn { min-height: 38px; padding: 6px 12px; font-size: 13.5px; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; min-width: 130px; }

/* ---------- formulários ---------- */
.field { margin-bottom: 12px; }
.field > label { display: block; font-size: 13px; font-weight: 600; color: var(--mut); margin-bottom: 6px; }
.field > label .req { color: var(--red); }
.inp {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg-soft); font-size: 16px;
}
.inp:focus { outline: 2px solid var(--acc); outline-offset: 1px; border-color: transparent; }
textarea.inp { min-height: 74px; resize: vertical; }
select.inp { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2393a4bd' stroke-width='2' fill='none'/%3E%3C/svg%3E"), var(--bg-soft); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.seg { display: flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; min-height: 40px; border: 0; background: transparent; color: var(--mut); border-radius: 9px; font-weight: 650; font-size: 14px; }
.seg button.active { background: var(--card-2); color: var(--txt); box-shadow: var(--shadow); }
.seg button.active.g { background: rgba(52,211,153,.2); color: var(--grn); }
.seg button.active.y { background: rgba(251,191,36,.2); color: var(--ylw); }
.seg button.active.r { background: rgba(248,113,113,.2); color: var(--red); }
.search-input { position: relative; }
.search-input .inp { padding-left: 40px; }
.search-input::before { content: "🔍"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 15px; opacity: .7; }

/* ---------- fotos ---------- */
.photo-slots { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-slot {
  width: 100%; max-width: 220px; aspect-ratio: 4/3; border: 2px dashed var(--line);
  border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--mut); font-size: 12.5px; background: var(--bg-soft); position: relative; overflow: hidden;
}
.photo-slot.filled { border-style: solid; border-color: rgba(52,211,153,.5); padding: 0; }
.photo-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-slot .fill-btns { position: absolute; left: 0; right: 0; bottom: 0; display: flex; }
.photo-slot .fill-btns button { flex: 1; background: rgba(11,18,32,.85); color: #fff; border: 0; padding: 8px 4px; font-size: 12px; font-weight: 600; }
.photo-slot .ok-tag { position: absolute; top: 6px; left: 6px; z-index: 2; }
.thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); cursor: zoom-in; }
.thumb-list { display: flex; gap: 6px; flex-wrap: wrap; }
.photo-slot.big { max-width: none; width: 100%; }

/* ---------- modais / toasts / viewer ---------- */
.overlay-back { position: fixed; inset: 0; background: rgba(4,8,16,.66); backdrop-filter: blur(3px); z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 760px) { .overlay-back { align-items: center; } }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: 18px 18px 0 0; width: 100%; max-width: 640px; max-height: 88dvh; overflow-y: auto; padding: 18px 16px calc(env(safe-area-inset-bottom) + 18px); animation: up .18s ease-out; }
@media (min-width: 760px) { .modal { border-radius: 18px; padding-bottom: 18px; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.modal.wide { max-width: 780px; }
.modal h3 { font-size: 18px; margin-bottom: 12px; }
.modal .acts { display: flex; gap: 10px; margin-top: 16px; }
.modal .acts .btn { flex: 1; }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 84px); z-index: 120; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 480px); }
@media (min-width: 1024px) { .toasts { bottom: 24px; } }
.toast { background: #1f2c47; border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; font-size: 14px; box-shadow: var(--shadow); animation: up .2s ease-out; }
.toast.ok { border-color: rgba(52,211,153,.5); }
.toast.err { border-color: rgba(248,113,113,.5); }
.viewer { position: fixed; inset: 0; background: rgba(4,8,16,.94); z-index: 130; display: grid; place-items: center; padding: 20px; }
.viewer img { max-width: 100%; max-height: 90dvh; border-radius: 12px; }
.viewer .close { position: absolute; top: 14px; right: 14px; }

/* ---------- stepper (wizards) ---------- */
.stepper { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.stepper .st { display: flex; align-items: center; gap: 6px; }
.stepper .b { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; background: var(--card-2); color: var(--mut); border: 1px solid var(--line); flex: none; }
.stepper .b.active { background: var(--acc); color: #1a1204; border-color: var(--acc); }
.stepper .b.done { background: rgba(52,211,153,.2); color: var(--grn); border-color: rgba(52,211,153,.4); }
.stepper .ln { height: 2px; flex: 1; background: var(--line); border-radius: 2px; }
.stepper .lbl { font-size: 12px; color: var(--mut); }
@media (max-width: 380px) { .stepper .lbl { display: none; } }

/* ---------- timeline ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.tl-item { position: relative; padding: 8px 0; }
.tl-item::before { content: ""; position: absolute; left: -19px; top: 14px; width: 12px; height: 12px; border-radius: 50%; background: var(--acc); border: 3px solid var(--bg); }
.tl-item.neutral::before { background: var(--mut); }
.tl-item.red::before { background: var(--red); }
.tl-item .when { font-size: 11.5px; color: var(--mut); }
.tl-item .what { font-size: 14px; margin: 2px 0; }
.tl-item .who { font-size: 12px; color: var(--mut); }

/* ---------- tabelas ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; color: var(--mut); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---------- filtros/pesquisa & misc ---------- */
.filter-bar { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--mut); padding: 26px 10px; font-size: 14px; }
.empty .big { font-size: 34px; margin-bottom: 8px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv b { text-align: right; }
.count-pill { font-size: 11px; background: var(--card-2); border: 1px solid var(--line); color: var(--mut); border-radius: 999px; padding: 1px 8px; font-weight: 700; }
.pend-tile { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.pend-tile.red { border-color: rgba(248,113,113,.45); }
.pend-tile.ylw { border-color: rgba(251,191,36,.4); }
.signature-box { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--bg-soft); border: 1px dashed var(--line); border-radius: 12px; }
.signature-box img { height: 54px; background: #fff; border-radius: 6px; padding: 2px; }
.hero-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .hero-actions { grid-template-columns: repeat(4, 1fr); } }
.act-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; color: var(--txt); min-height: 84px; text-align: left; }
.act-btn .ic { font-size: 22px; }
.act-btn b { font-size: 14px; }
.act-btn .mut { font-size: 11.5px; }
.act-btn.primary { background: linear-gradient(135deg, #b45309, #d97706); border-color: #d97706; color: #fff; }
.act-btn.primary .mut { color: rgba(255,255,255,.75); }
.tabs-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; -ms-overflow-style: none; scrollbar-width: none; }
.tabs-bar::-webkit-scrollbar { display: none; }
.tab-btn { flex: none; padding: 9px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--mut); font-weight: 600; font-size: 13.5px; display: inline-flex; gap: 6px; align-items: center; min-height: 40px; }
.tab-btn.active { background: var(--acc); border-color: var(--acc); color: #1a1204; }
.pill-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.qty-editor { display: flex; align-items: center; gap: 8px; }
.qty-editor button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); font-size: 18px; font-weight: 700; }
.qty-editor .n { min-width: 44px; text-align: center; font-weight: 800; font-size: 17px; }
.list-check-row { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); background: var(--card); border-radius: 12px; margin-bottom: 8px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 17px; background: var(--card-2); border: 1px solid var(--line); flex: none; }
.progress-bar { height: 8px; border-radius: 6px; background: var(--bg-soft); border: 1px solid var(--line); overflow: hidden; margin-top: 6px; }
.progress-bar i { display: block; height: 100%; background: var(--acc); border-radius: 6px; }
.note-box { background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.35); color: #fcd34d; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; }
.danger-box { background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.4); color: #fca5a5; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; }
.ok-box { background: rgba(52,211,153,.08); border: 1px solid rgba(52,211,153,.4); color: #6ee7b7; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.login-list .row-item { margin-bottom: 10px; }
.login-list .row-item .role-tag { font-size: 11px; }
.app-main .back-btn { margin-bottom: 10px; }
.sheet-list { display: flex; flex-direction: column; }

/* ---------- acessibilidade ---------- */
:focus-visible {
  outline: 3px solid var(--acc);
  outline-offset: 2px;
  border-radius: 6px;
}
.inp:focus-visible { outline-offset: 0; }
.bottom-nav a:focus-visible { outline-offset: -3px; border-radius: 12px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media print { .bottom-nav, .sidebar, .app-bar .btn { display: none; } }