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

:root {
  --navy:   #0f2744;
  --blue:   #1a4a8a;
  --sky:    #2d7dd2;
  --orange: #f4801a;
  --amber:  #ffb347;
  --purple: #7b2fa8;
  --purple-light: #f3e5f5;
  --light:  #f0f6ff;
  --white:  #ffffff;
  --gray1:  #e8edf5;
  --gray2:  #c5cfe0;
  --gray3:  #8898aa;
  --text:   #1e2d42;
  --shadow: 0 4px 24px rgba(15,39,68,.12);
  --radius: 14px;
}

html[data-theme="dark"] {
  --navy:   #d9e8ff;
  --blue:   #60a5fa;
  --sky:    #38bdf8;
  --orange: #fb923c;
  --amber:  #fbbf24;
  --purple: #a855f7;
  --purple-light: #2d1b45;
  --light:  #0d1726;
  --white:  #152235;
  --gray1:  #26364d;
  --gray2:  #4b5f7a;
  --gray3:  #9fb0c8;
  --text:   #dbe7f7;
  --shadow: 0 8px 26px rgba(0,0,0,.32);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--light);
  color: var(--text);
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 240px;
  height: 100vh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 4px 0 20px rgba(0,0,0,.2);
}

html[data-theme="dark"] .sidebar {
  background: #081224;
  box-shadow: 4px 0 24px rgba(0,0,0,.45);
}

.sidebar-logo {
  padding: 28px 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.logo-icon {
  width: 34px; height: 34px;
  background: transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 0;
}

.logo-icon img {
  width: 30px !important;
  height: 30px !important;
  max-width: 30px !important;
  max-height: 30px !important;
  object-fit: contain;
  display: block;
}

.logo-text { color: #fff; }
.logo-text strong { font-size: 18px; font-weight: 700; display: block; }
.logo-text span   { font-size: 11px; color: var(--gray2); }

.sidebar-nav { flex: 1; padding: 20px 0; }

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--gray3);
  padding: 0 24px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: rgba(255,255,255,.65);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .2s;
}
.nav-item:hover  { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: rgba(45,125,210,.25); border-left-color: var(--orange); }
.nav-item i      { width: 18px; text-align: center; font-size: 15px; }

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-footer p { font-size: 11px; color: var(--gray3); }

.mobile-menu-btn,
.sidebar-backdrop {
  display: none;
}

/* ── MAIN ── */
.main {
  margin-left: 240px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── TOPBAR ── */
.topbar {
  background: var(--white);
  padding: 0 32px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray1);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(15,39,68,.06);
}

html[data-theme="dark"] .topbar {
  box-shadow: 0 2px 14px rgba(0,0,0,.22);
}

.topbar-left h1 { font-size: 20px; font-weight: 700; color: var(--navy); }
.topbar-left p  { font-size: 13px; color: var(--gray3); margin-top: 1px; }

.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.badge-count {
  background: var(--orange);
  color: #fff;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
}

/* ── CONTENT ── */
.content { padding: 32px; flex: 1; }
.page { display: none; }
.page.active { display: block; }

/* ── STATS ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--gray1);
}

.stat-icon {
  width: 50px; height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.blue   { background: #dbeafe; color: var(--sky); }
.stat-icon.orange { background: #fff3e0; color: var(--orange); }
.stat-icon.green  { background: #e8f5e9; color: #43a047; }
.stat-icon.purple { background: var(--purple-light); color: var(--purple); }

.stat-info label { font-size: 12px; color: var(--gray3); font-weight: 500; }
.stat-info h3    { font-size: 22px; font-weight: 700; color: var(--navy); margin-top: 2px; }

/* ── CARD ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray1);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h2   { font-size: 16px; font-weight: 700; color: var(--navy); }
.card-header span { font-size: 13px; color: var(--gray3); }

.card-body { padding: 24px; }

/* ── FORM ── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--navy); }

.form-group input,
.form-group select,
.form-group textarea {
  border: 1.5px solid var(--gray2);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border .2s, box-shadow .2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(45,125,210,.12);
}

.search-input {
  width: 100%;
  border: 1.5px solid var(--gray2);
  border-radius: 8px;
  padding: 9px 14px 9px 34px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  outline: none;
  color: var(--text);
  background: var(--white);
  transition: border .2s, box-shadow .2s;
}
.search-input:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(45,125,210,.12);
}

/* ── VALOR RESUMO ── */
.valor-resumo {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  gap: 16px;
}

