@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800;900&display=swap");

:root {
  /* Base tokens (Productos e inventarios) */
  --bg: #f9f9f9;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #6b7280;
  --primary: #002b5b;
  --primary-soft: rgba(0, 43, 91, 0.1);
  --accent: #24a148;
  --stroke: rgba(15, 23, 42, 0.08);
  --shadow: 0 10px 24px rgba(15, 23, 42, 0.08);

  /* Extra / marca */
  --shopify-green: #95bf47;
  --shopify-ink: #212b36;
  --alegra-surface: #f4f7f9;

  /* Compat (no romper templates existentes) */
  --ink: var(--text);
  --slate: #1f2937;
  --panel-soft: #eef2f7;
  --nav-bg: var(--panel);
  --nav-border: var(--stroke);
  --chip-bg: rgba(15, 23, 42, 0.06);
  --chip-text: var(--primary);
  --black: var(--text);
  --white: #ffffff;
  --gray-bg: var(--bg);
  --gray-soft: rgba(15, 23, 42, 0.06);
  --gray-text: var(--muted);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 12.5px;
  line-height: 1.4;
}

button,
input,
select,
textarea,
option {
  font-family: inherit;
}

/* Generic tables (compact) */
.table-wrap {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  overflow: auto;
  background: var(--panel);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

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

.table thead th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 800;
  background: rgba(15, 23, 42, 0.03);
}

.table tbody tr:hover {
  background: rgba(0, 43, 91, 0.04);
}

.field-input.inline {
  width: 100%;
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

/* Admin/simple forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.form-grid .module-footer {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 920px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Mini toggle (checkbox styled) */
.toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toggle-wrap input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-mini {
  width: 44px;
  height: 22px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.1);
  border: 1px solid rgba(15, 23, 42, 0.16);
  position: relative;
  transition: 0.18s ease;
}

.toggle-mini::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  position: absolute;
  top: 2px;
  left: 2px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.26);
  transition: 0.18s ease;
}

.toggle-wrap input[type="checkbox"]:checked ~ .toggle-mini {
  background: var(--primary);
  border-color: rgba(0, 43, 91, 0.45);
}

.toggle-wrap input[type="checkbox"]:checked ~ .toggle-mini::after {
  transform: translateX(22px);
}

/* Transportadoras */
.carrier-logo {
  width: 150px;
  height: 44px;
  object-fit: contain;
  object-position: center;
  border-radius: 10px;
  background: transparent;
  border: 0;
  padding: 0;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.22s ease;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.app-shell.sidebar-collapsed .sidebar,
.app-shell.is-collapsed .sidebar {
  flex: 0 0 70px;
  width: 70px;
}

.sidebar {
  position: sticky;
  top: 0;
  flex: 0 0 220px;
  height: 100vh;
  padding: 18px 16px;
  background: var(--nav-bg);
  color: var(--text);
  border-right: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: visible;
  z-index: 50;
  transition: flex 0.22s ease, width 0.22s ease;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* Ocultar barra de scroll en Chrome/Safari/Edge */
.sidebar::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-x: visible;
  overflow-y: auto;
  padding-right: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 20px 24px 32px;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--black);
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--muted);
}

.topbar {
  position: static;
  z-index: 40;
  background: var(--panel);
  border-bottom: 1px solid var(--stroke);
}

.with-tip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.topbar-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 2px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 4px;
}

.topbar-left {
  justify-self: start;
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.topbar-logo {
  height: 58px;
  width: auto;
}

.topbar-right {
  justify-self: end;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 2px;
}

.plan-indicator {
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  max-width: min(520px, calc(100vw - 320px));
  overflow: hidden;
  color: inherit;
  text-decoration: none;
}

.plan-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  white-space: nowrap;
}

.plan-chip {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  border: 1px solid rgba(0, 43, 91, 0.18);
  background: rgba(0, 43, 91, 0.08);
  color: var(--primary);
}

.plan-metric {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

.topbar-wallet {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: #fff;
  color: var(--text);
  text-decoration: none;
  margin-left: 6px;
}

.topbar-wallet:hover {
  border-color: rgba(14, 116, 144, 0.4);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.topbar-wallet-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
}

.wallet-pill {
  font-size: 11px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.12);
  color: #0b6b5f;
}

.wallet-pill-ok {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.12);
  color: #0b6b5f;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.plan-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 12px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.plan-card-title {
  font-weight: 800;
}

