:root {
  --bg: #090b10;
  --surface: #121622;
  --surface-2: #191f30;
  --surface-3: #222a40;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 196, 0, 0.32);
  --text: #f8fafc;
  --muted: #94a3b8;
  --gold: #ffc400;
  --gold-2: #ff9500;
  --ice: #38bdf8;
  --green: #10b981;
  --red: #ef4444;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 15% -5%, rgba(255, 196, 0, 0.14), transparent 38%),
              radial-gradient(circle at 88% 8%, rgba(56, 189, 248, 0.1), transparent 36%),
              var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  min-height: 100vh;
  line-height: 1.45;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* ── Topbar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(18px);
  background: rgba(9, 11, 16, 0.84);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.brand img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(255, 196, 0, 0.28);
}

.brand-title {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-sub {
  font-size: 11.5px;
  color: var(--muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-pill {
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: 0.16s ease;
  cursor: pointer;
}

.nav-pill:hover, .nav-pill.active {
  color: #090b10;
  background: var(--gold);
  border-color: var(--gold);
}

/* ── Container ── */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 16px 120px;
}

/* ── Address / Hero Strip ── */
.hero-bar {
  background: linear-gradient(135deg, rgba(255, 196, 0, 0.14), rgba(56, 189, 248, 0.08) 65%, rgba(18, 22, 34, 0.96));
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  color: var(--ice);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.hero-bar h1 {
  margin: 0 0 6px;
  font-size: clamp(22px, 4vw, 30px);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero-bar p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.location-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 11px 14px;
  background: rgba(9, 11, 16, 0.72);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: 0.15s ease;
}

.location-pill:hover {
  border-color: var(--gold);
}

.location-pill .loc-text {
  flex: 1;
  min-width: 0;
}

.location-pill strong {
  display: block;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.location-pill span {
  font-size: 12px;
  color: var(--muted);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 13px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s ease, background 0.15s ease;
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #090b10;
  box-shadow: 0 8px 24px rgba(255, 196, 0, 0.28);
}

.btn-ice {
  background: rgba(56, 189, 248, 0.16);
  color: var(--ice);
  border-color: rgba(56, 189, 248, 0.35);
}

.btn-green {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
}

.btn-red {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.36);
}

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 12.5px;
  border-radius: 10px;
}

.btn-block {
  width: 100%;
}

/* ── Cards & Layout ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.02em;
}

/* ── Distributors strip ── */
.dist-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: none;
}

.dist-strip::-webkit-scrollbar {
  display: none;
}

.dist-card {
  flex: 0 0 270px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 13px;
  cursor: pointer;
  transition: 0.15s ease;
}

.dist-card.active {
  border-color: var(--gold);
  background: linear-gradient(145deg, rgba(255, 196, 0, 0.12), var(--surface));
  box-shadow: 0 0 0 1px rgba(255, 196, 0, 0.25);
}

.dist-card.closed {
  opacity: 0.6;
}

.dist-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.badge-green {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
}

.badge-red {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

.badge-gold {
  background: rgba(255, 196, 0, 0.18);
  color: var(--gold);
}

.badge-ice {
  background: rgba(56, 189, 248, 0.18);
  color: var(--ice);
}

/* ── Search & Category Pills ── */
.search-row {
  display: flex;
  gap: 10px;
  margin: 14px 0 10px;
}

.input, select.input, textarea.input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 11px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}

.input:focus {
  border-color: var(--gold);
}

.cat-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 10px;
  scrollbar-width: none;
}

.cat-strip::-webkit-scrollbar {
  display: none;
}

.cat-chip {
  flex: 0 0 auto;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s ease;
}

.cat-chip.active {
  background: var(--gold);
  color: #090b10;
  border-color: var(--gold);
}

/* ── Product Grid ── */
.prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
}

.prod-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.prod-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 196, 0, 0.32);
}

.prod-art {
  height: 108px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  position: relative;
}

.prod-art .cold-tag {
  position: absolute;
  top: 7px;
  right: 7px;
  background: rgba(9, 11, 16, 0.78);
  color: var(--ice);
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 999px;
}

.prod-art .promo-tag {
  position: absolute;
  top: 7px;
  left: 7px;
  background: rgba(255, 196, 0, 0.92);
  color: #090b10;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 999px;
}

