:root {
  --ink: #101114;
  --ink-soft: #3a3d45;
  --muted: #7a7f8a;
  --line: rgba(16, 17, 20, 0.08);
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.88);
  --bg0: #e8ebf0;
  --bg1: #f4f6f8;
  --bg2: #fbfcfd;
  --accent: #b08a4a;
  --accent-deep: #8d6b35;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(16, 17, 20, 0.12);
  --radius: 22px;
  --radius-sm: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tab-h: calc(64px + var(--safe-bottom));
  --top-h: calc(58px + var(--safe-top));
  --font: "Figtree", "Avenir Next", "Segoe UI", sans-serif;
  --display: "Syne", "Avenir Next", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg1);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

button,
input,
a {
  font: inherit;
  color: inherit;
}

a {
  text-decoration: none;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 10% -10%, #ffffff 0%, transparent 55%),
    radial-gradient(90% 70% at 100% 0%, #dfe5ee 0%, transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg2) 55%, #eef1f5);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.55;
  animation: drift 14s var(--ease) infinite alternate;
}

.orb-a {
  width: 42vw;
  height: 42vw;
  max-width: 340px;
  max-height: 340px;
  left: -8%;
  top: 12%;
  background: #d9c39a;
}

.orb-b {
  width: 48vw;
  height: 48vw;
  max-width: 380px;
  max-height: 380px;
  right: -12%;
  bottom: 8%;
  background: #c9d3e0;
  animation-delay: -4s;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(18px, -22px, 0) scale(1.08); }
}

.gate,
.app {
  position: relative;
  z-index: 1;
}

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding:
    calc(24px + var(--safe-top))
    20px
    calc(24px + var(--safe-bottom));
}

.gate-stage {
  width: min(100%, 400px);
  display: grid;
  gap: 28px;
  animation: rise 0.7s var(--ease) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.gate-brand {
  text-align: center;
}

.mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #17181c, #0b0c0e);
  color: #d6b87a;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.55rem;
  letter-spacing: 0.02em;
  box-shadow: 0 14px 34px rgba(11, 12, 14, 0.28);
}

.mark-sm {
  width: 36px;
  height: 36px;
  margin: 0;
  border-radius: 11px;
  font-size: 0.95rem;
  box-shadow: none;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.brand {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.4rem, 9vw, 3.15rem);
  letter-spacing: 0.08em;
  line-height: 0.95;
}

.tagline,
.lead {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.45;
}

.gate-form,
.pick {
  display: grid;
  gap: 14px;
  padding: 22px;
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
}

.field {
  display: grid;
  gap: 8px;
}

.field > span {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field-row {
  width: 100%;
}

.field input {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-sm);
  padding: 15px 16px;
  font-size: 1.02rem;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.field-row {
  position: relative;
}

.field-row input {
  padding-right: 48px;
}

.field input:focus {
  border-color: rgba(176, 138, 74, 0.55);
  box-shadow: 0 0 0 4px rgba(176, 138, 74, 0.14);
}

.eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 16px;
  min-height: 52px;
  padding: 0 18px;
  font-weight: 650;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease), background 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: linear-gradient(180deg, #1a1b20, #0c0d10);
  color: #f7f3ea;
  box-shadow: 0 12px 28px rgba(12, 13, 16, 0.28);
}

.btn.primary:hover {
  background: linear-gradient(180deg, #22242a, #111214);
}

.btn.ghost {
  background: transparent;
  color: var(--ink-soft);
}

.btn.is-loading {
  pointer-events: none;
  opacity: 0.72;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(247, 243, 234, 0.25);
  border-top-color: #f7f3ea;
  display: none;
  animation: spin 0.7s linear infinite;
}

.btn.is-loading .btn-label {
  opacity: 0.01;
}

.btn.is-loading .btn-spinner {
  display: block;
  position: absolute;
}

.btn.primary {
  position: relative;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 560;
}

.gate-form.is-shake {
  animation: shake 0.42s var(--ease);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}

.pick-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 700;
}