.vr-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.vr-item span   { font-size: 11px; color: rgba(255,255,255,.65); font-weight: 500; }
.vr-item strong { font-size: 18px; font-weight: 700; color: #fff; }

.vr-total strong { color: var(--amber); font-size: 22px; }

/* ── CAMISETA CARDS (lista) ── */
.cam-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--white);
  border: 1px solid var(--gray1);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 16px 10px;
  transition: all .2s;
}
.cam-card:hover { border-color: var(--purple); transform: translateY(-1px); }

.cam-color-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--gray2);
  flex-shrink: 0;
}

.cam-info { flex: 1; }
.cam-info strong { font-size: 14px; font-weight: 700; color: var(--navy); display: block; }
.cam-info span   { font-size: 12px; color: var(--gray3); }

.cam-values { text-align: right; }
.cam-values .cam-unit { font-size: 12px; color: var(--gray3); }
.cam-values .cam-total { font-size: 15px; font-weight: 700; color: var(--purple); display: block; }
.cam-values .cam-qty {
  display: inline-block;
  background: var(--purple-light);
  color: var(--purple);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}

/* ── BUTTONS ── */
.listing-body {
  padding: 0;
}

.listing-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 16px 0;
}

.listing-search {
  position: relative;
  flex: 1.5 1 260px;
  min-width: 180px;
}

.listing-search > i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray3);
  font-size: 13px;
  pointer-events: none;
}

.listing-select {
  flex: 1 1 180px;
  min-width: 150px;
  padding-left: 12px;
}

.listing-results {
  padding: 12px 0 8px;
}

.listing-results .final-card {
  margin: 0 16px 10px;
  padding: 14px 16px;
  box-shadow: none;
}

.listing-pagination {
  display: none;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--gray1);
}

.listing-pagination .btn {
  min-width: 32px;
  justify-content: center;
}

.listing-pagination .btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

.listing-pagination-ellipsis {
  color: var(--gray3);
  padding: 0 4px;
  font-size: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border: none;
  transition: all .2s;
}

