/* =====================================================================
   DESIGN SYSTEM — Painel do Representante
   Tokens, reset, layout, componentes. Mobile-first.
   ===================================================================== */

:root {
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --bg: #F4F4F1;
  --surface: #FFFFFF;
  --surface-2: #F8F8F6;
  --border: #E6E5E0;
  --border-strong: #CFCEC7;

  --text: #1B1B19;
  --text-2: #56554F;
  --text-3: #8C8B84;
  --text-inverse: #FFFFFF;

  --primary: #1E3A5F;
  --primary-hover: #17304F;
  --primary-soft: #E8EEF6;

  --accent: #B45309;
  --accent-soft: #FDF1E3;

  --success: #15803D;
  --success-soft: #E6F5EC;
  --warning: #B45309;
  --warning-soft: #FDF1E3;
  --danger: #B91C1C;
  --danger-soft: #FCEBEB;
  --info: #1D4ED8;
  --info-soft: #E8EEFC;

  --wa: #128C7E;
  --wa-hover: #0F7367;
  --wa-soft: #E5F5F2;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(20, 20, 18, .06);
  --shadow: 0 4px 16px rgba(20, 20, 18, .08);
  --shadow-lg: 0 18px 48px rgba(20, 20, 18, .16);

  --sidebar-w: 250px;
  --topbar-h: 60px;
  --bottomnav-h: 64px;

  --focus: 0 0 0 3px rgba(30, 58, 95, .2);
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0 0 .75em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
[hidden] { display: none !important; }

.text-muted { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }
.text-small { font-size: 13px; }
.text-xs { font-size: 12px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.w-100 { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.hide-mobile { display: none; }
@media (min-width: 768px) {
  .hide-mobile { display: initial; }
  .hide-desktop { display: none !important; }
}

/* ---------- Layout ---------- */
.app { min-height: 100vh; }

.sidebar {
  display: none;
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  flex-direction: column;
  z-index: 40;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 15px; letter-spacing: .02em;
  overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-text { min-width: 0; }
.brand-text strong { display: block; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text span { display: block; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.nav-group-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3); padding: 14px 12px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; font-size: 14px;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-link i { font-size: 18px; width: 22px; text-align: center; color: var(--text-3); }
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-link.active i { color: var(--primary); }
.nav-link .nav-badge { margin-left: auto; }

.sidebar-footer { padding: 14px 16px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip .avatar { width: 34px; height: 34px; font-size: 13px; }
.user-chip strong { display: block; font-size: 13px; }
.user-chip span { display: block; font-size: 12px; color: var(--text-3); }

.app-main { min-height: 100vh; padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
}
.topbar-title { font-size: 17px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.btn-back {
  width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); display: grid; place-items: center; flex: none;
}
.btn-back:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }

.page { padding: 20px 16px 32px; max-width: 1180px; margin: 0 auto; }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-header h1 { font-size: 22px; }
.page-header .subtitle { color: var(--text-2); font-size: 14px; margin-top: 2px; }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.bottom-nav a, .bottom-nav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); font-size: 11px; font-weight: 500; background: none; border: 0;
}
.bottom-nav i { font-size: 21px; }
.bottom-nav .active { color: var(--primary); font-weight: 600; }
.bottom-nav a:hover { text-decoration: none; }

@media (min-width: 1024px) {
  .sidebar { display: flex; }
  .app-main { margin-left: var(--sidebar-w); padding-bottom: 0; }
  .bottom-nav { display: none; }
  .topbar { padding: 0 28px; }
  .page { padding: 28px 28px 48px; }
  .page-header h1 { font-size: 24px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 600; font-size: 14px; line-height: 1; white-space: nowrap;
  text-decoration: none; cursor: pointer; user-select: none;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .05s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn i { font-size: 17px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { background: #dbe5f1; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #991b1b; color: #fff; }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-danger-soft:hover { background: #f9d9d9; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #166534; color: #fff; }
.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { background: var(--wa-hover); color: #fff; }
.btn-wa-soft { background: var(--wa-soft); color: var(--wa); }
.btn-wa-soft:hover { background: #d3eee9; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 7px; }
.btn-sm i { font-size: 15px; }
.btn-lg { height: 50px; padding: 0 22px; font-size: 15px; border-radius: var(--radius); }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.btn-block { width: 100%; }
/* Telas estreitas: botões com texto longo quebram linha em vez de estourar a largura */
@media (max-width: 420px) {
  .btn:not(.btn-icon) { white-space: normal; height: auto; min-height: 42px; padding-top: 8px; padding-bottom: 8px; line-height: 1.25; text-align: center; max-width: 100%; }
  .btn-sm:not(.btn-icon) { min-height: 34px; padding-top: 6px; padding-bottom: 6px; }
}
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn-secondary.is-loading::after, .btn-ghost.is-loading::after { border-color: rgba(0, 0, 0, .2); border-top-color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 12px; color: var(--text-3); }
.field .error { font-size: 12px; color: var(--danger); }
.input.is-invalid, .input.is-invalid:focus { border-color: var(--danger); }
.campo-erro { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--danger); }
.req::after { content: ' *'; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 15px; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 96px; padding: 10px 14px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: var(--focus); outline: none; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--text-3); }
.select {
  appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2356554F' viewBox='0 0 16 16'><path d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input-sm { height: 36px; font-size: 14px; padding: 0 10px; }
/* Datas: no iOS/Android o campo nativo ignora a largura, centraliza o texto e fica sem altura quando vazio */
.input[type="date"] {
  -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%;
  line-height: 42px; text-align: left; padding-right: 10px;
}
.input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; min-height: 1.2em; }
.input[type="date"]::-webkit-datetime-edit { padding: 0; line-height: 42px; }
.input[type="date"]::-webkit-calendar-picker-indicator { opacity: .6; cursor: pointer; margin-left: 4px; }
.input-group > .input[type="date"] { flex: 1 1 auto; width: auto; }
.input-group:has(> .input[type="date"]) > .input-prefix { min-width: 52px; justify-content: center; }
.input-group { display: flex; align-items: stretch; }
.input-group > .input-prefix {
  display: flex; align-items: center; padding: 0 12px; background: var(--surface-2);
  border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--text-2); font-size: 14px; font-weight: 600;
}
.input-group > .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group > .input:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group > .input-suffix { border-left: 0; border-right: 1px solid var(--border-strong); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group > .input-suffix + .input { border-radius: 0; }
.search {
  position: relative;
}
.search .input { padding-left: 40px; }
.search > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 16px; pointer-events: none; }
.search .search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }

.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.form-grid > * { grid-column: span 12; min-width: 0; }
@media (max-width: 639px) { .form-grid > .col-m-6 { grid-column: span 6; } }
/* iPhone dá zoom ao tocar em campos com fonte menor que 16px */
@media (max-width: 639px) and (pointer: coarse) {
  .input, .select, .textarea, .order-item .oi-price .input { font-size: 16px; }
}
input[type="file"] { font-size: 13px; color: var(--text-2); max-width: 100%; }
input[type="file"]::file-selector-button {
  height: 36px; padding: 0 14px; margin-right: 10px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
}
input[type="file"]::file-selector-button:hover { background: var(--surface-2); }
@media (min-width: 640px) {
  .col-2 { grid-column: span 2; } .col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; }
  .col-5 { grid-column: span 5; } .col-6 { grid-column: span 6; } .col-7 { grid-column: span 7; }
  .col-8 { grid-column: span 8; } .col-9 { grid-column: span 9; } .col-12 { grid-column: span 12; }
}
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 8px; }
.form-section-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.form-section-title i { color: var(--primary); }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 42px; height: 24px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--success); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }

/* Chips input (tamanhos / cores) */
.chips-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 8px; min-height: 44px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: text; }
.chips-input:focus-within { border-color: var(--primary); box-shadow: var(--focus); }
.chips-input input { flex: 1; min-width: 90px; border: 0; outline: none; background: transparent; height: 30px; font-size: 14px; }
.chips-input input:focus { box-shadow: none; }
.chip-tag { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 10px; border-radius: 7px; background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 600; }
.chip-tag button { border: 0; background: transparent; color: inherit; width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center; padding: 0; }
.chip-tag button:hover { background: rgba(0,0,0,.08); }
.chip-suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-suggestions button { height: 28px; padding: 0 10px; border-radius: 6px; border: 1px dashed var(--border-strong); background: transparent; color: var(--text-2); font-size: 12px; font-weight: 600; }
.chip-suggestions button:hover { border-color: var(--primary); color: var(--primary); }
.chip-suggestions button.used { display: none; }
.chip-suggestions .chip-grupo { border-style: solid; border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

/* Stepper */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); height: 40px; }
.stepper button { width: 38px; height: 100%; border: 0; background: var(--surface-2); color: var(--text); font-size: 18px; font-weight: 600; display: grid; place-items: center; }
.stepper button:hover { background: var(--border); }
.stepper input { width: 52px; height: 100%; border: 0; text-align: center; font-weight: 700; font-size: 15px; -moz-appearance: textfield; background: transparent; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { box-shadow: none; outline: none; }
.stepper.stepper-sm { height: 34px; } .stepper.stepper-sm button { width: 32px; } .stepper.stepper-sm input { width: 44px; font-size: 14px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-title i { color: var(--primary); font-size: 17px; }
.card-body { padding: 18px; }
.card-footer { padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
@media (min-width: 768px) { .card-body { padding: 22px; } .card-header { padding: 18px 22px; } }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow-sm); }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; display: flex; align-items: center; gap: 6px; }
.stat-label i { color: var(--primary); font-size: 14px; }
.stat-value { font-size: clamp(15px, 4.7vw, 24px); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: 12px; color: var(--text-2); }
@media (min-width: 900px) { .stat { padding: 20px; } .stat-value { font-size: 28px; } }