.plan-card-price {
  font-size: 14px;
  color: var(--muted);
}

.plan-card-meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.plan-card-footer {
  margin-top: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
}

.billing-shell {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.billing-panel {
  padding: 14px;
}

.billing-panel .panel-header {
  align-items: flex-start;
  gap: 8px;
}

.billing-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.billing-form {
  margin-top: 10px;
}

.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.inline-actions .input {
  flex: 1 1 220px;
  min-width: 200px;
}

.billing-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.billing-actions img,
.billing-panel img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  display: inline-block;
}

.billing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.billing-panel .table-wrap {
  margin-top: 10px;
}

.billing-panel .list-group {
  margin-top: 10px;
}

.billing-recharge-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.billing-recharge-inputs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.billing-recharge-inputs .input {
  flex: 1 1 180px;
  min-width: 180px;
}

.billing-recharge-inputs .btn-primary {
  white-space: nowrap;
}

#billingRechargeStatus,
#billingLoadStatus {
  margin-top: 6px;
}

.wallet-pill-warn {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.plan-metric b {
  color: var(--text);
  font-weight: 900;
  margin-left: 6px;
}

.plan-toast {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 9999;
  max-width: min(380px, calc(100vw - 28px));
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  background: #fff;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.18);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.plan-toast.is-warn {
  border-color: rgba(0, 43, 91, 0.25);
  background: rgba(0, 43, 91, 0.08);
}

.plan-toast.is-critical {
  border-color: rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.12);
}

.plan-toast.is-blocked {
  border-color: rgba(217, 83, 79, 0.28);
  background: rgba(217, 83, 79, 0.12);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #0f172a;
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.22);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 120;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--stroke);
}

.topbar-user img {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #ffffff;
  padding: 4px;
  border: 1px solid #e1e1ea;
}

.topbar-gear {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  color: var(--text);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.topbar-gear svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.topbar-gear:hover {
  background: rgba(0, 43, 91, 0.08);
  border-color: rgba(0, 43, 91, 0.2);
  transform: translateY(-1px);
}

.topbar-notifications {
  position: relative;
  margin-left: 6px;
}

.notif-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--text);
  position: relative;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.notif-btn:hover {
  background: rgba(0, 43, 91, 0.08);
  border-color: rgba(0, 43, 91, 0.2);
  transform: translateY(-1px);
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--panel);
}

.notif-panel {
  position: absolute;
  top: 48px;
  right: 0;
  width: min(360px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: 14px;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18);
  z-index: 90;
  overflow: hidden;
}

.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--stroke);
  background: #f8fafc;
}

.notif-panel-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.notif-panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.notif-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.notif-panel-body {
  max-height: 320px;
  overflow: auto;
}

.notif-empty {
  padding: 16px 14px;
  font-size: 12px;
  color: var(--muted);
}

.notif-list {
  display: flex;
  flex-direction: column;
}

.notif-item {
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  cursor: pointer;
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.2);
  margin-top: 6px;
}

.notif-item.is-unread .notif-dot {
  background: #0ea5a4;
}

.notif-item-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
}

.notif-item-body {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.notif-item-meta {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 6px;
}

.notif-toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 130;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notif-toast {
  background: #0f172a;
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.22);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.notif-toast-title {
  font-weight: 800;
  font-size: 12px;
  margin-bottom: 2px;
}

.notif-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.notif-popup {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 140;
  width: min(320px, calc(100vw - 40px));
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.15);
  border-radius: 14px;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.22);
  padding: 12px 14px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.notif-popup.show {
  opacity: 1;
  transform: translateY(0);
}

.notif-popup-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
}

.notif-popup-body {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.notif-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 150;
}

.notif-modal.active {
  display: flex;
}

.notif-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.notif-modal-card {
  position: relative;
  width: min(620px, 92vw);
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.15);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.22);
  overflow: hidden;
  z-index: 1;
}

.notif-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--stroke);
  background: #f8fafc;
}

.notif-modal-title {
  font-size: 14px;
  font-weight: 900;
  color: var(--text);
}

.notif-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}

.notif-modal-body {
  padding: 16px 18px 20px;
  display: grid;
  gap: 18px;
}

.contact-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 16px;
}
.contact-modal.active {
  display: flex;
}
.contact-panel {
  width: min(1200px, 96vw);
  background: #fff;
  border-radius: 18px;
  border: 1px solid #e6e8f0;
  box-shadow: 0 24px 48px rgba(16, 24, 40, 0.18);
  overflow: visible;
  display: grid;
  grid-template-rows: auto 1fr;
}
.contact-panel-body {
  overflow: visible;
}
.contact-modal.mini-modal .contact-panel {
  width: min(560px, 94vw);
}