.prod-name {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.25;
  margin-bottom: 3px;
}

.prod-vol {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.prod-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.prod-price {
  font-size: 17px;
  font-weight: 800;
  color: var(--gold);
}

.qty-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  padding: 3px;
}

.qty-btn {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: none;
  background: var(--gold);
  color: #090b10;
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.qty-btn.minus {
  background: var(--surface-3);
  color: var(--text);
}

.qty-val {
  min-width: 20px;
  text-align: center;
  font-weight: 800;
  font-size: 13.5px;
}

/* ── Floating Cart Bar ── */
.cart-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  width: min(560px, calc(100% - 24px));
  z-index: 45;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #090b10;
  border-radius: 18px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  box-shadow: 0 18px 40px rgba(255, 149, 0, 0.35);
  cursor: pointer;
  border: none;
}

.cart-bar.hidden {
  display: none;
}

/* ── Modals & Drawers ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 10, 0.78);
  backdrop-filter: blur(8px);
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}

.modal-backdrop.center {
  align-items: center;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-sheet {
  width: min(560px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow);
}

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

.modal-head h3 {
  margin: 0;
  font-size: 18px;
}

.close-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
}

/* ── Forms & Grids ── */
.form-grid {
  display: grid;
  gap: 12px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 5px;
}

/* ── Payment Options ── */
.pay-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pay-opt {
  padding: 13px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 2px solid var(--border);
  cursor: pointer;
  text-align: left;
  transition: 0.15s ease;
}

.pay-opt.active {
  border-color: var(--gold);
  background: rgba(255, 196, 0, 0.1);
}

.pay-opt strong {
  display: block;
  font-size: 14px;
}

.pay-opt span {
  font-size: 11.5px;
  color: var(--muted);
}

/* ── Map & Tracking ── */
.map-box {
  width: 100%;
  height: 290px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0d1322;
}

.timeline {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.step-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  opacity: 0.5;
}

.step-row.done, .step-row.current {
  opacity: 1;
}

.step-row.current {
  border-color: var(--gold);
  background: rgba(255, 196, 0, 0.1);
}

.step-dot {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.step-row.done .step-dot {
  background: var(--green);
  color: #fff;
}

.step-row.current .step-dot {
  background: var(--gold);
  color: #090b10;
}

.delivery-code-box {
  background: linear-gradient(135deg, rgba(255, 196, 0, 0.16), rgba(56, 189, 248, 0.12));
  border: 1px dashed var(--gold);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
  margin: 12px 0;
}

.delivery-code-box .digits {
  font-size: 28px;
  letter-spacing: 0.25em;
  font-weight: 900;
  color: var(--gold);
}

/* ── Pix Box ── */
.pix-box {
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 16px;
  margin: 12px 0;
}

.pix-box img {
  width: 210px;
  height: 210px;
  border-radius: 14px;
  background: #fff;
  padding: 8px;
  margin: 8px auto;
  display: block;
}

.pix-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  background: #090b10;
  padding: 10px;
  border-radius: 10px;
  word-break: break-all;
  color: var(--muted);
  max-height: 76px;
  overflow: auto;
  margin: 8px 0;
}

/* ── Dashboards (Distribuidora / Entregador / Admin) ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}

.kpi-card span {
  font-size: 12px;
  color: var(--muted);
  display: block;
}

.kpi-card strong {
  font-size: 22px;
  font-weight: 800;
  color: var(--gold);
}

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

.tab-btn {
  padding: 9px 15px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--gold);
  color: #090b10;
  border-color: var(--gold);
}

.list-stack {
  display: grid;
  gap: 10px;
}

.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}

.order-card.highlight {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(255, 196, 0, 0.28);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.toggle {
  appearance: none;
  width: 48px;
  height: 27px;
  border-radius: 999px;
  background: #334155;
  position: relative;
  cursor: pointer;
  transition: 0.16s ease;
  flex-shrink: 0;
}

.toggle:checked {
  background: var(--green);
}

.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  transition: 0.16s ease;
}

.toggle:checked::after {
  transform: translateX(21px);
}

/* ── Toast ── */
.toast-wrap {
  position: fixed;
  top: 72px;
  right: 16px;
  z-index: 120;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #141b2d;
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 11px 15px;
  border-radius: 13px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
  .prod-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .topbar-inner {
    padding: 10px 12px;
  }
}