.btn-primary { background: var(--sky); color: #fff; }
.btn-primary:hover { background: var(--blue); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(45,125,210,.3); }

.btn-orange { background: var(--orange); color: #fff; }
.btn-orange:hover { background: #e06b00; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(244,128,26,.3); }

.btn-purple { background: var(--purple); color: #fff; }
.btn-purple:hover { background: #5e1d82; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(123,47,168,.3); }

.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-ghost { background: var(--gray1); color: var(--gray3); }
.btn-ghost:hover { background: var(--gray2); color: var(--text); }

.btn-success { background: #e8f5e9; color: #2e7d32; }
.btn-success:hover { background: #2e7d32; color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-sale-finish {
  white-space: nowrap;
}

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }

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

thead tr { background: var(--light); }
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--gray3);
  border-bottom: 2px solid var(--gray1);
}

tbody tr { border-bottom: 1px solid var(--gray1); transition: background .15s; }
tbody tr:hover { background: #f8fbff; }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 14px 16px; font-size: 14px; color: var(--text); }

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.tag-blue   { background: #dbeafe; color: #1e40af; }
.tag-orange { background: #fff3e0; color: #e65100; }
.tag-green  { background: #e8f5e9; color: #1b5e20; }
.tag-gray   { background: var(--gray1); color: var(--gray3); }
.tag-purple { background: var(--purple-light); color: var(--purple); }

.copy-sku {
  border: 0;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  vertical-align: middle;
  transition: transform .15s, filter .15s, box-shadow .15s;
}
.copy-sku:hover { filter: brightness(.96); transform: translateY(-1px); box-shadow: 0 2px 7px rgba(30, 64, 175, .18); }
.copy-sku:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.copy-sku-icon { font-size: 10px; opacity: .75; }

/* ── LAYOUT ── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

/* ── BUILDER TABS ── */
.builder-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray1);
  padding: 0 24px;
}

.builder-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  color: var(--gray3);
  transition: all .2s;
}
.builder-tab:hover { color: var(--navy); }
.builder-tab.active { color: var(--sky); border-bottom-color: var(--sky); }

.builder-tab-content { }

/* ── BUILDER AREA ── */
.builder-area {
  border: 2px dashed var(--gray2);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 180px;
  background: #fafcff;
}

.builder-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  gap: 10px;
  color: var(--gray2);
}
.builder-empty i { font-size: 36px; }
.builder-empty p { font-size: 13px; }

.builder-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--gray1);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.builder-item-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.builder-item-icon.shirt { background: var(--purple-light); color: var(--purple); }
.builder-item-icon.box   { background: var(--light); color: var(--sky); }

.builder-item-info { flex: 1; }
.builder-item-info strong { font-size: 14px; display: block; color: var(--navy); }
.builder-item-info span  { font-size: 12px; color: var(--gray3); }

.qty-control { display: flex; align-items: center; gap: 8px; }

.qty-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1.5px solid var(--gray2);
  background: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  transition: all .15s;
}
.qty-btn:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
.qty-val { width: 36px; text-align: center; font-size: 14px; font-weight: 700; color: var(--navy); }

.item-cost {
  font-size: 13px;
  font-weight: 600;
  color: var(--orange);
  min-width: 80px;
  text-align: right;
}

/* ── COST SUMMARY ── */
.cost-summary {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  border-radius: var(--radius);
  padding: 24px;
  color: #fff;
  margin-top: 20px;
}

.cs-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.cs-row:last-child { border-bottom: none; }

.cs-row-total {
  padding-top: 12px;
  margin-top: 4px;
  font-size: 16px;
  font-weight: 700;
}

.cs-total { font-size: 24px; font-weight: 700; color: var(--amber); }

/* ── FINAL CARDS ── */
.final-card {
  background: var(--white);
  border: 1px solid var(--gray1);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: all .2s;
}
.final-card:hover { border-color: var(--sky); transform: translateY(-2px); }

.final-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.final-card-header h3 { font-size: 16px; font-weight: 700; color: var(--navy); }

.total-badge {
  background: linear-gradient(135deg, var(--orange), var(--amber));
  color: #fff;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.final-card-items { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.final-card-item-tag {
  background: var(--light);
  border: 1px solid var(--gray2);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text);
}

.final-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--gray3);
}

.sale-stock-alert {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fff1f2;
  color: #991b1b;
  font-size: 13px;
  line-height: 1.45;
}

.sale-stock-alert strong {
  color: #7f1d1d;
}

/* ── EMPTY STATE ── */
.pricing-layout {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
}

.pricing-extra-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.pricing-add-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 160px auto;
  gap: 12px;
  align-items: end;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--gray1);
}

.pricing-custom-costs {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.pricing-custom-cost {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--gray1);
  border-radius: 10px;
  background: var(--light);
}

.pricing-custom-cost strong {
  display: block;
  font-size: 13px;
  color: var(--navy);
}

.pricing-custom-cost span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--gray3);
}

.pricing-summary {
  margin-top: 0;
}

.pricing-save-btn {
  width: 100%;
  justify-content: center;
}

.pricing-right-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pricing-result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.pricing-metric-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--gray1);
  background: var(--white);
  box-shadow: var(--shadow);
  min-height: 112px;
}