.notif-section {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
}

.notif-section-title {
  font-size: 12px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 10px;
}

.notif-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.notif-row:first-of-type {
  border-top: none;
  padding-top: 4px;
}

.notif-row-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
}

.notif-row-sub {
  font-size: 11px;
  color: var(--muted);
}

/* SVG Icon Reset */
svg {
  display: inline-block;
  vertical-align: middle;
  shape-rendering: inherit;
}

svg:not([fill]) {
  fill: none;
}

svg:not([stroke]) {
  stroke: currentColor;
}

.topbar-user .user-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
}

.topbar-user-text {
  display: flex;
  align-items: center;
  gap: 2px;
  max-width: 340px;
  overflow: hidden;
}

.topbar-user-text .user-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-chip {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(0, 43, 91, 0.08);
  border: 1px solid rgba(0, 43, 91, 0.16);
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.topbar-attention-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #334155;
}

.topbar-attention-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #94a3b8;
}

.topbar-attention-chip.active {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(22, 163, 74, 0.3);
  color: #166534;
}

.topbar-attention-chip.active .dot {
  background: #22c55e;
}

.topbar-attention-chip.inactive {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(217, 119, 6, 0.32);
  color: #92400e;
}

.topbar-attention-chip.inactive .dot {
  background: #f59e0b;
}

.topbar-user-menu {
  position: relative;
}

.topbar-user-btn {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  text-align: left;
}

.topbar-user-btn:focus-visible {
  outline: 3px solid rgba(0, 43, 91, 0.22);
  outline-offset: 2px;
}

.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.12);
  z-index: 60;
}

.user-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}

.user-menu-item:hover {
  background: rgba(15, 23, 42, 0.05);
}

.user-menu-item.danger {
  color: #b91c1c;
}

.wiz-od-grid {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 12px;
  align-items: start;
}

.wiz-od-summary {
  position: sticky;
  top: 12px;
}

.wiz-od-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(15, 23, 42, 0.03);
}

.wiz-od-row-name {
  font-weight: 800;
  color: var(--text);
  font-size: 11px;
}

.wiz-od-row-meta {
  font-weight: 800;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .wiz-od-grid {
    grid-template-columns: 1fr;
  }
  .wiz-od-summary {
    position: static;
  }
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.sidebar-toggle .toggle-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.sidebar-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.sidebar-icon.icon-expand {
  display: none;
}

.sidebar.collapsed .sidebar-icon.icon-collapse {
  display: none;
}

.sidebar.collapsed .sidebar-icon.icon-expand {
  display: inline;
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.nav-label {
  flex: 1;
}

.sidebar.collapsed .nav-label,
.sidebar.collapsed .toggle-label {
  display: none;
}

.app-shell.is-collapsed .nav-label,
.app-shell.is-collapsed .toggle-label {
  display: none;
}

.app-shell.is-collapsed .nav-submenu {
  display: none;
}

.sidebar.collapsed .sidebar-toggle {
  justify-content: flex-start;
  padding: 8px 10px;
}

.sidebar.collapsed .nav-link {
  justify-content: flex-start;
  padding: 10px 12px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-x: visible;
  overflow-y: auto;
  padding-right: 4px;
}

.nav-item-with-submenu {
  position: relative;
}

.sidebar.collapsed .nav-item-with-submenu:hover .nav-submenu {
  display: grid !important;
  position: absolute;
  left: 100%;
  top: 0;
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 8px;
  min-width: 180px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  z-index: 100;
  margin-left: 10px;
}

.sidebar.collapsed .nav-item-with-submenu:hover .nav-submenu::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 10px;
  width: 10px;
  height: 20px;
  background: transparent;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 600;
  transition: 0.2s ease;
}

.nav-link:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: rgba(0, 43, 91, 0.2);
}

.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: rgba(0, 43, 91, 0.2);
}

.nav-submenu {
  display: grid;
  gap: 4px;
  padding: 0 0 4px 22px;
  margin-top: -2px;
}
.nav-submenu.collapsed {
  display: none;
}
.nav-link-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-subtoggle {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid var(--stroke);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}
.nav-subtoggle:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.nav-sublink {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 600;
}

