:root {
  --bg: #000;
  --surface: #121212;
  --surface-2: #1b1b1b;
  --line: #2a2a2a;
  --text: #f2f2f2;
  --muted: #9a9a9a;
  --orange: #ee8035;
  --orange-dim: #8a4d1f;
  --green: #4ade80;
  --red: #f87171;
  --error: #e05c5c;
  --sidebar-w: 268px;
  --topbar-h: 60px;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #fff;
  --surface: #fff;
  --surface-2: #f4f4f4;
  --line: #e2e2e2;
  --text: #242424;
  --muted: #6b6b6b;
  --orange-dim: #c76b2d;
  --green: #16803c;
  --red: #dc4c4c;
  --error: #b42323;
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
}

a {
  color: inherit;
}

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

/* Shared controls and messages */
label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

input, select, textarea {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 7px;
}

input:focus, select:focus, textarea:focus {
  outline: 1px solid var(--orange);
  border-color: var(--orange);
}

.btn, button {
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}

.btn:hover, .toolbar-btn:hover {
  border-color: var(--orange);
}

.btn-primary {
  background: var(--orange);
  border-color: var(--orange);
  color: #080808;
}

.btn-danger {
  color: var(--red);
}

.label-compact {
  margin: 0;
}

.heading-compact {
  margin: 0;
}

.dashboard-flash {
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 7px;
  background: rgba(76,175,125,.12);
  border: 1px solid rgba(76,175,125,.35);
  color: #8fd9af;
}

.dashboard-flash-error {
  background: rgba(224,92,92,.12);
  border-color: rgba(224,92,92,.35);
  color: #f0a5a5;
}

.checkbox-control {
  width: 18px;
  height: 18px;
  accent-color: var(--orange);
}

.config-hint {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 10px;
}

.sync-status-compact {
  margin-bottom: 0;
}

.section-title-spaced {
  margin-top: 20px;
}

.flash {
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

.flash.error, .flash-error {
  background: rgba(224,92,92,.12);
  border: 1px solid rgba(224,92,92,.35);
  color: #f0a5a5;
}

.flash.success, .flash-success {
  background: rgba(76,175,125,.12);
  border: 1px solid rgba(76,175,125,.35);
  color: #8fd9af;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
}

/* Login */
.page-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 34px 30px 30px;
}

.login-card img {
  width: 96px;
  display: block;
  margin: 0 auto 18px;
}

.login-card h1 {
  font: 600 18px 'Space Grotesk', sans-serif;
  text-align: center;
  margin: 0 0 4px;
}

.login-card .sub {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 26px;
}

.login-card .field {
  margin-bottom: 16px;
}

.login-card input {
  width: 100%;
  padding: 11px 12px;
  font-size: 14px;
}

.login-card button[type='submit'] {
  width: 100%;
  background: var(--orange);
  color: #1a0d04;
  border: 0;
  border-radius: 8px;
  padding: 12px;
  font-weight: 600;
  margin-top: 6px;
}

/* Admin */
.page-admin {
  padding: 30px 24px 60px;
}

.admin-wrap {
  max-width: 900px;
  margin: 0 auto;
}

.admin-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.admin-top img {
  width: 40px;
}

.admin-top h1 {
  font: 19px 'Space Grotesk', sans-serif;
  margin: 0;
  flex: 1;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 13px;
}

.admin-panel {
  margin-bottom: 24px;
}

.admin-panel h2 {
  font: 14.5px 'Space Grotesk', sans-serif;
  margin: 0 0 16px;
}

.new-user-form {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto auto;
  gap: 10px;
  align-items: end;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.checkbox-row label {
  margin: 0;
}

.new-user-form input {
  width: 100%;
  padding: 9px 10px;
  font-size: 13.5px;
}

.new-user-form button, .actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.new-user-form button {
  background: var(--orange);
  border-color: var(--orange);
  color: #080808;
  padding: 9px 13px;
}

.new-user-form button:hover, .actions button:hover {
  border-color: var(--orange);
}

.admin-panel table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.admin-panel th, .admin-panel td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}

.admin-panel th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge.ativo {
  background: rgba(76,175,125,.15);
  color: var(--green);
}

.badge.inativo {
  background: rgba(224,92,92,.15);
  color: var(--error);
}

.badge.admin {
  background: rgba(238,128,53,.15);
  color: var(--orange);
  margin-left: 6px;
}

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.password-form {
  display: flex;
  gap: 6px;
}

.password-form input {
  width: 120px;
  padding: 6px 10px;
  font-size: 12.5px;
}

.actions button.secundario {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line);
}

.actions button.perigo {
  background: rgba(224,92,92,.15);
  color: #f0a5a5;
  border-color: rgba(224,92,92,.35);
}

/* Dashboard */
.dashboard {
  height: 100vh;
  overflow: hidden;
}