/* Quick actions */
.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .quick-actions { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .quick-actions { grid-template-columns: repeat(5, 1fr); } }
.quick-action {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-weight: 600; font-size: 14px; box-shadow: var(--shadow-sm);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.quick-action:hover { text-decoration: none; border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.quick-action .qa-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; background: var(--primary-soft); color: var(--primary); }
.quick-action.qa-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.quick-action.qa-primary .qa-icon { background: rgba(255,255,255,.15); color: #fff; }
.quick-action.qa-wa .qa-icon { background: var(--wa-soft); color: var(--wa); }
.quick-action.qa-accent .qa-icon { background: var(--accent-soft); color: var(--accent); }
.quick-action small { font-weight: 400; color: var(--text-3); font-size: 12px; margin-top: -6px; }
.quick-action.qa-primary small { color: rgba(255,255,255,.7); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.row-link { cursor: pointer; }
.table .td-actions { text-align: right; white-space: nowrap; }
.table .td-actions .btn { vertical-align: middle; }
.table-clean th { background: transparent; }
.table-compact td { padding: 10px 16px; }
@media (max-width: 639px) { .table-compact th, .table-compact td { padding-left: 12px; padding-right: 12px; } }

/* Tabela empilhada no celular */
@media (max-width: 767px) {
  .table-stack thead { display: none; }
  .table-stack tr { display: block; border-bottom: 1px solid var(--border); padding: 12px 16px; }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
  .table-stack td::before { content: attr(data-label); font-size: 12px; font-weight: 600; color: var(--text-3); text-align: left; flex: none; }
  .table-stack td.td-main { display: block; text-align: left; padding-bottom: 6px; }
  .table-stack td.td-main::before { display: none; }
  .table-stack td.td-actions { justify-content: flex-end; padding-top: 8px; }
  .table-stack td.td-actions::before { display: none; }
  .table-stack tbody tr:hover { background: transparent; }
  .table-stack td.hide-mobile-cell { display: none; }
}

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); color: inherit; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.list-item .li-end { text-align: right; flex: none; }
.list-item .li-end strong { display: block; font-variant-numeric: tabular-nums; }
.list-item .li-end small { color: var(--text-3); font-size: 12px; }

/* ---------- Badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge i { font-size: 12px; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-neutral { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-2); }
.chip-sm { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 6px; }

.segmented { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; max-width: 100%; overflow-x: auto; }
.segmented a, .segmented button { height: 34px; padding: 0 14px; border-radius: 7px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: 13px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.segmented .active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented a:hover { text-decoration: none; color: var(--text); }
.segmented .count { font-size: 11px; color: var(--text-3); font-weight: 600; }

/* ---------- Avatar ---------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 14px; display: inline-grid; place-items: center; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar-sq { border-radius: 10px; }

/* ---------- Product thumbs / grid ---------- */
.thumb { width: 56px; height: 68px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); object-fit: cover; flex: none; display: grid; place-items: center; color: var(--text-3); font-size: 22px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-sm { width: 44px; height: 52px; font-size: 18px; }

/* Miniaturas sobrepostas (produtos de um pedido/nota) */
.thumb-stack { display: inline-flex; align-items: center; flex: none; vertical-align: middle; }
.thumb-stack .ts-item {
  width: 34px; height: 42px; border-radius: 7px; overflow: hidden; flex: none;
  background: var(--surface-2); color: var(--text-3); font-size: 14px; display: grid; place-items: center;
  border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border);
}
.thumb-stack .ts-item + .ts-item { margin-left: -12px; }
.thumb-stack .ts-item img { width: 100%; height: 100%; object-fit: cover; }
.thumb-stack .ts-more { font-size: 11px; font-weight: 700; color: var(--text-2); }
.list-item .thumb-stack { margin-right: 2px; }

/* Foto cadastrada cujo arquivo não está neste servidor */
.photo-missing { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px; text-align: center; font-size: 11px; font-weight: 600; color: var(--text-3); }
.photo-missing i { font-size: 20px; color: var(--warning); }

.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .product-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 1100px) { .product-grid { grid-template-columns: repeat(4, 1fr); } }
.product-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-sm); position: relative; transition: box-shadow .15s, transform .15s; }
.product-card:hover { box-shadow: var(--shadow); }
.product-card .pc-img { aspect-ratio: 9 / 16; background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); font-size: 34px; position: relative; }
.product-card .pc-img img { width: 100%; height: 100%; object-fit: cover; }
.product-card .pc-body { padding: 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product-card .pc-name { font-weight: 600; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card .pc-ref { font-size: 12px; color: var(--text-3); }
.product-card .pc-price { font-weight: 700; font-size: 15px; margin-top: auto; padding-top: 4px; }
.product-card .pc-meta { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-card .pc-status { position: absolute; top: 8px; left: 8px; }
.product-card .pc-actions { display: flex; gap: 6px; padding: 0 12px 12px; }
.product-card .pc-actions .btn { flex: 1; }
.product-card.is-inactive .pc-img img { filter: grayscale(1); opacity: .6; }

/* Photo manager */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.photo-item { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); aspect-ratio: 9 / 16; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-item .photo-tools { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; gap: 4px; padding: 6px; background: linear-gradient(to top, rgba(0,0,0,.65), transparent); }
.photo-item .photo-tools button { width: 30px; height: 30px; border-radius: 7px; border: 0; background: rgba(255,255,255,.92); color: var(--text); display: grid; place-items: center; font-size: 14px; }
.photo-item .photo-tools button:hover { background: #fff; }
.photo-item .photo-tools button.is-star { color: var(--accent); }
.photo-item .photo-badge { position: absolute; top: 6px; left: 6px; }
.photo-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 9 / 16; border: 2px dashed var(--border-strong); border-radius: 10px; color: var(--text-2); cursor: pointer; font-size: 13px; font-weight: 600; text-align: center; padding: 10px; background: var(--surface); transition: border-color .15s, color .15s; }
.photo-add:hover, .photo-add.is-drag { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.photo-add i { font-size: 26px; }
.photo-add input { display: none; }
.photo-preview { position: relative; }
.photo-preview .badge { position: absolute; top: 6px; left: 6px; }

/* ---------- Dialog ---------- */
dialog.dialog { border: 0; padding: 0; background: transparent; max-width: min(100vw - 24px, 560px); width: 100%; margin: auto; }
dialog.dialog::backdrop { background: rgba(20, 20, 18, .5); backdrop-filter: blur(2px); }
.dialog-box { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; max-height: calc(100vh - 24px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.dialog-header h3 { font-size: 16px; }
.dialog-body { padding: 20px; overflow-y: auto; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.dialog-lg { max-width: min(100vw - 24px, 760px); }
@media (max-width: 640px) {
  dialog.dialog.dialog-sheet { max-width: 100vw; margin: auto 0 0 0; }
  dialog.dialog.dialog-sheet .dialog-box { border-radius: 18px 18px 0 0; max-height: 92vh; }
  .dialog-footer { flex-direction: column-reverse; }
  .dialog-footer .btn { width: 100%; }
}

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: 12px; left: 12px; right: 12px; z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
@media (min-width: 640px) { .toasts { left: auto; right: 20px; top: 20px; width: 380px; } }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--text); color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; animation: toast-in .25s var(--ease); }
.toast i { font-size: 18px; flex: none; margin-top: 1px; }
.toast.toast-sucesso i { color: #4ADE80; }
.toast.toast-erro { background: var(--danger); }
.toast.toast-aviso i { color: #FBBF24; }
.toast .toast-close { margin-left: auto; background: transparent; border: 0; color: rgba(255,255,255,.7); padding: 0 2px; font-size: 16px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- Alerts (inline) ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); font-size: 14px; border: 1px solid transparent; }
.alert i { font-size: 18px; flex: none; margin-top: 1px; }
.alert-info { background: var(--info-soft); color: #1e3a8a; border-color: #cfdcf7; }
.alert-warning { background: var(--warning-soft); color: #7c3a05; border-color: #f7dcb8; }
.alert-danger { background: var(--danger-soft); color: #7f1d1d; border-color: #f5c6c6; }
.alert-success { background: var(--success-soft); color: #14532d; border-color: #bfe6cd; }
.alert .alert-body { flex: 1; }
.alert .alert-body strong { display: block; margin-bottom: 2px; }
.alert .alert-body a { color: inherit; font-weight: 600; text-decoration: underline; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty-state .empty-icon { width: 64px; height: 64px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; margin: 0 auto 14px; font-size: 28px; color: var(--text-3); }
.empty-state h3 { font-size: 16px; color: var(--text); margin-bottom: 4px; }
.empty-state p { font-size: 14px; max-width: 360px; margin: 0 auto 18px; }

/* ---------- Skeleton ---------- */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; color: transparent !important; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.pagination .pages { display: flex; gap: 4px; }
.pagination .pages a, .pagination .pages span { min-width: 34px; height: 34px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 13px; }
.pagination .pages a:hover { text-decoration: none; border-color: var(--primary); color: var(--primary); }
.pagination .pages .current { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Dropdown (details) ---------- */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 7px; border: 0; background: transparent; color: var(--text); font-size: 14px; font-weight: 500; text-align: left; }
.menu-list a:hover, .menu-list button:hover { background: var(--surface-2); text-decoration: none; }
.menu-list i { width: 18px; text-align: center; color: var(--text-2); }
.menu-list .danger { color: var(--danger); } .menu-list .danger i { color: var(--danger); }
.menu-list hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.menu-list.menu-left { right: auto; left: 0; }

/* ---------- Link box (compartilhar catálogo) ---------- */
.link-box { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.link-box code { flex: 1; min-width: 0; font-family: var(--font); font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Auth ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 32px 28px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-brand .brand-mark { width: 44px; height: 44px; font-size: 17px; }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card .lead { color: var(--text-2); font-size: 14px; margin-bottom: 22px; }
.auth-steps { display: flex; gap: 6px; margin-bottom: 20px; }
.auth-steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.auth-steps span.done { background: var(--primary); }

/* ---------- Order builder ---------- */
.order-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.order-layout > * { min-width: 0; }
.selected-client .grow { min-width: 0; }
.order-item > div { min-width: 0; }
.order-item .oi-name { overflow-wrap: anywhere; }
@media (max-width: 420px) {
  .selected-client { flex-wrap: wrap; }
  .selected-client .grow { flex: 1 1 calc(100% - 56px); }
  .selected-client [data-trocar-cliente] { margin-left: auto; }
  .order-item { grid-template-columns: 44px 1fr; padding: 12px; gap: 10px; }
  .order-item .thumb-cart { width: 44px; height: 54px; }
  .order-item .oi-controls { gap: 8px; }
  .order-item .oi-price .input { width: 96px; }
  .order-item .oi-subtotal { width: 100%; text-align: right; margin-left: 0; }
}
@media (min-width: 1024px) { .order-layout { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } .order-side { position: sticky; top: calc(var(--topbar-h) + 20px); } }
.order-item { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); align-items: start; }
.order-item:last-child { border-bottom: 0; }
.order-item .oi-name { font-weight: 600; font-size: 14px; }
.order-item .oi-meta { font-size: 12.5px; color: var(--text-2); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.order-item .oi-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.order-item .oi-price { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.order-item .oi-price .input { width: 110px; height: 34px; font-size: 14px; padding: 0 10px; text-align: right; }
.order-item .oi-subtotal { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.order-item .oi-remove { color: var(--text-3); }
.order-item .oi-remove:hover { color: var(--danger); }
.totals { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.totals .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.totals .row.total { font-size: 20px; font-weight: 800; padding-top: 10px; border-top: 1px solid var(--border); margin-top: 4px; }
.totals .muted { color: var(--text-2); }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 45; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 360px; overflow-y: auto; }
.search-results .list-item { padding: 10px 14px; cursor: pointer; }
.search-results .list-item:hover, .search-results .list-item.is-focus { background: var(--surface-2); }
.search-results .sr-empty { padding: 18px; text-align: center; color: var(--text-3); font-size: 14px; }
.search-results .sr-action { padding: 10px 14px; border-top: 1px solid var(--border); }
.preco-oculto { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 8px; margin: -4px -8px; border: 0; border-radius: var(--radius-sm, 8px); background: none; color: inherit; font: inherit; cursor: pointer; }
.preco-oculto:hover { background: var(--border); }
.preco-oculto strong { letter-spacing: .02em; }
.preco-oculto i { color: var(--text-3); font-size: 16px; }
.preco-ref { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.preco-ref .preco-oculto { margin: 0; min-height: 30px; font-size: 13px; }
.selected-client { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.size-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.size-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.size-cell.has-qty { border-color: var(--primary); background: var(--primary-soft); }
.size-cell .size-label { font-weight: 700; font-size: 14px; }
.option-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.option-chips label { position: relative; }
.option-chips input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.option-chips span { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-weight: 600; font-size: 14px; color: var(--text-2); }
.option-chips input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.option-chips input:focus-visible + span { box-shadow: var(--focus); }
.mobile-total-bar { position: fixed; left: 0; right: 0; bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); z-index: 35; background: var(--surface); border-top: 1px solid var(--border); padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; box-shadow: 0 -6px 20px rgba(0,0,0,.06); }
.mobile-total-bar .mt-label { font-size: 12px; color: var(--text-2); }
.mobile-total-bar .mt-value { font-size: 18px; font-weight: 800; }
@media (min-width: 1024px) { .mobile-total-bar { display: none; } }
body.has-total-bar .app-main { padding-bottom: calc(var(--bottomnav-h) + 76px + env(safe-area-inset-bottom)); }
@media (min-width: 1024px) { body.has-total-bar .app-main { padding-bottom: 0; } }

/* ---------- Order detail ---------- */
.kv { display: grid; grid-template-columns: 1fr; gap: 10px; font-size: 14px; }
@media (min-width: 640px) { .kv { grid-template-columns: repeat(2, 1fr); } }
.kv dt { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.kv dd { margin: 0; }
.kv .kv-full { grid-column: 1 / -1; }

/* ---------- Print ---------- */
@media print {
  .sidebar, .topbar, .bottom-nav, .no-print, .toasts { display: none !important; }
  .app-main { margin: 0 !important; padding: 0 !important; }
  .page { padding: 0; max-width: none; }
  body { background: #fff; }
}
@media (max-width: 360px) { .stat { padding: 12px; } .stats { gap: 10px; } }

/* ---------------- Pagamento do pedido ---------------- */
.pay-methods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pay-method { position: relative; }
.pay-method input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.pay-method span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 88px; padding: 12px 6px;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); text-align: center;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.pay-method i { font-size: 24px; color: var(--text-3); line-height: 1; margin-bottom: 4px; }
.pay-method strong { font-size: 15px; color: var(--text); }
.pay-method small { font-size: 12px; color: var(--text-3); }
.pay-method:hover span { border-color: var(--primary); }
.pay-method input:checked + span { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.pay-method input:checked + span i { color: var(--primary); }
.pay-method input:focus-visible + span { box-shadow: var(--focus); }
.option-chips .chip-sub { margin-left: 6px; font-size: 12px; font-weight: 600; opacity: .7; }
.pay-resumo { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; }
.pay-resumo .pr-linha { font-size: 15px; }
.pay-resumo .pr-sub { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.pay-resumo .pr-parcelas { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.pay-resumo .pr-parcelas li { display: flex; justify-content: space-between; gap: 12px; padding-top: 4px; border-top: 1px dashed var(--border); color: var(--text-2); font-size: 13px; }
.pay-resumo .pr-parcelas strong { font-variant-numeric: tabular-nums; color: var(--text); }
@media (max-width: 379px) { .pay-method span { min-height: 80px; } .pay-method small { display: none; } }

/* ---------------- Valor a pagar à fábrica (nota) ---------------- */
.custo-card > summary { list-style: none; cursor: pointer; }
.custo-card > summary::-webkit-details-marker { display: none; }
.custo-card > summary::after { content: '\F282'; font-family: bootstrap-icons; color: var(--text-3); margin-left: 8px; transition: transform .2s; }
.custo-card[open] > summary::after { transform: rotate(180deg); }
.custo-card .custo-total { margin-left: auto; font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.custo-lista .li-title { white-space: normal; }
.custo-lista .custo-soma { background: var(--surface-2); }
.custo-lista .custo-soma strong { font-size: 16px; }

/* ---------------- Montador de pedido: grade cor × tamanho ---------------- */
.dp-preco { display: grid; grid-template-columns: auto minmax(0, 180px); align-items: center; gap: 4px 12px; }
.dp-preco label { font-weight: 600; font-size: 14px; }
.dp-preco .preco-ref { grid-column: 2; margin-top: 0; }
.matriz-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.matriz { border-collapse: separate; border-spacing: 4px; min-width: 100%; }
.matriz th { font-size: 12px; font-weight: 700; color: var(--text-2); text-align: center; padding: 0 2px; white-space: nowrap; }
.matriz .mz-cor { text-align: left; font-size: 13px; color: var(--text); width: 84px; min-width: 84px; max-width: 84px; white-space: normal; line-height: 1.15; position: sticky; left: 0; background: var(--surface); z-index: 1; padding: 0 6px 0 0; box-shadow: 6px 0 6px -6px rgba(0,0,0,.25); }
.matriz .mz-nome { display: block; overflow-wrap: anywhere; }
.matriz thead .mz-cor { color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.matriz td { padding: 0; text-align: center; }
.mz-cel {
  width: 40px; height: 40px; padding: 0; text-align: center; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text);
}
.mz-cel:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.mz-cel.tem { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.matriz .mz-tot { min-width: 32px; font-weight: 800; font-size: 14px; color: var(--text-3); }
.matriz tr.tem .mz-tot { color: var(--text); }
.matriz .mz-grade { display: inline-flex; align-items: center; margin-top: 3px; height: 22px; padding: 0 7px; border-radius: 6px; border: 1px solid var(--primary); background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.matriz .mz-grade:active { transform: scale(.96); }

/* Carrinho: um bloco por referência com grade compacta */
.order-prod { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.order-prod:last-child { border-bottom: 0; }
.order-prod:hover { background: var(--surface-2); }
.op-head { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.op-head .thumb-cart { width: 40px; height: 54px; }
.op-info .oi-name { font-weight: 600; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.op-info .op-ref { display: inline-block; font-weight: 800; color: var(--primary); margin-right: 2px; }
.op-info .oi-meta { font-size: 13px; color: var(--text-2); margin-top: 2px; font-variant-numeric: tabular-nums; }
.op-info .oi-meta strong { color: var(--text); }
.op-acoes { display: flex; gap: 2px; }
.op-acoes .oi-remove { color: var(--text-3); }
.op-acoes .oi-remove:hover { color: var(--danger); }
.op-grade-wrap { overflow-x: auto; margin-top: 8px; }
.op-grade { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.op-grade th { font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: var(--text-3); padding: 3px 4px; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap; }
.op-grade td { padding: 3px 4px; text-align: center; border-bottom: 1px dashed var(--border); font-weight: 700; }
.op-grade tbody tr:last-child td { border-bottom: 0; }
.op-grade .cor { text-align: left; font-weight: 600; color: var(--text-2); white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.op-grade .zero { color: var(--border-strong); font-weight: 400; }
.op-grade .tot { color: var(--text); }
.op-grade .val { text-align: right; white-space: nowrap; color: var(--text-2); font-weight: 600; }
@media (max-width: 639px) {
  .order-prod { padding: 12px; }
  .mz-cel { width: 34px; height: 40px; }
  .op-grade .val, .op-grade th.val { display: none; }
  .op-grade .cor { max-width: 90px; }
}

/* ---------------- Pedidos recebidos pelo catálogo ---------------- */
.alert-primary { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.bottom-nav a { position: relative; }
.bn-badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; line-height: 1; }
.recebido-card { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.recebido-card .rc-topo { display: flex; gap: 12px; align-items: center; }
.recebido-card .rc-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 22px; flex: none; }
.recebido-card .rc-passos { margin: 12px 0 14px; padding-left: 20px; font-size: 14px; color: var(--text-2); display: grid; gap: 4px; }
.order-prod.is-sem-preco { background: color-mix(in srgb, var(--warning) 6%, transparent); }
.order-prod .sem-preco { color: var(--warning); font-weight: 700; white-space: nowrap; }