.pricing-result-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e8f5e9;
  color: #2e7d32;
  flex-shrink: 0;
}

.pricing-result-icon-percent {
  background: #e0f2fe;
  color: var(--sky);
}

.pricing-metric-card span,
.pricing-metric-card small {
  display: block;
  font-size: 12px;
  color: var(--gray3);
  line-height: 1.35;
}

.pricing-metric-card strong {
  display: block;
  margin: 4px 0;
  color: #2e7d32;
  font-size: 24px;
  line-height: 1.1;
}

.pricing-metric-card:not(.pricing-metric-profit) strong {
  color: var(--sky);
}

.pricing-selected-product h3 {
  font-size: 16px;
  color: var(--navy);
  margin-bottom: 6px;
}

.pricing-selected-product p {
  font-size: 13px;
  color: var(--gray3);
  margin-bottom: 14px;
}

.pricing-mini-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--light);
  border: 1px solid var(--gray1);
  margin-bottom: 14px;
}

.pricing-mini-total span {
  color: var(--gray3);
  font-size: 13px;
}

.pricing-mini-total strong {
  color: var(--orange);
  font-size: 18px;
}

.pricing-saved-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.pricing-saved-metrics span {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--gray1);
  background: var(--light);
  color: var(--gray3);
  font-size: 12px;
}

.pricing-saved-metrics strong {
  display: block;
  color: var(--navy);
  font-size: 15px;
  margin-bottom: 2px;
}

.pricing-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.empty-state { text-align: center; padding: 60px 20px; color: var(--gray3); }
.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: .4; display: block; }
.empty-state p { font-size: 14px; }

/* ── TOAST ── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--navy);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn .3s ease;
  border-left: 4px solid var(--orange);
}
.toast.success { border-left-color: #43a047; }
.toast.error   { border-left-color: #e53935; }

@keyframes slideIn {
  from { transform: translateX(60px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: popIn .2s ease;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes popIn {
  from { transform: scale(.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.modal h2 { font-size: 18px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.modal p  { font-size: 14px; color: var(--gray3); margin-bottom: 16px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }

.select-action-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.select-action-row select {
  flex: 1;
  min-width: 0;
}

.btn-icon-option {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid var(--gray1);
  border-radius: 8px;
  background: var(--white);
  color: var(--purple);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: .2s ease;
}

.btn-icon-option:hover {
  background: var(--light);
  border-color: var(--purple);
}

.option-manager-row {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 16px;
}

.btn-options {
  min-height: 42px;
}

.option-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.option-tab {
  min-height: 42px;
  border: 1px solid var(--gray1);
  border-radius: 8px;
  background: var(--white);
  color: var(--gray3);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: .2s ease;
}

.option-tab.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

/* ── DETAIL TABLE ── */
.detail-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.detail-table th {
  background: var(--light);
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray3);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.detail-table td { padding: 10px 12px; border-bottom: 1px solid var(--gray1); color: var(--text); }
.detail-table tr:last-child td { border-bottom: none; }