.shell {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.sidebar-head {
  padding: 26px 22px 22px;
  border-bottom: 1px solid var(--line);
}

.sidebar-head img {
  width: 116px;
  display: block;
}

.sidebar-head .tag {
  margin-top: 12px;
  font: 11px 'Space Grotesk', sans-serif;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
}

.nav {
  padding: 18px 12px;
  overflow-y: auto;
  flex: 1;
}

.nav-label {
  color: #6b6b6b;
  font: 600 10px 'Space Grotesk', sans-serif;
  text-transform: uppercase;
  letter-spacing: .12em;
  padding: 0 10px 10px;
}

.nav a {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid transparent;
}

.nav a + a {
  margin-top: 4px;
}

.nav a svg {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 1px;
  stroke: currentColor;
}

.nav a .txt {
  min-width: 0;
}

.nav a .name {
  color: #d8d8d8;
  font: 600 13.5px/1.3 'Space Grotesk', sans-serif;
}

.nav a .desc {
  display: block;
  color: #7a7a7a;
  font-size: 11.5px;
  line-height: 1.4;
  margin-top: 3px;
}

.nav a:hover {
  background: var(--surface-2);
  color: #c9c9c9;
}

.nav a.active {
  background: rgba(238,128,53,.1);
  border-color: rgba(238,128,53,.35);
  color: var(--orange);
}

.nav a.active .name {
  color: var(--orange);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  transition: border-color .15s ease, color .15s ease;
}

.theme-toggle:hover {
  border-color: var(--orange);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.theme-toggle .icon-moon,
html[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

html[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

.sidebar-foot {
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: #5f5f5f;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  font: 600 15px 'Space Grotesk', sans-serif;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar .spacer {
  flex: 1;
}

.topbar .btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

.burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
}

.frame-wrap {
  flex: 1;
  position: relative;
  min-height: 0;
}

#viewer {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--bg);
}

.welcome {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  background: var(--bg);
}

.welcome.hidden {
  display: none;
}

.welcome h2 {
  font: 700 22px 'Space Grotesk', sans-serif;
  margin: 0 0 10px;
}

.welcome p {
  color: var(--muted);
  font-size: 13.5px;
  max-width: 380px;
  line-height: 1.6;
}

.welcome .dot {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(238,128,53,.35);
  background: rgba(238,128,53,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.welcome .dot svg {
  width: 22px;
  height: 22px;
  stroke: var(--orange);
}

.overlay {
  display: none;
}

/* Catalog */
.page-catalog, .page-calculator, .page-trade, .page-whatsapp {
  min-height: 100vh;
  padding: 32px 16px 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.catalog-header, .catalog-grid, .catalog-footer {
  width: 100%;
  max-width: 1120px;
}

.catalog-header {
  text-align: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.logo {
  width: 120px;
  height: auto;
  margin-bottom: 14px;
}

.catalog-header h1 {
  font: 700 22px 'Space Grotesk', sans-serif;
  margin: 12px 0 5px;
}

.catalog-header p, .catalog-footer {
  color: var(--muted);
  font-size: 12px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(250px,1fr));
  gap: 16px;
  margin-top: 28px;
}

.catalog-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.catalog-card .badge {
  align-self: flex-start;
  border-radius: 4px;
  padding: 3px 7px;
  font: 11px 'IBM Plex Mono', monospace;
}

.battery-badge.battery-good {
  color: var(--green);
  background: rgba(74,222,128,.1);
  border: 1px solid rgba(74,222,128,.3);
}

.battery-badge.battery-warning {
  color: #f2c94c;
  background: rgba(242,201,76,.1);
  border: 1px solid rgba(242,201,76,.3);
}

.battery-badge.battery-low {
  color: var(--orange);
  background: rgba(238,128,53,.1);
  border: 1px solid rgba(238,128,53,.35);
}

.battery-badge.battery-missing {
  color: #6f6f6f;
  background: #0d0d0d;
  border: 1px solid #292929;
}

.product-name {
  font: 700 17px 'Space Grotesk', sans-serif;
}

.product-color {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.product-specs {
  color: var(--muted);
  font-size: 12px;
}

.product-quantity {
  color: var(--orange);
  font-size: 11px;
  font-weight: 600;
}

.price-block {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.price-label {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.price-value {
  font: 600 23px 'IBM Plex Mono', monospace;
  margin-top: 3px;
}

.catalog-cta {
  display: block;
  margin-top: 8px;
  padding: 10px;
  border-radius: 6px;
  background: var(--orange);
  color: #080808;
  text-align: center;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.catalog-footer {
  text-align: center;
  margin-top: 38px;
  line-height: 1.7;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 50px 20px;
}

/* Stock */
.page-stock {
  padding: 30px 16px 60px;
}

.stock-main {
  max-width: 1180px;
  margin: 0 auto;
}

.stock-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.stock-header-actions {
  display: flex;
  flex: none;
  gap: 8px;
}

.stock-header h1 {
  font: 28px 'Space Grotesk', sans-serif;
  margin: 0;
}

.stock-header p {
  color: var(--muted);
  margin: 7px 0 0;
  font-size: 13px;
}

.stock-panel {
  margin-bottom: 18px;
}

.general-stock-panel {
  padding: 18px;
}

.general-stock-meta,
.general-stock-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.general-stock-status {
  font-size: 13px;
  font-weight: 600;
}

.general-stock-status.is-stale,
.general-stock-status.is-error,
.general-stock-message.is-error,
.general-stock-detail-row .is-error {
  color: var(--red);
}

.general-stock-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 14px;
}

.general-stock-query {
  grid-column: span 2;
}

.general-stock-filters input.stock-input,
.general-stock-filters select.stock-input {
  min-height: 40px;
}

.general-stock-filters :disabled {
  opacity: .55;
  cursor: not-allowed;
}

.general-stock-availability {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.general-stock-filter-actions,
.general-stock-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.general-stock-hint {
  margin: 14px 0 0;
}

.general-stock-results-head {
  margin-bottom: 14px;
}

.general-stock-results-head h2 {
  margin: 0;
}

.general-stock-pagination {
  font-size: 12px;
  color: var(--muted);
}

.general-stock-pagination .btn {
  padding: 7px 10px;
}

.general-stock-message {
  padding: 12px 0;
  color: var(--muted);
  font-size: 13px;
}

.general-stock-table {
  min-width: 1080px;
}

/* .stock-table usa layout fixo com larguras da tabela de iPhones; esta tabela tem 9 colunas. */
.stock-table.general-stock-table th:nth-child(1),
.stock-table.general-stock-table td:nth-child(1) { width: 26%; }
.stock-table.general-stock-table th:nth-child(2),
.stock-table.general-stock-table td:nth-child(2) { width: 10%; }
.stock-table.general-stock-table th:nth-child(3),
.stock-table.general-stock-table td:nth-child(3) { width: 9%; }
.stock-table.general-stock-table th:nth-child(4),
.stock-table.general-stock-table td:nth-child(4) { width: 8%; }
.stock-table.general-stock-table th:nth-child(5),
.stock-table.general-stock-table td:nth-child(5) { width: 12%; }
.stock-table.general-stock-table th:nth-child(6),
.stock-table.general-stock-table td:nth-child(6) { width: 8%; }
.stock-table.general-stock-table th:nth-child(7),
.stock-table.general-stock-table td:nth-child(7) { width: 7%; }
.stock-table.general-stock-table th:nth-child(8),
.stock-table.general-stock-table td:nth-child(8) { width: 5%; }
.stock-table.general-stock-table th:nth-child(9),
.stock-table.general-stock-table td:nth-child(9) { width: 15%; }

.general-stock-row-actions .btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.general-stock-minimum-price {
  min-width: 112px;
}

.general-stock-detail-row td {
  background: var(--surface-2);
}

.general-stock-detail-row ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 10px 0 0;
  padding-left: 18px;
}

.general-stock-detail-button {
  white-space: nowrap;
}

/* Ajustes locais do estoque geral */
.general-stock-edit-availability {
  margin: 12px 0 0;
}

.general-stock-feedback {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 13px;
}

.general-stock-feedback.is-error {
  color: var(--red);
  border-color: var(--red);
}

.general-stock-conflicts {
  border-color: var(--orange);
}

.general-stock-conflicts .hint {
  margin: 0 0 12px;
}

.general-stock-conflicts-table,
.general-stock-hidden-table {
  min-width: 760px;
}

.general-stock-conflicts-table .is-error {
  color: var(--red);
}

.general-stock-conflicts-table td.general-stock-row-actions,
.general-stock-hidden-table td.general-stock-row-actions {
  width: 1%;
}

.general-stock-row-actions .btn {
  display: block;
  width: 100%;
  padding: 7px 10px;
  white-space: nowrap;
}

.general-stock-row-actions .btn + .btn {
  margin-top: 6px;
}

.general-stock-value {
  display: block;
}

td.is-adjusted .general-stock-value {
  color: var(--orange);
  font-weight: 600;
}

.general-stock-adjusted {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.general-stock-badge {
  padding: 1px 7px;
  border: 1px solid var(--orange);
  border-radius: 999px;
  color: var(--orange);
  font-weight: 600;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.general-stock-badge.is-conflict {
  border-color: var(--red);
  color: var(--red);
}

.btn.general-stock-link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 11px;
  text-decoration: underline;
  cursor: pointer;
}

.btn.general-stock-link-button:hover {
  color: var(--text);
}

/* Rolagem das tabelas do estoque geral. .stock-panel .table-wrap esconde a rolagem
   horizontal; aqui as tabelas largas rolam para o lado em vez de ficarem cortadas. */
.stock-panel .table-wrap.general-stock-scroll {
  overflow-x: auto;
  scrollbar-color: var(--orange) var(--surface-2);
  scrollbar-width: thin;
}

/* Produtos: altura limitada, rolagem vertical na lateral e cabeçalho fixo no topo. */
.stock-panel .table-wrap.general-stock-products-scroll {
  max-height: 70vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stock-panel .table-wrap.general-stock-products-scroll:focus-visible {
  outline: 1px solid var(--orange);
}

.general-stock-products-scroll .general-stock-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: inset 0 -1px 0 var(--line);
}

.general-stock-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.general-stock-scroll::-webkit-scrollbar-track {
  background: var(--surface-2);
  border-radius: 999px;
}

.general-stock-scroll::-webkit-scrollbar-thumb {
  background: var(--orange);
  border: 2px solid var(--surface-2);
  border-radius: 999px;
}

.general-stock-scroll::-webkit-scrollbar-corner {
  background: transparent;
}

/* Edição direto na tabela */
.general-stock-edit-hint {
  margin: 0 0 12px;
}

.stock-table input.general-stock-name-input,
.stock-table input.general-stock-price-input {
  font-size: 12px;
}

td.is-adjusted input.stock-input {
  border-color: var(--orange);
  color: var(--orange);
  font-weight: 600;
}

td.general-stock-active-cell {
  text-align: center;
}

/* .stock-table input estica todos os inputs da tabela; o checkbox volta ao tamanho normal. */
.stock-table input.general-stock-active {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--orange);
}

/* Linha com alteração ainda não salva. */
.general-stock-table tr.is-dirty > td {
  background: var(--surface-2);
}

.general-stock-table tr.is-dirty > td:first-child {
  box-shadow: inset 3px 0 0 var(--orange);
}

.stock-panel h2 {
  font: 17px 'Space Grotesk', sans-serif;
  margin: 0 0 16px;
}

/* Resumo de disponibilidade (novos e seminovos) acima dos cards */
.stock-availability-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.stock-availability-head h2 {
  margin: 0;
}

.stock-availability-legend {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}

.stock-availability-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stock-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
}

.stock-dot.is-on {
  background: var(--green);
}

.stock-availability-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 12px;
}

.stock-availability-group {
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.stock-availability-group h3 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
  font: 600 13px 'Inter', sans-serif;
}

.stock-availability-group h3 span {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
}

.stock-availability-list {
  list-style: none;
  margin: 0;
  padding: 0;
  /* colunas de jornal: a lista desce e continua na coluna seguinte, na ordem dos modelos */
  columns: 170px;
  column-gap: 14px;
}

.stock-availability-list li {
  break-inside: avoid;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.stock-availability-model {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-availability-qty {
  font: 600 13px 'IBM Plex Mono', monospace;
  font-variant-numeric: tabular-nums;
}

.stock-availability-list li.is-off .stock-availability-model,
.stock-availability-list li.is-off .stock-availability-qty {
  color: var(--muted);
}

.stock-availability-list li.is-off .stock-availability-qty {
  color: var(--red);
}

/* Valores Celulares: mesmo layout da Disponibilidade, com o preço editável no lugar da quantidade */
.stock-prices .stock-availability-head {
  flex-wrap: wrap;
}

.stock-prices-switch {
  display: inline-flex;
  margin-right: auto;
  padding: 3px;
  gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.stock-prices-switch button {
  position: relative;
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  background: transparent;
  color: var(--muted);
  font: 600 13px 'Inter', sans-serif;
  cursor: pointer;
}

.stock-prices-switch button span {
  margin-left: 4px;
  font-weight: 500;
  font-size: 11.5px;
  opacity: .75;
}

.stock-prices-switch button[aria-pressed="true"] {
  background: var(--orange);
  color: #fff;
}

.stock-prices-switch button:disabled {
  opacity: .4;
  cursor: default;
}

.stock-prices-switch button:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* bolinha: há valores alterados não salvos nesta categoria */
.stock-prices-switch button.has-changes::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 2px var(--surface-2);
}

.stock-prices-switch button[aria-pressed="true"].has-changes::after {
  background: #fff;
  box-shadow: none;
}

.stock-prices .stock-availability-group[hidden] {
  display: none;
}

.stock-prices-list {
  columns: 230px;
}

.stock-prices-list li {
  padding: 3px 0;
}

.stock-prices-list label {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  cursor: text;
}

.stock-prices-list li.is-dirty .stock-availability-model {
  color: var(--orange);
}

.stock-price-field {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.stock-price-field input {
  width: 92px;
  box-sizing: border-box;
  padding: 4px 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: 600 13px 'IBM Plex Mono', monospace;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.stock-price-field input:focus {
  outline: none;
  border-color: var(--orange);
}

.stock-price-field.is-mixed input {
  border-style: dashed;
}

.stock-price-field input::placeholder {
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
}

.stock-prices-list li.is-dirty .stock-price-field input {
  border-color: var(--orange);
  border-style: solid;
}

.stock-prices-hint {
  margin: 10px 0 0;
}

#salvar-valores:disabled {
  opacity: .4;
  cursor: default;
}

/* Atualizar quantidades por texto (fim da tela de estoque) */
.stock-text-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 16px;
}

.stock-text-head h2 {
  margin: 0;
}

.stock-zero-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stock-zero-form select {
  width: auto;
}

.stock-text-update .hint {
  margin: -6px 0 12px;
}

.stock-text-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 180px;
  resize: vertical;
  font: 13px/1.5 'IBM Plex Mono', monospace;
}

.stock-text-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.stock-text-actions select {
  width: auto;
}

.stock-text-preview {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.stock-text-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.stock-text-summary span {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.stock-text-summary b {
  color: var(--text);
}

.stock-text-summary .is-warning,
.stock-text-summary .is-warning b,
.stock-text-note.is-warning {
  color: var(--orange);
}

.stock-text-preview h3 {
  font: 600 13px 'Inter', sans-serif;
  margin: 18px 0 8px;
}

.stock-text-preview h3 span {
  color: var(--muted);
  font-weight: 500;
}

.stock-panel .table-wrap:has(.stock-text-table) {
  overflow-x: auto;
}

.stock-text-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.stock-text-table th,
.stock-text-table td {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.stock-text-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
}

.stock-text-table td:first-child,
.stock-text-table th:first-child {
  width: 1%;
}

.stock-text-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: var(--orange);
}

.stock-text-qty {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.stock-text-qty .is-zero {
  color: var(--red);
}

.stock-text-lines {
  color: var(--muted);
  font-size: 12px;
}

.stock-text-note {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.stock-text-unknown {
  margin: 0;
  padding: 0;
  list-style: none;
  font: 12.5px/1.6 'IBM Plex Mono', monospace;
  color: var(--muted);
}

.stock-text-unknown span {
  color: var(--orange);
  margin-right: 6px;
}

.stock-text-apply {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.source-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: 12px;
}

.source {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  padding: 16px;
  border-radius: 7px;
}

.source-upload {
  max-width: 760px;
  text-align: center;
}

.source h3 {
  font: 600 15px 'Space Grotesk', sans-serif;
  margin: 0 0 6px;
}

.source p, .hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.stock-input {
  width: 100%;
  padding: 10px 11px;
  font-size: 13px;
}

.stock-upload-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  width: 100%;
  max-width: 600px;
  gap: 12px;
  margin: 0 auto;
}

.stock-file-picker {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  height: 44px;
  overflow: hidden;
  border: 1px solid var(--orange-dim);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
}

.stock-file-picker:focus-within {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.stock-file-picker-action {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  padding: 0 14px;
  background: var(--orange);
  color: #080808;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.stock-file-picker-name {
  flex: 1;
  min-width: 0;
  padding: 0 12px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-file-picker.has-file .stock-file-picker-name {
  color: var(--text);
}

.stock-file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.stock-upload-form .btn {
  width: 100%;
  height: 44px;
  min-height: 44px;
}

.stock-upload-hint {
  margin-top: 12px;
  text-align: center;
}

.stock-fields {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(6, minmax(0, 1fr)) minmax(52px, .45fr) auto;
  gap: 10px;
  align-items: end;
}

.stock-fields > div {
  min-width: 0;
}

.stock-fields input {
  width: 100%;
  min-height: 40px;
  padding: 10px 11px;
  font-size: 13px;
}

.stock-fields select {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  font-size: 13px;
}

.stock-field-quantity input {
  width: 5ch;
  max-width: 5ch;
  padding-right: 2px;
  padding-left: 2px;
  text-align: center;
}

.stock-fields > button {
  min-height: 40px;
  white-space: nowrap;
}

/* Observação: segunda linha do formulário, até a coluna do botão. */
.stock-field-note {
  grid-column: 1 / -2;
}

.purchase-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.purchase-fields > div {
  min-width: 0;
}

.purchase-fields input {
  width: 100%;
  min-height: 40px;
  padding: 10px 11px;
  font-size: 13px;
}

.purchase-fields > button {
  min-height: 40px;
  white-space: nowrap;
}

.purchase-table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
}

.purchase-table th {
  color: var(--muted);
  font-size: 10px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.purchase-table td {
  padding: 10px;
  border-bottom: 1px solid #242424;
  font-size: 12px;
  vertical-align: middle;
}

.purchase-table input {
  width: 100%;
  min-width: 110px;
  min-height: 36px;
  padding: 8px 9px;
  font-size: 12px;
}

.purchase-table th:first-child,
.purchase-table td:first-child {
  min-width: 190px;
}

.purchase-table .actions {
  align-items: center;
  flex-wrap: nowrap;
}

.purchase-table .actions form {
  display: flex;
}

.purchase-table .actions .btn {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 12px;
  white-space: nowrap;
}

.stock-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.stock-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stock-toolbar-actions form {
  margin: 0;
}

#salvar-alteracoes-estoque {
  display: none;
}

.stock-save-all {
  flex: none;
  white-space: nowrap;
}

.stock-search {
  max-width: 320px;
}

.table-wrap {
  overflow: auto;
}

.stock-panel .table-wrap {
  overflow-x: hidden;
}

.stock-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

/* Estoque de celulares: modelo, categoria, capacidade, cor, série, bateria, preço, qtd.,
   observação, imagens e vídeos, ações. */
.stock-table th:nth-child(1),
.stock-table td:nth-child(1) { width: 11%; }
.stock-table th:nth-child(2),
.stock-table td:nth-child(2) { width: 8%; }
.stock-table th:nth-child(3),
.stock-table td:nth-child(3) { width: 7%; }
.stock-table th:nth-child(4),
.stock-table td:nth-child(4) { width: 6%; }
.stock-table th:nth-child(5),
.stock-table td:nth-child(5) { width: 9%; }
.stock-table th:nth-child(6),
.stock-table td:nth-child(6) { width: 5%; }
.stock-table th:nth-child(7),
.stock-table td:nth-child(7) { width: 7%; }
.stock-table th:nth-child(8),
.stock-table td:nth-child(8) { width: 5%; }
.stock-table th:nth-child(9),
.stock-table td:nth-child(9) { width: 13%; }
.stock-table th:nth-child(10),
.stock-table td:nth-child(10) { width: 21%; }
.stock-table th:nth-child(11),
.stock-table td:nth-child(11) { width: 8%; }

.stock-table th,
.stock-table td {
  overflow-wrap: anywhere;
}

.stock-table th {
  color: var(--muted);
  font-size: 10px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 7px 5px;
  border-bottom: 1px solid var(--line);
}

.stock-table td {
  padding: 6px 5px;
  border-bottom: 1px solid #242424;
  font-size: 12px;
  vertical-align: middle;
}

.stock-table input {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 6px 5px;
  font-size: 11px;
}

.stock-table select {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 5px 3px;
  font-size: 10px;
}

.stock-media-cell {
  min-width: 0;
  max-width: none;
}

.stock-media-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.stock-media-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  max-width: 110px;
}

.stock-media-item img,
.stock-media-item video {
  display: block;
  width: 88px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #000;
  object-fit: cover;
}

.stock-media-upload {
  display: grid;
  gap: 6px;
}

.stock-media-upload input[type="file"] {
  min-width: 0;
  max-width: 100%;
  font-size: 11px;
}

.stock-media-upload .btn {
  justify-self: start;
  min-height: 30px;
  padding: 6px 9px;
  font-size: 11px;
}

.stock-media-cell small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.stock-media-remove {
  min-height: 24px !important;
  padding: 3px 6px !important;
  font-size: 10px !important;
}

.stock-table th:first-child,
.stock-table td:first-child {
  min-width: 0;
}

.stock-table input[name="quantidade"] {
  width: 5ch;
  min-width: 5ch;
  max-width: 5ch;
  padding-right: 2px;
  padding-left: 2px;
  text-align: center;
}

.stock-table tbody tr:hover td {
  background: rgba(255,255,255,.02);
}

.stock-actions {
  display: flex;
  gap: 6px;
}

.stock-actions .btn {
  padding: 7px 9px;
}

.stock-table .actions {
  align-items: center;
  flex-wrap: nowrap;
}

.stock-table .actions form {
  display: flex;
}

.stock-table .actions .btn {
  min-width: 0;
  min-height: 32px;
  padding: 5px;
  font-size: 10px;
}

.stock-table .btn-stock-save,
.purchase-table .btn-stock-save {
  color: var(--green);
  border-color: rgba(74,222,128,.35);
}

.stock-table .btn-stock-save:hover,
.purchase-table .btn-stock-save:hover {
  background: rgba(74,222,128,.08);
  border-color: var(--green);
}

.stock-table .btn-danger,
.purchase-table .btn-danger {
  color: var(--red);
  border-color: rgba(248,113,113,.35);
}

.stock-table .btn-danger:hover,
.purchase-table .btn-danger:hover {
  background: rgba(248,113,113,.08);
  border-color: var(--red);
}

.stock-view-toggle {
  flex: none;
  white-space: nowrap;
}

.stock-list.is-grid {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 10px;
  scrollbar-color: var(--orange) var(--surface-2);
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.stock-list.is-grid::-webkit-scrollbar {
  height: 10px;
}

.stock-list.is-grid::-webkit-scrollbar-track {
  background: var(--surface-2);
  border-radius: 999px;
}

.stock-list.is-grid::-webkit-scrollbar-thumb {
  background: var(--orange);
  border: 2px solid var(--surface-2);
  border-radius: 999px;
}

.stock-list.is-grid .stock-table {
  display: block;
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.stock-list.is-grid .stock-table thead {
  display: none;
}

.stock-list.is-grid .stock-table tbody {
  display: flex;
  width: max-content;
  align-items: flex-start;
  gap: 14px;
}

.stock-list.is-grid .stock-table tbody tr {
  display: flex;
  flex: 0 0 min(300px, calc(100vw - 64px));
  flex-direction: column;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  box-sizing: border-box;
  scroll-snap-align: start;
}

.stock-list.is-grid .stock-table tbody tr:hover td {
  background: transparent;
}

.stock-list.is-grid .stock-table td {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.stock-list.is-grid .stock-table td::before {
  content: attr(data-label);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.stock-list.is-grid .stock-table input[type="hidden"] {
  display: none;
}

.stock-list.is-grid .stock-table td:first-child input:not([type="hidden"]) {
  font-size: 14px;
  font-weight: 600;
}

.stock-list.is-grid .stock-table td:nth-child(5) {
  order: 8;
}

.stock-list.is-grid .stock-table td:nth-child(6) {
  order: 5;
}

.stock-list.is-grid .stock-table td:nth-child(7) {
  order: 6;
}

.stock-list.is-grid .stock-table td:nth-child(8) {
  order: 7;
}

/* Observação: logo depois do número de série (mesma ordem, vem depois no HTML). */
.stock-list.is-grid .stock-table td:nth-child(9) {
  order: 8;
}

.stock-list.is-grid .stock-table td:nth-child(10) {
  display: block;
  order: 9;
  padding-top: 12px;
}

.stock-list.is-grid .stock-table td:nth-child(10)::before {
  display: block;
  margin-bottom: 8px;
  text-align: center;
}

.stock-list.is-grid .stock-media-previews {
  justify-content: center;
}

.stock-list.is-grid .stock-media-item {
  align-items: center;
}

.stock-list.is-grid .stock-media-item img,
.stock-list.is-grid .stock-media-item video {
  width: 72px;
  height: 58px;
}

.stock-list.is-grid .stock-media-upload {
  justify-items: center;
}

.stock-list.is-grid .stock-media-upload input[type="file"] {
  width: 100%;
  text-align: center;
}

.stock-list.is-grid .stock-media-upload .btn {
  justify-self: center;
}

.stock-list.is-grid .stock-media-cell small {
  text-align: center;
}

.stock-list.is-grid .stock-table td:nth-child(11) {
  display: block;
  order: 10;
  padding-top: 12px;
  border-bottom: 0;
}

.stock-list.is-grid .stock-table td:nth-child(11)::before {
  display: none;
}

.stock-list.is-grid .stock-table .actions form,
.stock-list.is-grid .stock-table .actions .btn {
  width: 100%;
}

@media (max-width: 980px) {
  .stock-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .purchase-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stock-field-model {
    grid-column: span 2;
  }

  .stock-field-note,
  .stock-fields > button,
  .purchase-fields > button {
    grid-column: 1 / -1;
  }
}

/* Calculator, trade and WhatsApp */
.page-calculator {
  padding-top: 40px;
}

.page-calculator h1 {
  font: 700 26px 'Space Grotesk', sans-serif;
  margin: 0 0 28px;
}

.tool-layout {
  width: 100%;
  max-width: 780px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tool-panel {
  padding: 22px 24px;
}

.panel-title {
  font: 700 14px 'Space Grotesk', sans-serif;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 0 0 16px;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.input-row input[type=number] {
  width: 160px;
  padding: 10px 14px;
  font: 600 18px 'IBM Plex Mono', monospace;
}

.pix-callout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-2);
  border: 1px dashed var(--orange-dim);
  border-radius: 8px;
  padding: 14px 18px;
  margin-top: 16px;
}

.pix-callout .label {
  font-size: 13px;
}

.pix-callout .value {
  color: var(--green);
  font: 600 20px 'IBM Plex Mono', monospace;
}

.inline-flex {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-note {
  color: var(--muted);
  font-size: 13px;
}

.receipt {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.receipt::before, .receipt::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 14px;
  background-image: radial-gradient(circle 7px,var(--bg) 7px,transparent 8px);
  background-size: 24px 14px;
  background-repeat: repeat-x;
}

.receipt::before {
  top: -7px;
}

.receipt::after {
  bottom: -7px;
}

.receipt-inner {
  padding: 28px 22px 26px;
}

.receipt table {
  width: 100%;
  border-collapse: collapse;
}

.receipt th {
  text-align: right;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.receipt th:first-child, .receipt td:first-child {
  text-align: left;
}

.receipt td {
  padding: 9px 4px;
  font: 14px 'IBM Plex Mono', monospace;
  text-align: right;
  border-bottom: 1px dashed var(--line);
}

.receipt tr:last-child td {
  border-bottom: none;
}

.parcelas-col {
  color: var(--muted);
}

.taxa-fixa {
  color: var(--orange);
  font: 13px 'IBM Plex Mono', monospace;
}

.valor-cobrar {
  color: var(--text);
  font-weight: 600;
}

.valor-parcela {
  color: var(--green);
}

.receipt-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}

.note {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.note b {
  color: var(--text);
}

.tool-layout.trade {
  max-width: 640px;
  gap: 18px;
}

.trade-page {
  padding-top: 32px;
}

.trade-page h1, .whatsapp-page h1 {
  font: 700 21px 'Space Grotesk', sans-serif;
  margin: 0 0 6px;
}

.subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 26px;
}

.field {
  margin-bottom: 14px;
}

.field:last-child {
  margin-bottom: 0;
}

.field select, .field input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
}

.trade-value-control {
  display: flex;
  gap: 8px;
}

.trade-value-control input {
  min-width: 0;
  flex: 1;
}

.trade-value-control .toolbar-btn {
  flex: none;
  white-space: nowrap;
}

.trade-price-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11.5px;
  margin-bottom: 16px;
}

.sync-status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.sync-status .dot.off {
  background: var(--muted);
}

.tool-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar-btn {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12.5px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.line-calc {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}

.line-calc .val {
  font: 13.5px 'IBM Plex Mono', monospace;
}

.line-calc.total {
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 14px;
}

.line-calc.total .val {
  color: var(--orange);
  font-size: 20px;
  font-weight: 600;
}

.linha-calc {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}

.linha-calc .val {
  font: 13.5px 'IBM Plex Mono', monospace;
}

.trade-page .receipt {
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
}

.trade-page .receipt .linha-calc {
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  line-height: 1.5;
}

.trade-page .receipt .linha-calc .val {
  flex: none;
  font-size: 13.5px;
}

.linha-calc.total {
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 14px;
}

.linha-calc.total .val {
  color: var(--orange);
  font-size: 20px;
  font-weight: 600;
}

.parcela-config {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 13px;
}

.trade-page .receipt .parcela-config {
  display: flex;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 6px;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.4;
}

.parcela-config input[type=number] {
  width: 60px;
}

.trade-page .receipt .parcela-config input[type=number] {
  flex: none;
  width: 42px;
  height: 32px;
  padding: 5px 2px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  text-align: center;
}

.parcela-config input[type=checkbox], .config-row input[type=checkbox] {
  width: 18px;
  height: 18px;
  accent-color: var(--orange);
}

.parcela-resultado {
  margin-top: 10px;
  color: var(--green);
  font: 15px 'IBM Plex Mono', monospace;
}

.trade-page .receipt .parcela-resultados {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: repeat(2, auto);
  margin-top: 10px;
}

.trade-page .receipt .parcela-resultado {
  min-width: 0;
  margin-top: 0;
  font-size: 13.5px;
  line-height: 1.5;
}

.trade-page .receipt #parcelaResultado1 {
  text-align: left;
  padding-right: 8px;
}

.trade-page .receipt #parcelaResultado2 {
  text-align: right;
  padding-left: 0;
}

.trade-page .receipt #parcelaResultado3 {
  text-align: left;
  padding-right: 0;
}

.trade-page .receipt #parcelaResultado4 {
  text-align: right;
  padding-left: 0;
}

.trade-page .toolbar-btn,
.trade-page .copy-btn {
  min-height: 36px;
  padding: 9px 13px;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
}

.tool-textarea {
  width: 100%;
  min-height: 110px;
  padding: 14px;
  margin-top: 14px;
  resize: vertical;
  font: 13.5px/1.7 'IBM Plex Mono', monospace;
}

.copy-btn {
  width: 100%;
  margin-top: 10px;
  padding: 12px 16px;
  background: var(--orange);
  color: #000;
  border: 0;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.copy-btn.copied {
  background: var(--green);
}

.warn {
  color: var(--muted);
  font-size: 12px;
  margin-top: 10px;
}

.whatsapp-page {
  padding-top: 32px;
}

.whatsapp-layout {
  width: 100%;
  max-width: 1080px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.whatsapp-layout input[type=text], .whatsapp-layout input[type=number], .whatsapp-layout select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12.5px;
  padding: 6px 7px;
  border-radius: 5px;
}

.stock-table-wide {
  width: 100%;
  border-collapse: collapse;
}

.stock-table-wide th {
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  text-align: left;
  padding: 0 4px 8px;
  white-space: nowrap;
}

.stock-table-wide td {
  padding: 4px;
  border-bottom: 1px solid var(--line);
}

.col-cat {
  width: 8%;
}

.col-modelo {
  width: 15%;
}

.col-arm {
  width: 8%;
}

.col-cor {
  width: 10%;
}

.col-cond {
  width: 12%;
}

.col-bat {
  width: 6%;
}

.col-precocartao, .col-precovista {
  width: 9%;
}

.col-qtd {
  width: 5%;
}

.col-disp {
  width: 6%;
  text-align: center;
}

.col-del {
  width: 4%;
  text-align: center;
}

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

.tab-btn {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--orange);
  border-color: var(--orange);
  color: #000;
  font-weight: 600;
}

.config-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.config-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-row input[type=number] {
  width: 56px;
  padding: 6px;
}

.add-btn {
  width: 100%;
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
}

.del-btn {
  background: none;
  border: 0;
  color: var(--red);
  font-size: 18px;
  cursor: pointer;
}

@media (max-width: 860px) {
  .burger {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    transition: transform .22s ease;
  }

  body.menu-open .sidebar {
    transform: translateX(0);
  }

  body.menu-open .overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 15;
  }
}

@media (max-width: 760px) {
  .general-stock-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .general-stock-query {
    grid-column: 1 / -1;
  }

  .general-stock-filter-actions {
    grid-column: 1 / -1;
    flex-wrap: wrap;
  }

  .stock-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .stock-toolbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .stock-toolbar-actions form:not(#salvar-alteracoes-estoque) {
    flex: 1 1 100%;
  }

  .stock-search {
    max-width: none;
  }

  .new-user-form {
    grid-template-columns: 1fr;
  }

  .stock-upload-form {
    grid-template-columns: 1fr;
  }

  .stock-file-picker,
  .stock-upload-form .btn {
    width: 100%;
  }

  .stock-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stock-field-model,
  .stock-field-note {
    grid-column: 1 / -1;
  }

  .stock-fields > button {
    grid-column: 1 / -1;
  }

  .stock-header {
    display: block;
  }

  .stock-header-actions {
    margin-top: 14px;
  }

  .purchase-fields {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 500px) {
  .general-stock-filters {
    grid-template-columns: 1fr;
  }

  .general-stock-query,
  .general-stock-filter-actions {
    grid-column: auto;
  }

  .general-stock-results-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .receipt td,
  .receipt th {
    font-size: 12px;
    padding: 8px 2px;
  }

  .pix-callout {
    gap: 10px;
  }

  .trade-page .receipt .parcela-resultados {
    gap: 6px;
  }
}

html[data-theme="light"] .nav-label,
html[data-theme="light"] .sidebar-foot {
  color: var(--muted);
}

html[data-theme="light"] .nav a .name,
html[data-theme="light"] .nav a:hover {
  color: var(--text);
}

html[data-theme="light"] .nav a .desc {
  color: var(--muted);
}

html[data-theme="light"] .nav a.active .desc {
  color: #9e7150;
}

html[data-theme="light"] .dashboard-flash,
html[data-theme="light"] .flash.success,
html[data-theme="light"] .flash-success {
  background: rgba(22,128,60,.1);
  border-color: rgba(22,128,60,.3);
  color: #176b35;
}

html[data-theme="light"] .dashboard-flash-error,
html[data-theme="light"] .flash.error,
html[data-theme="light"] .flash-error,
html[data-theme="light"] .actions button.perigo {
  background: rgba(180,35,35,.08);
  border-color: rgba(180,35,35,.3);
  color: var(--error);
}

html[data-theme="light"] .badge.inativo {
  background: rgba(180,35,35,.1);
  color: var(--error);
}

html[data-theme="light"] .battery-badge.battery-warning {
  color: #946b00;
}

html[data-theme="light"] .battery-badge.battery-missing {
  color: var(--muted);
  background: var(--surface-2);
  border-color: var(--line);
}

html[data-theme="light"] .stock-table td {
  border-bottom-color: var(--line);
}

html[data-theme="light"] .stock-table tbody tr:hover td {
  background: rgba(0,0,0,.03);
}