.pick-sub {
  margin: -4px 0 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.pick-list {
  display: grid;
  gap: 8px;
  max-height: min(42dvh, 280px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.pick-item {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  min-height: 56px;
  padding: 12px 14px;
  text-align: left;
  display: grid;
  gap: 2px;
  cursor: pointer;
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease);
}

.pick-item:active {
  transform: scale(0.985);
}

.pick-item strong {
  font-weight: 650;
}

.pick-item small {
  color: var(--muted);
  font-size: 0.82rem;
}

.app {
  height: 100dvh;
  display: grid;
  grid-template-rows: var(--top-h) 1fr var(--tab-h);
  animation: rise 0.55s var(--ease) both;
}

.topbar {
  padding:
    calc(10px + var(--safe-top))
    18px
    10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-id {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.topbar-brand strong {
  display: block;
  font-family: var(--display);
  letter-spacing: 0.08em;
  font-size: 0.95rem;
  line-height: 1.1;
}

.session-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(58vw, 280px);
  min-height: 22px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  background: rgba(16, 17, 20, 0.05);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.2;
}

.session-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2f9e6c;
  box-shadow: 0 0 0 3px rgba(47, 158, 108, 0.16);
  flex: 0 0 auto;
}

.session-label {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
}

.session-name {
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-login {
  overflow: hidden;
}

.page-login .gate {
  min-height: 100dvh;
}

.page-app .lead strong {
  color: var(--ink);
  font-weight: 700;
}

.panel-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.btn-inline {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 16px;
  font-size: 0.92rem;
  white-space: nowrap;
}

.btn-inline.is-loading {
  pointer-events: none;
  opacity: 0.72;
  position: relative;
}

.btn-inline.is-loading .btn-label {
  opacity: 0.01;
}

.btn-inline.is-loading .btn-spinner {
  display: block;
  position: absolute;
}

.toast {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(16, 17, 20, 0.05);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.35;
}

.toast.is-error {
  color: var(--danger);
  background: rgba(180, 35, 24, 0.06);
  border-color: rgba(180, 35, 24, 0.16);
}

.search-shell {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 14px 0 4px;
  padding: 2px 0 10px;
  background: linear-gradient(180deg, rgba(244, 246, 248, 0.92), rgba(244, 246, 248, 0.72));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.search-field {
  display: grid;
  grid-template-columns: 40px 1fr 36px;
  align-items: center;
  min-height: 52px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(16, 17, 20, 0.08);
  box-shadow: 0 10px 28px rgba(16, 17, 20, 0.06);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.search-shell.is-busy .search-field {
  border-color: rgba(176, 138, 74, 0.35);
}

.search-field:focus-within {
  border-color: rgba(176, 138, 74, 0.55);
  box-shadow: 0 0 0 4px rgba(176, 138, 74, 0.12), 0 10px 28px rgba(16, 17, 20, 0.06);
}

.search-ico {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.search-field input {
  appearance: none;
  border: 0;
  outline: none;
  background: transparent;
  width: 100%;
  min-width: 0;
  padding: 14px 0;
  font-size: 1rem;
  color: var(--ink);
}

.search-field input::placeholder {
  color: #9aa0aa;
}

.search-clear {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  cursor: pointer;
}

.search-meta {
  margin: 8px 2px 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.clientes-list {
  margin-top: 8px;
  display: grid;
  gap: 8px;
  padding-bottom: 8px;
}

.cliente-card {
  padding: 12px 14px;
  border-radius: 18px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.72));
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 10px 26px rgba(16, 17, 20, 0.05);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  -webkit-tap-highlight-color: transparent;
}

.cliente-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  min-width: 0;
}

.cliente-code {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(16, 17, 20, 0.06);
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.cliente-cnpj {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.cliente-place {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 38%;
  text-align: right;
  flex: 0 1 auto;
}

.cliente-main {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr) minmax(0, 0.9fr);
  gap: 6px 8px;
  align-items: center;
}

.cliente-name {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cliente-inline {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 1px solid rgba(16, 17, 20, 0.12);
  border-radius: 10px;
  padding: 0 10px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.cliente-inline::placeholder {
  color: rgba(16, 17, 20, 0.38);
  font-weight: 550;
}

.cliente-inline:focus {
  outline: none;
  border-color: rgba(16, 17, 20, 0.38);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(16, 17, 20, 0.06);
}

@media (max-width: 560px) {
  .cliente-main {
    grid-template-columns: 1fr 1fr;
  }
  .cliente-name {
    grid-column: 1 / -1;
    font-size: 0.9rem;
    -webkit-line-clamp: 2;
  }
  .cliente-inline {
    height: 40px;
    font-size: 0.88rem;
  }
  .cliente-place {
    max-width: 42%;
  }
}

.clientes-empty {
  margin-top: 18px;
  min-height: 34dvh;
}

.clientes-empty small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.produtos-list {
  margin-top: 8px;
  display: grid;
  gap: 10px;
  padding-bottom: 8px;
}

.produto-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px 16px 15px;
  border-radius: 20px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.72));
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 12px 30px rgba(16, 17, 20, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.produto-card:active {
  transform: scale(0.985);
}

.produto-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.produto-code {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(16, 17, 20, 0.06);
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.produto-badges {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.produto-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.produto-name {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.produtos-empty {
  margin-top: 18px;
  min-height: 34dvh;
}

.produtos-empty small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

#produtosPanel[data-mode="list"] .produto-view,
#produtosPanel[data-mode="detail"] .produtos-browse,
#produtosPanel .produtos-browse[hidden],
#produtosPanel .produto-view[hidden],
#produtosPanel .produtos-empty[hidden] {
  display: none !important;
}

.produto-view:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: calc(100dvh - 128px);
  height: calc(100dvh - 128px);
}

.produto-view-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 0 0 auto;
}

.btn-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn-back span {
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 500;
}

.produto-view-title {
  display: grid;
  gap: 6px;
}

.produto-view-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.produto-view-heading h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink);
}

.btn-wa {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(37, 211, 102, 0.28);
  background: rgba(37, 211, 102, 0.12);
  color: #1fa855;
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.btn-wa svg {
  width: 22px;
  height: 22px;
}

.btn-wa:active {
  transform: scale(0.94);
}

.btn-wa.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.produto-view-code {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(16, 17, 20, 0.06);
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.produto-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(16, 17, 20, 0.06);
  flex: 0 0 auto;
}

.produto-tab {
  min-height: 40px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.produto-tab.is-on {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(16, 17, 20, 0.08);
}

.produto-tab:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.produto-media {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #ebe9e4;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.produto-pane {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1;
}

.produto-pane.is-on {
  display: flex;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Lâmina e ficha: largura total + scroll (não encolher A4 na altura) */
.produto-pane[data-pane="lamina"].is-on,
.produto-pane[data-pane="ficha"].is-on {
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  background: #ebe9e4;
}

.produto-pane[data-pane="lamina"] img,
.produto-pane[data-pane="ficha"] img {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  min-height: 0;
  max-height: none;
  margin: 0;
  object-fit: unset;
  background: #fff;
}

.produto-pane[data-pane="ficha"] img {
  box-shadow: 0 10px 30px rgba(16, 17, 20, 0.08);
}

.ficha-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
}

.ficha-meta {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--muted);
  line-height: 1.35;
}

.ficha-download {
  flex: 0 0 auto;
  text-decoration: none;
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.86rem;
}

.produto-missing {
  padding: 28px 18px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  margin: auto;
}

.produto-missing p {
  margin: 0;
}

.produto-pane[data-pane="estoque"].is-on {
  display: block;
  align-items: stretch;
  justify-content: flex-start;
  padding: 14px;
  overflow: auto;
}

.estoque-form {
  display: grid;
  gap: 16px;
  width: 100%;
}

.estoque-field {
  display: grid;
  gap: 8px;
}

.estoque-field > span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.estoque-field input {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  padding: 0 14px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.estoque-field input:focus {
  outline: none;
  border-color: rgba(141, 107, 53, 0.45);
  box-shadow: 0 0 0 3px rgba(141, 107, 53, 0.12);
}

.estoque-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 10px;
}

.estoque-fieldset legend {
  padding: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.estoque-radios,
.estoque-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.estoque-chip {
  display: inline-flex;
  align-items: center;
  gap: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.estoque-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.estoque-chip span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 650;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}

.estoque-chip input:checked + span {
  background: rgba(16, 17, 20, 0.9);
  border-color: rgba(16, 17, 20, 0.9);
  color: #fff;
}

.estoque-fixed {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 600;
}

.estoque-fixed strong {
  color: var(--ink-soft);
  font-weight: 750;
}

.estoque-actions {
  display: flex;
  gap: 10px;
}

.estoque-result {
  margin: 0;
  padding: 14px;
  border-radius: 14px;
  background: rgba(16, 17, 20, 0.04);
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ink-soft);
  max-height: 42dvh;
  overflow: auto;
}

.import-progress {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
}

.import-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(16, 17, 20, 0.08);
  overflow: hidden;
}

.import-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8d6b35, #d6b87a);
  transition: width 0.35s var(--ease);
}

.import-meta {
  margin: 10px 0 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.import-current {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 520px) {
  .panel-head-row {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-inline {
    width: 100%;
  }
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  -webkit-tap-highlight-color: transparent;
}

.stage {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px 18px 18px;
  scroll-behavior: smooth;
}

.panel {
  display: none;
  animation: rise 0.45s var(--ease) both;
}

.panel.is-on {
  display: block;
}

.panel-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.7rem, 6vw, 2.1rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.quick-grid {
  margin-top: 22px;
  display: grid;
  gap: 10px;
}

.quick {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 14px 16px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 10px 28px rgba(16, 17, 20, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.quick:active {
  transform: scale(0.985);
}

.quick-ico {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #17181c, #0b0c0e);
  color: #d6b87a;
}

.quick-ico svg {
  width: 22px;
  height: 22px;
}

.quick-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.quick-text em {
  font-style: normal;
  font-weight: 700;
  font-size: 1.05rem;
}

.quick-text small {
  color: var(--muted);
  font-size: 0.86rem;
}

.chev {
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
}

.placeholder {
  margin-top: 28px;
  min-height: 42dvh;
  border-radius: 24px;
  border: 1px dashed rgba(16, 17, 20, 0.14);
  background: rgba(255, 255, 255, 0.35);
  display: grid;
  place-content: center;
  gap: 12px;
  text-align: center;
  color: var(--muted);
  position: relative;
  overflow: hidden;
}

.placeholder[hidden] {
  display: none !important;
}

.placeholder-orb {
  width: 72px;
  height: 72px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #e7d3a8, #b08a4a 55%, transparent 70%);
  opacity: 0.55;
  filter: blur(1px);
  animation: drift 8s var(--ease) infinite alternate;
}

.tabbar {
  padding: 8px 10px calc(8px + var(--safe-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: rgba(251, 252, 253, 0.82);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
}

.tab {
  min-height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  transition: color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.tab-ico {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
}

.tab-ico svg {
  width: 22px;
  height: 22px;
}

.tab.is-on {
  color: var(--ink);
  background: rgba(16, 17, 20, 0.05);
}

.tab:active {
  transform: scale(0.96);
}

@media (min-width: 900px) {
  body {
    overflow: auto;
  }

  .app {
    width: min(1080px, calc(100% - 48px));
    margin: 24px auto;
    height: calc(100dvh - 48px);
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: var(--shadow);
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    grid-template-columns: 240px 1fr;
    grid-template-rows: var(--top-h) 1fr;
  }

  .topbar {
    grid-column: 1 / -1;
    border-bottom: 1px solid var(--line);
  }

  .tabbar {
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 6px;
    padding: 16px 12px;
    border-top: 0;
    border-right: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.28);
  }

  .tab {
    grid-template-columns: 28px 1fr;
    justify-items: start;
    padding: 0 14px;
    min-height: 48px;
    font-size: 0.92rem;
    gap: 10px;
  }

  .stage {
    grid-column: 2;
    grid-row: 2;
    padding: 28px 36px 36px;
  }

  .quick-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .quick {
    grid-template-columns: 1fr;
    align-content: start;
    min-height: 150px;
    padding: 20px;
  }

  .chev {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