.nav-sublink:hover,
.nav-sublink.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: rgba(0, 43, 91, 0.2);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--stroke);
}

.logout-btn {
  width: 100%;
  text-align: left;
  background: transparent;
}

.content {
  padding: 20px 24px 32px;
}

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

.kanban-fullscreen .sidebar,
.kanban-fullscreen .topbar {
  display: none !important;
}

.kanban-fullscreen .content {
  padding: 12px;
  height: 100vh;
}

.kanban-fullscreen .wrap {
  max-width: 100%;
  height: 100vh;
}

.kanban-fullscreen .kanban-shell {
  height: 100%;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}

.kanban-fullscreen .kanban {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.kanban-fullscreen .oportunidades-sticky {
  display: none !important;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.page-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.page-meta {
  color: var(--muted);
  font-size: 11px;
}

.panel {
  background: var(--panel);
  border: 2px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.kanban-toolbar-right #smartViewSelect {
  appearance: none;
  background-color: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 12px;
  padding: 8px 36px 8px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #111827;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}

.kanban-toolbar-right #smartViewSelect:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.filters-bar label {
  font-size: 0.78rem;
  color: var(--muted);
}

.filter-group {
  min-width: 220px;
  display: grid;
  gap: 6px;
}

.filter-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.filters-bar input,
.filters-bar select {
  min-height: 34px !important;
  padding: 0 12px !important;
  border-radius: 8px !important;
  border: 1px solid var(--stroke) !important;
  background: #fff !important;
  font-size: 12px !important;
}

.filters-bar input:focus,
.filters-bar select:focus {
  outline: none;
  border-color: rgba(0, 43, 91, 0.35) !important;
  box-shadow: 0 0 0 3px rgba(0, 43, 91, 0.12) !important;
}

.filters-bar button,
.filters-bar a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 14px;
}

.table-alegra {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table-alegra thead th {
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 8px 8px !important;
  border-bottom: 1px solid var(--stroke);
  white-space: nowrap;
}

.table-alegra tbody td {
  padding: 8px 8px !important;
  border-top: 1px solid var(--stroke);
  vertical-align: middle;
}

.table-alegra tbody tr:hover {
  background: rgba(0, 43, 91, 0.04);
}

.table-alegra input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.text-muted {
  color: var(--muted);
}

.primary,
.ghost,
.btn-brand,
.btn-soft,
.btn-primary,
.btn-ghost {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 600;
  transition: 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary,
.btn-primary {
  background: #4c1d95;
  color: #fff;
  border: 1px solid #4c1d95;
}

.ghost,
.btn-ghost {
  background: #fff;
  border: 1px solid var(--stroke);
  color: #2f155f;
}

.btn-soft {
  background: #eef2f7;
  border: 1px solid var(--stroke);
  color: #2f155f;
}

.btn-brand {
  background: #4c1d95;
  color: #fff;
  border: 1px solid #4c1d95;
}

.primary:hover,
.ghost:hover,
.btn-brand:hover,
.btn-soft:hover,
.btn-primary:hover,
.btn-ghost:hover {
  transform: translateY(-1px);
}

.primary:hover,
.btn-primary:hover,
.btn-brand:hover {
  background: #3b136f;
  border-color: #3b136f;
}

.chip {
  background: var(--chip-bg);
  color: var(--primary);
  border: 1px solid var(--stroke);
}

.input,
.field-input {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

textarea.input,
textarea.field-input {
  height: auto;
  padding: 10px 14px;
  border-radius: 14px;
}

.input:focus,
.field-input:focus {
  outline: none;
  border-color: rgba(0, 43, 91, 0.35);
  box-shadow: 0 0 0 3px rgba(0, 43, 91, 0.12);
}

.multiselect {
  position: relative;
}

.multi-select {
  position: relative;
}

.multiselect-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}

.multiselect-label {
  font-weight: 600;
  color: var(--text);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.multiselect-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.multiselect-count {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid var(--stroke);
  color: var(--text);
  font-size: 10px;
}

.multiselect-caret {
  color: var(--muted);
  font-size: 0.8rem;
}

.multiselect-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 10;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 10px;
  display: none;
}

.multiselect.open .multiselect-popover {
  display: block;
}

.multiselect-search {
  width: 100%;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

.multiselect-list {
  margin-top: 8px;
  max-height: 200px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: #fff;
}

.multiselect-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: #fff;
  cursor: pointer;
  transition: 0.15s ease;
}

.multiselect-item:hover {
  border-color: rgba(0, 43, 91, 0.25);
  background: rgba(0, 43, 91, 0.04);
}

.multiselect-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.multiselect-item-name {
  font-size: 12px;
  color: var(--text);
}

.action-group {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.action-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--stroke);
}

.action-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.action-danger {
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.06);
}

.action-danger:hover {
  background: rgba(239, 68, 68, 0.10);
}

.action-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--stroke);
  background: rgba(15, 23, 42, 0.06);
  color: var(--muted);
  white-space: nowrap;
}