.detail-total {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  border-radius: 10px;
  padding: 16px 20px;
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
}
.detail-total span:first-child { font-size: 14px; font-weight: 600; }
.detail-total span:last-child  { font-size: 22px; font-weight: 700; color: var(--amber); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--gray2); border-radius: 10px; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .pricing-layout { grid-template-columns: 1fr; }
  .pricing-add-row { grid-template-columns: 1fr; }
  .pricing-result-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .sidebar {
    top: 0;
    left: 0;
    width: min(82vw, 300px);
    height: 100vh;
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform .24s ease;
    box-shadow: 12px 0 34px rgba(0,0,0,.35);
    border-top: 0;
    z-index: 220;
  }

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

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 210;
    display: block;
    background: rgba(0,0,0,.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }

  body.mobile-menu-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  body.mobile-menu-open {
    overflow: hidden;
  }

  .sidebar-logo {
    display: flex;
    padding: 22px 20px 16px;
  }

  .logo-text,
  .nav-item span,
  .nav-label,
  .sidebar-footer {
    display: block;
  }

  .sidebar-nav {
    flex: 1;
    display: block;
    padding: 14px 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-item {
    min-height: 48px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 22px;
    border-left: 3px solid transparent;
    border-top: 0;
    border-radius: 0;
    font-size: 14px;
    line-height: 1.25;
    text-align: left;
  }

  .nav-item.active {
    border-left-color: var(--orange);
  }

  .nav-item i {
    width: 18px;
    font-size: 15px;
  }

  .nav-item span {
    display: block;
    max-width: 100%;
    white-space: normal;
  }

  .sidebar-footer {
    padding: 14px 20px 20px;
  }

  .main {
    margin-left: 0;
    min-width: 0;
  }

  .topbar {
    height: auto;
    min-height: 68px;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 14px;
    flex-wrap: wrap;
  }

  .topbar-left {
    order: 1;
    min-width: 0;
    flex: 1 1 130px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    column-gap: 10px;
    align-items: center;
  }

  .topbar-left h1 {
    grid-column: 2;
    font-size: 18px;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  .topbar-left p {
    grid-column: 2;
    font-size: 12px;
    line-height: 1.35;
  }

  .mobile-menu-btn {
    grid-row: 1 / span 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--gray1);
    border-radius: 10px;
    background: var(--white);
    color: var(--navy);
    box-shadow: var(--shadow);
    cursor: pointer;
    font-size: 18px;
  }

  .topbar-right {
    display: contents;
  }

  .badge-count {
    order: 3;
    flex: 1 1 96px;
    min-width: 0;
    text-align: center;
    padding: 6px 8px;
    font-size: 11px;
    line-height: 1.2;
    white-space: normal;
  }

  .topbar-user {
    order: 2;
    width: auto;
    flex: 0 0 auto;
    margin-left: 0;
    padding-left: 10px;
    padding-top: 0;
    border-left: 1px solid var(--gray1);
    border-top: 0;
    justify-content: flex-end;
  }

  .content {
    width: 100%;
    min-width: 0;
    padding: 14px;
  }

  .stats-row {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 18px;
  }

  .stat-card {
    padding: 16px;
  }

  .card {
    width: 100%;
    max-width: 100%;
  }

  .card-header {
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    flex-wrap: wrap;
  }

  .card-body {
    padding: 16px;
  }

  .form-grid,
  .pricing-extra-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .form-group input,
  .form-group select,
  .form-group textarea,
  .search-input {
    min-height: 44px;
    width: 100%;
    font-size: 16px;
  }

  .btn,
  .btn-sm,
  .btn-login,
  .btn-theme,
  .btn-profile,
  .btn-logout,
  .qty-btn,
  .toggle-pass {
    min-height: 44px;
    min-width: 44px;
  }

  .btn {
    max-width: 100%;
    justify-content: center;
    white-space: normal;
    line-height: 1.25;
    text-align: center;
  }

  .btn-sm {
    padding: 9px 12px;
    font-size: 12px;
  }

  .card-body > div[style*="display:flex"][style*="gap"],
  .content div[style*="display:flex"][style*="gap:10px"],
  .content div[style*="display:flex"][style*="gap:12px"] {
    flex-wrap: wrap;
  }

  .card-body > div[style*="display:flex"][style*="gap"] > .btn,
  .content div[style*="display:flex"][style*="gap:10px"] > .btn,
  .content div[style*="display:flex"][style*="gap:12px"] > .btn {
    flex: 1 1 160px;
  }

  .valor-resumo,
  .detail-total {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .builder-tabs {
    padding: 0 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .builder-tab {
    flex: 1 0 130px;
    justify-content: center;
    padding: 12px 10px;
    white-space: nowrap;
  }

  .builder-area {
    padding: 14px;
  }

  .builder-item {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .builder-item-info {
    min-width: 0;
    flex: 1 1 calc(100% - 52px);
  }

  .builder-item-info strong,
  .builder-item-info span {
    overflow-wrap: anywhere;
  }

  .qty-control {
    order: 3;
  }

  .item-cost {
    order: 4;
    min-width: 0;
    flex: 1 1 110px;
    text-align: right;
    padding-top: 8px;
  }

  .builder-item > .btn-danger {
    order: 5;
    margin-left: auto;
  }

  .cam-card {
    margin: 0 12px 10px;
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 14px;
  }

  .cam-info {
    min-width: 0;
    flex: 1 1 calc(100% - 52px);
  }

  .cam-info strong,
  .cam-info span {
    overflow-wrap: anywhere;
  }

  .cam-values {
    flex: 1 1 100%;
    text-align: left;
    padding-left: 50px;
  }

  .cam-card > div[style*="flex-direction:column"] {
    flex-direction: row !important;
    width: 100%;
    padding-left: 50px;
  }

  .cam-card > div[style*="flex-direction:column"] .btn {
    flex: 1 1 0;
  }

  .listing-toolbar {
    padding: 12px 12px 0;
  }

  .card-body.listing-body {
    padding: 0;
  }

  .listing-search,
  .listing-select {
    flex-basis: 100%;
    min-width: 0;
  }

  .listing-results .final-card {
    margin: 0 12px 10px;
  }

  .listing-pagination {
    flex-wrap: wrap;
    padding: 12px;
  }

  .final-card {
    padding: 16px;
  }

  .final-card-header,
  .final-card-footer,
  .pricing-custom-cost,
  .pricing-mini-total {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .final-card-header h3 {
    overflow-wrap: anywhere;
  }

  .total-badge {
    align-self: flex-start;
    white-space: normal;
  }

  .final-card-footer > div[style*="display:flex"] {
    width: 100%;
    flex-wrap: wrap;
  }

  .final-card-footer .btn {
    flex: 1 1 120px;
  }

  .final-card-item-tag {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .pricing-add-row {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .pricing-metric-card {
    min-height: 0;
    padding: 16px;
  }

  .pricing-metric-card strong {
    font-size: 21px;
    overflow-wrap: anywhere;
  }

  .cost-summary {
    padding: 18px;
  }

  .cs-row {
    align-items: flex-start;
    gap: 12px;
  }

  .cs-row span:last-child {
    text-align: right;
    overflow-wrap: anywhere;
  }

  .table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table,
  .detail-table {
    min-width: 640px;
  }

  .modal-overlay {
    padding: 14px;
    align-items: flex-start;
    overflow-y: auto;
  }

  .modal {
    max-width: 100% !important;
    padding: 22px 16px;
    margin: auto 0;
  }

  .modal-actions {
    flex-wrap: wrap;
  }

  .modal-actions .btn {
    flex: 1 1 140px;
  }

  .toast-container {
    left: 14px;
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .toast {
    width: 100%;
    padding: 12px 14px;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 12px;
  }

  .badge-count {
    flex: 1 1 calc(33.333% - 8px);
    font-size: 10px;
  }

  .topbar-user {
    justify-content: space-between;
  }

  .topbar-avatar {
    display: none;
  }

  .content {
    padding: 10px;
  }

  .card-header,
  .card-body {
    padding: 14px;
  }

  .stat-card {
    gap: 12px;
  }

  .stat-icon {
    width: 44px;
    height: 44px;
  }

  .stat-info h3 {
    font-size: 20px;
  }

  .cam-values,
  .cam-card > div[style*="flex-direction:column"] {
    padding-left: 0;
  }

  .login-card {
    width: calc(100% - 24px);
  }
}

/* ══════════════════════════════════════════════════════
   TELA DE LOGIN
══════════════════════════════════════════════════════ */

#login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #071226;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#login-screen.hidden {
  pointer-events: none;
  animation: loginFadeOut .45s ease forwards;
}

@keyframes loginFadeOut {
  to { opacity: 0; transform: scale(1.04); }
}

/* Orbs de fundo animados */
.login-bg-orbs {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .4;
  animation: orbFloat 9s ease-in-out infinite alternate;
}
.orb1 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, var(--sky), transparent 70%);
  top: -160px; left: -120px;
}
.orb2 {
  width: 380px; height: 380px;
  background: radial-gradient(circle, var(--orange), transparent 70%);
  bottom: -80px; right: -80px;
  animation-duration: 11s;
  animation-delay: -4s;
}
.orb3 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, #7c3aed, transparent 70%);
  top: 40%; right: 20%;
  animation-duration: 7s;
  animation-delay: -2s;
  opacity: .22;
}

@keyframes orbFloat {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(28px, 18px) scale(1.07); }
}

/* Card central */
.login-card {
  position: relative;
  z-index: 1;
  background: rgba(8, 18, 36, .72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 24px;
  padding: 44px 48px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, .45);
  animation: loginCardIn .5s cubic-bezier(.34, 1.3, .64, 1) both;
}

html[data-theme="light"] #login-screen {
  background: #10233f;
}

html[data-theme="light"] .login-card {
  background: rgba(15, 39, 68, .72);
}

@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(30px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 48px; height: 48px;
  background: rgba(255, 255, 255, .95);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .28);
  flex-shrink: 0;
  overflow: hidden;
  padding: 6px;
}

.login-logo-icon img {
  width: 36px !important;
  height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  object-fit: contain;
  display: block;
}

.login-logo strong {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.login-logo span {
  font-size: 12px;
  color: rgba(255, 255, 255, .5);
}

.login-title {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.login-sub {
  font-size: 14px;
  color: rgba(255, 255, 255, .5);
  margin-bottom: 28px;
}

/* Mensagem de erro */
.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(239, 68, 68, .15);
  border: 1px solid rgba(239, 68, 68, .4);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  color: #fca5a5;
  margin-bottom: 20px;
  animation: shakeErr .35s ease;
}

@keyframes shakeErr {
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-8px); }
  40%  { transform: translateX(8px); }
  60%  { transform: translateX(-5px); }
  80%  { transform: translateX(5px); }
}

/* Formulário */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-field label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, .7);
  display: flex;
  align-items: center;
  gap: 6px;
}

.login-field input {
  width: 100%;
  background: rgba(255, 255, 255, .08);
  border: 1.5px solid rgba(255, 255, 255, .14);
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  color: #fff;
  outline: none;
  transition: border .2s, box-shadow .2s, background .2s;
}

.login-field input::placeholder { color: rgba(255, 255, 255, .3); }

.login-field input:focus {
  border-color: var(--sky);
  background: rgba(255, 255, 255, .12);
  box-shadow: 0 0 0 3px rgba(45, 125, 210, .25);
}