/* Minor helpers */
.settings-group-title {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
}

.settings-tab {
  font-size: 12px;
  font-weight: 800;
}

.action-status-fail {
  background: rgba(239, 68, 68, 0.08);
  color: rgb(185, 28, 28);
  border-color: rgba(239, 68, 68, 0.22);
}

.action-status-warn {
  background: rgba(245, 158, 11, 0.10);
  color: rgb(146, 64, 14);
  border-color: rgba(245, 158, 11, 0.22);
}

.action-status-pending {
  background: rgba(107, 114, 128, 0.08);
  color: rgba(15, 23, 42, 0.75);
  border-color: rgba(107, 114, 128, 0.18);
}

/* Settings containers (base module styles) */
.settings-group {
  border: 2px solid rgba(15, 23, 42, 0.12);
  border-radius: 16px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  background: var(--panel);
}

.settings-group-header {
  padding: 8px 10px;
  background: linear-gradient(180deg, rgba(0, 43, 91, 0.06), rgba(0, 43, 91, 0.02));
  border-bottom: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.settings-group-header h3,
.settings-group-header h4,
.panel-header h3 {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text);
}

.settings-group-body {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.panel.module {
  padding: 9px;
  gap: 6px;
  border-color: rgba(15, 23, 42, 0.16);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
}

.panel-header h1,
.panel-header h2,
.panel-header h3,
.panel-header h4 {
  margin: 0;
}

.section-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 6px 0;
  letter-spacing: 0.02em;
}

.panel[data-provider] {
  overflow: visible;
}

/* Fields / hints */
.field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.field label {
  font-size: 13px;
  font-weight: 700;
  color: #1f2937;
}

.field-hint {
  font-size: 11px;
  color: var(--muted);
}

.input.is-error,
.field-input.is-error {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.input.is-warning,
.field-input.is-warning {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

/* Toggles */
.toggle {
  width: 44px;
  height: 22px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.1);
  border: 1px solid rgba(15, 23, 42, 0.16);
  position: relative;
  cursor: pointer;
  transition: 0.18s ease;
}

.toggle::after {
  content: "";
  width: 18px;
  height: 18px;
  position: absolute;
  top: 2px;
  left: 2px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.26);
  transition: 0.18s ease;
}

.toggle.is-on {
  background: var(--primary);
  border-color: rgba(0, 43, 91, 0.45);
}

.toggle.is-on::after {
  transform: translateX(22px);
}

.toggle:focus-visible {
  outline: 2px solid rgba(14, 116, 144, 0.35);
  outline-offset: 2px;
}

/* Tooltips */
.tip {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tip-popover {
  position: fixed;
  width: min(360px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 12px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.18);
  padding: 12px;
  color: #334155;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
  z-index: 120;
}

.tip-popover .title {
  font-size: 13px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 6px;
}

/* Status chips / LED */
.status-chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.status-chip.success {
  background: rgba(11, 179, 158, 0.15);
  color: #0b6b5f;
}

.status-chip.error {
  background: rgba(217, 83, 79, 0.15);
  color: #a94442;
}

.status-chip.warning {
  background: rgba(0, 43, 91, 0.12);
  color: #0b2445;
}

.status-led {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #fca5a5;
}

.status-led.ok {
  background: var(--accent);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 220px 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--stroke);
    border-bottom: 0;
  }

  .app-shell.sidebar-collapsed,
  .app-shell.is-collapsed {
    grid-template-columns: 70px 1fr;
  }
}

@media (max-width: 720px) {
  .content {
    padding: 20px 16px 24px;
  }

  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filters-bar > * {
    width: 100%;
  }
}

.kanban-fullscreen {
  overflow: hidden;
}

.phone-input-wrap {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px;
  align-items: center;
}
.phone-input-wrap .phone-prefix {
  min-width: 160px;
}
@media (max-width: 640px) {
  .phone-input-wrap {
    grid-template-columns: 1fr;
  }
}