/* Wrap campo senha */
.login-pass-wrap { position: relative; }
.login-pass-wrap input { padding-right: 48px; }

.toggle-pass {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, .38);
  font-size: 15px;
  padding: 4px;
  transition: color .2s;
  line-height: 1;
}
.toggle-pass:hover { color: rgba(255, 255, 255, .85); }

/* Botão Entrar */
.btn-login {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--sky), var(--blue));
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  margin-top: 4px;
  transition: all .2s;
  box-shadow: 0 6px 20px rgba(45, 125, 210, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-login:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(45, 125, 210, .5);
}
.btn-login:active:not(:disabled) { transform: translateY(0); }
.btn-login:disabled { opacity: .65; cursor: not-allowed; }

/* Hint de credenciais */
.login-hint {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, .3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.login-hint strong { color: rgba(255, 255, 255, .5); }

/* ── Topbar: usuário + logout ── */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--gray1);
}

.topbar-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--sky), var(--blue));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}

.topbar-username {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}

.btn-theme,
.btn-profile,
.btn-logout {
  width: 32px; height: 32px;
  background: var(--gray1);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray3);
  font-size: 13px;
  transition: all .2s;
}
.btn-theme:hover { background: #e0f2fe; color: var(--sky); }
.btn-profile:hover { background: #ede9fe; color: var(--purple); }
.btn-logout:hover { background: #fee2e2; color: #dc2626; }

/* Responsivo login */
@media (max-width: 480px) {
  .login-card { padding: 32px 20px; border-radius: 16px; }
  .login-title { font-size: 22px; }
  .topbar-user {
    width: 100%;
    padding-left: 0;
    border-left: 0;
    justify-content: flex-end;
  }
  .topbar-left p { display: none; }
  .topbar-avatar { display: none; }
  .topbar-username { display: none; }
  .badge-count {
    flex: 1 1 calc(33.333% - 8px);
    font-size: 10px;
  }
}

/* Dark theme */
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .card,
html[data-theme="dark"] .cam-card,
html[data-theme="dark"] .builder-item,
html[data-theme="dark"] .qty-control,
html[data-theme="dark"] .final-card,
html[data-theme="dark"] .pricing-metric-card,
html[data-theme="dark"] .pricing-custom-cost,
html[data-theme="dark"] .modal {
  background: var(--white);
  border-color: var(--gray1);
}

html[data-theme="dark"] .form-group input,
html[data-theme="dark"] .form-group select,
html[data-theme="dark"] .form-group textarea,
html[data-theme="dark"] .search-input {
  background: #101b2d;
  color: var(--text);
  border-color: var(--gray1);
}

html[data-theme="dark"] .form-group input::placeholder,
html[data-theme="dark"] .form-group textarea::placeholder,
html[data-theme="dark"] .search-input::placeholder {
  color: #64748b;
}

html[data-theme="dark"] thead tr,
html[data-theme="dark"] .final-card-item-tag,
html[data-theme="dark"] .pricing-saved-metrics span,
html[data-theme="dark"] .pricing-mini-total,
html[data-theme="dark"] .builder-item-icon.box {
  background: #101b2d;
}

html[data-theme="dark"] tbody tr:hover {
  background: #101b2d;
}

html[data-theme="dark"] .btn-theme,
html[data-theme="dark"] .btn-profile,
html[data-theme="dark"] .btn-logout,
html[data-theme="dark"] .btn-icon-option,
html[data-theme="dark"] .option-tab,
html[data-theme="dark"] .btn-ghost {
  background: #101b2d;
  color: var(--gray3);
}

html[data-theme="dark"] .btn-theme:hover {
  background: #173149;
  color: #7dd3fc;
}

html[data-theme="dark"] .btn-profile:hover {
  background: #2d1b45;
  color: #c084fc;
}

html[data-theme="dark"] .btn-logout:hover {
  background: #3b1720;
  color: #fb7185;
}

html[data-theme="dark"] .btn-ghost:hover {
  background: #23344d;
  color: #fff;
}

html[data-theme="dark"] .btn-icon-option:hover,
html[data-theme="dark"] .option-tab:hover {
  background: #23344d;
}

html[data-theme="dark"] .option-tab.active {
  background: var(--purple);
  color: #fff;
}

html[data-theme="dark"] .btn-danger {
  background: #3b1720;
  color: #fb7185;
}

html[data-theme="dark"] .btn-success {
  background: #14351f;
  color: #86efac;
}

html[data-theme="dark"] .sale-stock-alert {
  background: #3b1720;
  border-color: #7f1d1d;
  color: #fecdd3;
}

html[data-theme="dark"] .sale-stock-alert strong {
  color: #fecaca;
}

html[data-theme="dark"] .tag-gray {
  background: #23344d;
  color: #cbd5e1;
}

html[data-theme="dark"] .empty-state {
  color: var(--gray3);
}

@media (max-width: 520px) {
  .option-tabs {
    grid-template-columns: 1fr;
  }

  .select-action-row {
    gap: 8px;
  }
}
