/* ============================================================
   AFE UI v2  –  Panel design system
   Loaded AFTER afe-ui.css  ·  Overrides & extends
   ============================================================ */

/* ---- Design tokens (panel-scoped) ---- */
:root {
  --afe2-sidebar-w: 280px;
  --afe2-topbar-h: 72px;
  --afe2-radius: 14px;
  --afe2-radius-lg: 20px;
  --afe2-radius-xl: 26px;
  --afe2-radius-pill: 999px;
  --afe2-shadow-xs: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --afe2-shadow-sm: 0 4px 12px rgba(15,23,42,.07), 0 2px 4px rgba(15,23,42,.04);
  --afe2-shadow-md: 0 8px 24px rgba(15,23,42,.08), 0 4px 8px rgba(15,23,42,.04);
  --afe2-shadow-lg: 0 16px 48px rgba(15,23,42,.12), 0 8px 16px rgba(15,23,42,.06);
  --afe2-border: rgba(148,163,184,.18);
  --afe2-border-strong: rgba(100,116,139,.22);
  --afe2-text: #0f172a;
  --afe2-text-soft: #475569;
  --afe2-text-muted: #64748b;
  --afe2-bg: #f3f6fb;
  --afe2-surface: #fff;
  --afe2-primary: var(--afe-accent, #2563eb);
  --afe2-primary-rgb: 37, 99, 235;
  --afe2-success: #16a34a;
  --afe2-warning: #d97706;
  --afe2-danger: #dc2626;
  --afe2-info: #0ea5e9;

  /* sidebar tokens */
  --afe2-sb-bg-from: #0d1525;
  --afe2-sb-bg-to: #111827;
  --afe2-sb-text: rgba(255,255,255,.78);
  --afe2-sb-text-muted: rgba(255,255,255,.4);
  --afe2-sb-active-from: rgba(var(--afe2-primary-rgb), .22);
  --afe2-sb-active-to: rgba(var(--afe2-primary-rgb), .08);
  --afe2-sb-active-border: rgba(96,165,250,.35);
  --afe2-sb-hover: rgba(255,255,255,.055);
}


/* ============================================================
   PANEL SHELL
   ============================================================ */
.afe-shell.afe-panel-shell,
.afe-panel-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}


/* ============================================================
   SIDEBAR
   ============================================================ */
.afe-sidebar,
.afe-panel-sidebar {
  position: sticky;
  top: 0;
  flex: 0 0 var(--afe2-sidebar-w);
  width: var(--afe2-sidebar-w);
  min-height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
  background: linear-gradient(168deg, var(--afe2-sb-bg-from) 0%, var(--afe2-sb-bg-to) 100%);
  border-right: 1px solid rgba(255,255,255,.04);
  box-shadow: 1px 0 0 rgba(255,255,255,.03), 20px 0 60px rgba(2,6,23,.22);
  color: var(--afe2-sb-text);
  z-index: 1020;
}

.afe-sidebar::-webkit-scrollbar { width: 4px; }
.afe-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.1);
  border-radius: 99px;
}


/* ---- Brand area ---- */
.afe-brand {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: 1.375rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.055);
  margin-bottom: .25rem;
}

.afe-brand__logo {
  flex-shrink: 0;
  width: 2.375rem;
  height: 2.375rem;
  border-radius: 12px;
  background: linear-gradient(135deg,
    rgba(var(--afe2-primary-rgb), .9) 0%,
    rgba(var(--afe2-primary-rgb), .6) 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 8px 20px rgba(var(--afe2-primary-rgb), .38),
              inset 0 1px 0 rgba(255,255,255,.18);
}

.afe-brand__logo svg,
.afe-brand__logo i { width: 18px; height: 18px; }

.afe-brand__title {
  font-size: .9375rem;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.afe-brand__subtitle {
  font-size: .75rem;
  font-weight: 500;
  color: var(--afe2-sb-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}


/* ---- Sidebar sections ---- */
.afe-sidebar__section {
  padding: .625rem 1rem 0;
}

.afe-sidebar__label {
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--afe2-sb-text-muted);
  padding: .75rem .75rem .4rem;
}


/* ---- Nav items ---- */
.afe-nav {
  display: grid;
  gap: 2px;
}

.afe-nav__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 44px;
  padding: .625rem .75rem;
  border-radius: var(--afe2-radius);
  color: var(--afe2-sb-text);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 600;
  letter-spacing: -.005em;
  transition: background .16s ease, color .16s ease, transform .16s ease;
  -webkit-tap-highlight-color: transparent;
}

.afe-nav__item:hover {
  background: var(--afe2-sb-hover);
  color: #fff;
  transform: translateX(2px);
}

.afe-nav__item.is-active {
  background: linear-gradient(90deg,
    var(--afe2-sb-active-from),
    var(--afe2-sb-active-to));
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--afe2-sb-active-border);
}

/* Left accent bar on active */
.afe-nav__item.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: rgba(var(--afe2-primary-rgb), .9);
  box-shadow: 0 0 8px rgba(var(--afe2-primary-rgb), .6);
}

.afe-nav__icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: .72;
  transition: opacity .16s ease;
}

.afe-nav__item:hover .afe-nav__icon,
.afe-nav__item.is-active .afe-nav__icon { opacity: 1; }

.afe-nav__icon svg,
.afe-nav__icon i { width: 16px; height: 16px; }

.afe-nav__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.afe-nav__badge {
  flex-shrink: 0;
  min-width: 1.375rem;
  height: 1.375rem;
  padding: 0 .4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--afe2-radius-pill);
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.85);
  font-size: .6875rem;
  font-weight: 700;
}


/* ---- Sidebar footer ---- */
.afe-sidebar__footer {
  margin-top: auto;
  padding: .875rem 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.055);
}

.afe-sidebar__helper {
  padding: .875rem 1rem;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--afe2-radius);
}

.afe-sidebar__helper + .afe-sidebar__helper {
  margin-top: .625rem;
}

.afe-sidebar__helper-title {
  font-size: .75rem;
  font-weight: 700;
  color: rgba(255,255,255,.7);
  margin-bottom: .3rem;
}

.afe-sidebar__helper-copy {
  font-size: .75rem;
  line-height: 1.55;
  color: rgba(255,255,255,.42);
}


/* ============================================================
   TOPBAR
   ============================================================ */
.afe-topbar {
  position: sticky;
  top: 0;
  z-index: 1040;
  background: rgba(243,246,251,.94);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--afe2-border);
  box-shadow: 0 1px 0 rgba(255,255,255,.8), 0 2px 8px rgba(15,23,42,.04);
}

.afe-topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--afe2-topbar-h);
  padding: .875rem 1.5rem;
  flex-wrap: wrap;
}

.afe-topbar__title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 800;
  color: #0b1220;
  line-height: 1.25;
  letter-spacing: -.02em;
}

.afe-topbar__subtitle {
  margin: .2rem 0 0;
  font-size: .8125rem;
  color: var(--afe2-text-muted);
  line-height: 1.4;
}

.afe-topbar__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}

/* Status chip */
.afe-topbar__chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  height: 34px;
  padding: 0 .75rem;
  border-radius: var(--afe2-radius-pill);
  background: rgba(255,255,255,.9);
  border: 1px solid var(--afe2-border-strong);
  color: var(--afe2-text-soft);
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: var(--afe2-shadow-xs);
}

.afe-topbar__chip svg,
.afe-topbar__chip i {
  width: 14px;
  height: 14px;
  opacity: .7;
}


/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.afe-panel-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.afe-main {
  flex: 1;
  padding: 1.5rem !important;
  min-width: 0;
}


/* ============================================================
   PAGE HEADER
   ============================================================ */
.afe-page__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.afe-page__title {
  margin: 0;
  font-size: clamp(1.375rem, 1rem + 1vw, 1.875rem);
  font-weight: 800;
  color: #0b1220;
  letter-spacing: -.025em;
  line-height: 1.2;
}

.afe-page__subtitle {
  margin: .35rem 0 0;
  color: var(--afe2-text-muted);
  font-size: .9375rem;
  line-height: 1.55;
  max-width: 680px;
}


/* ============================================================
   CARDS
   ============================================================ */
.afe-card {
  background: var(--afe2-surface);
  border: 1px solid rgba(203,213,225,.65);
  border-radius: var(--afe2-radius-lg);
  box-shadow: var(--afe2-shadow-sm);
  overflow: hidden;
}

.afe-card--soft {
  background: linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(248,250,252,.96) 100%);
}

.afe-card__header {
  padding: 1.125rem 1.25rem;
  border-bottom: 1px solid rgba(226,232,240,.85);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.afe-card__title {
  margin: 0;
  font-size: .9375rem;
  font-weight: 800;
  color: #0f172a;
}

.afe-card__subtitle {
  margin: .25rem 0 0;
  color: var(--afe2-text-muted);
  font-size: .875rem;
}

.afe-card__body { padding: 1.25rem; }

.afe-card__footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(226,232,240,.85);
}


/* ============================================================
   KPI / METRIC CARDS
   ============================================================ */
.afe-kpi {
  position: relative;
  overflow: hidden;
  background: var(--afe2-surface);
  border: 1px solid rgba(203,213,225,.65);
  border-radius: var(--afe2-radius-lg);
  box-shadow: var(--afe2-shadow-sm);
  padding: 1.375rem 1.375rem 1.25rem;
  transition: box-shadow .2s ease, transform .2s ease;
}

.afe-kpi:hover {
  box-shadow: var(--afe2-shadow-md);
  transform: translateY(-2px);
}

/* Subtle gradient splash top-right */
.afe-kpi::before {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--afe2-primary-rgb), .08), transparent 70%);
  pointer-events: none;
}

.afe-kpi__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  background: linear-gradient(135deg,
    rgba(var(--afe2-primary-rgb), .14),
    rgba(var(--afe2-primary-rgb), .06));
  color: var(--afe2-primary);
  margin-bottom: 1rem;
}

.afe-kpi__icon svg,
.afe-kpi__icon i { width: 18px; height: 18px; }

.afe-kpi__label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--afe2-text-muted);
  margin-bottom: .5rem;
}

.afe-kpi__value {
  font-size: clamp(1.5rem, 1.1rem + .9vw, 2.125rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
  color: #0b1220;
  margin-bottom: .5rem;
}

.afe-kpi__detail {
  font-size: .8125rem;
  color: var(--afe2-text-muted);
  line-height: 1.45;
}

.afe-kpi__delta {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .78rem;
  font-weight: 700;
  margin-top: .5rem;
}

.afe-kpi__delta.is-up   { color: var(--afe2-success); }
.afe-kpi__delta.is-down { color: var(--afe2-danger); }
.afe-kpi__delta.is-flat { color: var(--afe2-text-muted); }
.afe-kpi__delta svg,
.afe-kpi__delta i { width: 14px; height: 14px; }

/* KPI grid */
.afe-kpi-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}


/* ============================================================
   PANEL CONTENT GRID
   ============================================================ */
.afe-panel-grid {
  display: grid;
  gap: 1.25rem;
}

.afe-panel-grid--kpis {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

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


/* ============================================================
   ENTITY LIST ITEMS (inside cards)
   ============================================================ */
.afe-entity-list {
  display: grid;
  gap: .625rem;
}

.afe-entity-item {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: .75rem 1rem;
  border-radius: var(--afe2-radius);
  background: linear-gradient(180deg, rgba(248,250,252,.9), rgba(241,245,249,.85));
  border: 1px solid rgba(226,232,240,.7);
  transition: background .16s ease, box-shadow .16s ease, transform .16s ease;
}

.afe-entity-item:hover {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.94));
  box-shadow: var(--afe2-shadow-xs);
  transform: translateX(2px);
}

.afe-entity-item__icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  background: linear-gradient(135deg,
    rgba(var(--afe2-primary-rgb), .12),
    rgba(var(--afe2-primary-rgb), .04));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--afe2-primary);
}

.afe-entity-item__icon svg,
.afe-entity-item__icon i { width: 15px; height: 15px; }

.afe-entity-item__body { flex: 1; min-width: 0; }

.afe-entity-item__name {
  font-weight: 700;
  font-size: .875rem;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.afe-entity-item__meta {
  font-size: .78rem;
  color: var(--afe2-text-muted);
  margin-top: .1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.afe-entity-item__badge { flex-shrink: 0; }


/* ============================================================
   STATUS BADGES (inline)
   ============================================================ */
.afe-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .7rem;
  border-radius: var(--afe2-radius-pill);
  font-size: .73rem;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1;
  white-space: nowrap;
}

.afe-badge--success { background: rgba(22,163,74,.12); color: #15803d; }
.afe-badge--warning { background: rgba(217,119,6,.14);  color: #92400e; }
.afe-badge--danger  { background: rgba(220,38,38,.12);  color: #991b1b; }
.afe-badge--info    { background: rgba(14,165,233,.12); color: #0369a1; }
.afe-badge--muted   { background: rgba(100,116,139,.1); color: #475569; }
.afe-badge--dark    { background: #1f2937;              color: #fff;    }
.afe-badge svg,
.afe-badge i { width: 12px; height: 12px; opacity: .85; }


/* ============================================================
   TABLES
   ============================================================ */
.afe-table-card { overflow: hidden; }

.afe-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.125rem 1.25rem;
  border-bottom: 1px solid rgba(226,232,240,.85);
}

.afe-table-toolbar__left,
.afe-table-toolbar__right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem;
}

.afe-table-toolbar__search { min-width: 280px; max-width: 420px; }

.afe-search {
  display: flex;
  align-items: center;
  gap: .6rem;
  height: 44px;
  padding: 0 .875rem;
  background: rgba(255,255,255,.96);
  border: 1px solid var(--afe2-border-strong);
  border-radius: var(--afe2-radius);
  box-shadow: var(--afe2-shadow-xs);
  color: var(--afe2-text-muted);
}

.afe-search:focus-within {
  border-color: rgba(var(--afe2-primary-rgb), .45);
  box-shadow: 0 0 0 3px rgba(var(--afe2-primary-rgb), .1), var(--afe2-shadow-xs);
  color: var(--afe2-text);
}

.afe-search svg,
.afe-search i { width: 16px; height: 16px; flex-shrink: 0; }

.afe-search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: .875rem;
  color: var(--afe2-text);
  min-width: 0;
}

.afe-search input::placeholder { color: var(--afe2-text-muted); }

.afe-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.afe-table-wrap::-webkit-scrollbar { height: 8px; }
.afe-table-wrap::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }

.table.afe-table { width: 100%; margin-bottom: 0; vertical-align: middle; }

.table.afe-table thead th {
  background: #f8fafc;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: .72rem;
  font-weight: 800;
  padding: .875rem 1rem;
  white-space: nowrap;
}

.table.afe-table tbody td {
  padding: .875rem 1rem;
  border-color: #edf2f7;
  color: #0f172a;
  font-size: .875rem;
}

.table.afe-table tbody tr:hover td { background: #fbfdff; }

.afe-table-title { font-weight: 700; font-size: .9rem; color: #111827; margin-bottom: .125rem; }
.afe-table-meta  { color: #64748b; font-size: .8125rem; }

.afe-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .875rem 1.25rem;
  border-top: 1px solid rgba(226,232,240,.85);
}

.afe-pagination {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.afe-pagination .page-link {
  border: 1px solid var(--afe2-border-strong);
  color: #334155;
  min-width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--afe2-radius) !important;
  background: #fff;
  font-size: .875rem;
  font-weight: 700;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}

.afe-pagination .page-link:hover {
  background: #f8fafc;
  border-color: rgba(var(--afe2-primary-rgb), .3);
  color: var(--afe2-primary);
}

.afe-pagination .page-item.active .page-link {
  background: var(--afe2-primary);
  border-color: var(--afe2-primary);
  color: #fff;
}

.afe-pagination .page-item.disabled .page-link { opacity: .45; }


/* ============================================================
   BUTTONS (afe2 variants)
   ============================================================ */
.afe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  height: 44px;
  padding: 0 1.125rem;
  border-radius: var(--afe2-radius);
  font-size: .875rem;
  font-weight: 700;
  letter-spacing: -.005em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
  white-space: nowrap;
}

.afe-btn:hover  { transform: translateY(-1px); }
.afe-btn:active { transform: translateY(0); }
.afe-btn svg, .afe-btn i { width: 16px; height: 16px; }
.afe-btn--sm { height: 36px; padding: 0 .875rem; font-size: .8125rem; }

.afe-btn--primary {
  background: linear-gradient(180deg,
    rgba(var(--afe2-primary-rgb), 1) 0%,
    rgba(var(--afe2-primary-rgb), .9) 100%);
  color: #fff;
  border-color: rgba(var(--afe2-primary-rgb), .9);
  box-shadow: 0 4px 14px rgba(var(--afe2-primary-rgb), .28);
}

.afe-btn--primary:hover { box-shadow: 0 6px 20px rgba(var(--afe2-primary-rgb), .36); }

.afe-btn--soft {
  background: #fff;
  color: var(--afe2-text);
  border-color: var(--afe2-border-strong);
  box-shadow: var(--afe2-shadow-xs);
}

.afe-btn--soft:hover { background: #f8fafc; box-shadow: var(--afe2-shadow-sm); }

.afe-btn--danger {
  background: rgba(220,38,38,.08);
  color: #b91c1c;
  border-color: rgba(220,38,38,.18);
}

.afe-btn--danger:hover { background: rgba(220,38,38,.14); }


/* ============================================================
   FORMS
   ============================================================ */
.afe-input,
.form-control.afe-input,
.form-select.afe-input {
  height: 48px;
  border-radius: var(--afe2-radius) !important;
  border: 1px solid var(--afe2-border-strong);
  font-size: .9rem;
  color: var(--afe2-text);
  box-shadow: none !important;
  background-color: rgba(255,255,255,.97);
  transition: border-color .16s ease, box-shadow .16s ease;
}

.afe-input:focus,
.form-control.afe-input:focus,
.form-select.afe-input:focus {
  border-color: rgba(var(--afe2-primary-rgb), .5);
  box-shadow: 0 0 0 3px rgba(var(--afe2-primary-rgb), .1) !important;
}

textarea.afe-input { height: auto; padding-top: .75rem; padding-bottom: .75rem; }

.afe-label  { font-size: .8125rem; font-weight: 700; color: #334155; margin-bottom: .4rem; display: block; }
.afe-hint   { font-size: .78rem; color: var(--afe2-text-muted); margin-top: .3rem; }
.afe-field  { margin-bottom: 1.25rem; }


/* ============================================================
   MODALS
   ============================================================ */
.afe-modal .modal-content {
  border: 0;
  border-radius: var(--afe2-radius-xl);
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(15,23,42,.22);
}

.afe-modal .modal-header {
  padding: 1.25rem 1.375rem 1.125rem;
  border-bottom: 1px solid rgba(226,232,240,.85);
  align-items: center;
}

.afe-modal .modal-title {
  font-size: 1.0625rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -.015em;
}

.afe-modal .btn-close {
  margin: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 10px;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  opacity: 1;
  flex-shrink: 0;
}

.afe-modal .btn-close:hover { background-color: #e2e8f0; }
.afe-modal .modal-body    { padding: 1.25rem 1.375rem; }
.afe-modal .modal-footer  { padding: .875rem 1.375rem; border-top: 1px solid rgba(226,232,240,.85); gap: .625rem; }


/* ============================================================
   TABS
   ============================================================ */
.afe-tabs.nav-tabs {
  border-bottom: 1px solid rgba(226,232,240,.85);
  gap: .25rem;
}

.afe-tabs .nav-link {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--afe2-text-muted);
  font-size: .875rem;
  font-weight: 700;
  padding: .875rem 1.125rem;
  border-radius: var(--afe2-radius) var(--afe2-radius) 0 0;
  transition: color .14s ease, background .14s ease;
}

.afe-tabs .nav-link:hover {
  color: #1e293b;
  background: rgba(var(--afe2-primary-rgb), .04);
}

.afe-tabs .nav-link.active { color: var(--afe2-primary); background: transparent; }

.afe-tabs .nav-link.active::after {
  content: '';
  position: absolute;
  left: .75rem;
  right: .75rem;
  bottom: -1px;
  height: 2px;
  border-radius: 99px;
  background: var(--afe2-primary);
}


/* ============================================================
   EMPTY STATE
   ============================================================ */
.afe-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
  gap: .75rem;
}

.afe-empty__icon {
  width: 3rem;
  height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: #f1f5f9;
  color: #94a3b8;
}

.afe-empty__icon svg, .afe-empty__icon i { width: 22px; height: 22px; }
.afe-empty__title { font-size: .9375rem; font-weight: 700; color: #334155; margin: 0; }
.afe-empty__text  { font-size: .875rem; color: var(--afe2-text-muted); margin: 0; max-width: 380px; }


/* ============================================================
   QUICK ACTIONS (icon buttons in topbar)
   ============================================================ */
.afe-quick-actions {
  display: flex;
  align-items: center;
  gap: .375rem;
}

.afe-icon-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 .625rem;
  border-radius: var(--afe2-radius-pill);
  border: 1px solid var(--afe2-border-strong);
  background: rgba(255,255,255,.95);
  color: var(--afe2-text-soft);
  text-decoration: none;
  box-shadow: var(--afe2-shadow-xs);
  font-size: .8125rem;
  font-weight: 700;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  cursor: pointer;
}

.afe-icon-action:hover {
  transform: translateY(-1px);
  box-shadow: var(--afe2-shadow-sm);
  color: var(--afe2-text);
  border-color: rgba(var(--afe2-primary-rgb), .25);
}

.afe-icon-action svg, .afe-icon-action i { width: 16px; height: 16px; }

.afe-icon-action--danger {
  border-color: rgba(220,38,38,.18);
  color: #b91c1c;
}

.afe-icon-action--danger:hover {
  background: rgba(220,38,38,.06);
  border-color: rgba(220,38,38,.32);
  color: #991b1b;
}


/* ============================================================
   FLASH / ALERTS
   ============================================================ */
.afe-flash {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: 1rem 1.125rem;
  border-radius: var(--afe2-radius);
  font-size: .875rem;
  font-weight: 600;
  border-width: 1px;
  border-style: solid;
}

.afe-flash--success { background: rgba(22,163,74,.08);  border-color: rgba(22,163,74,.2);   color: #15803d; }
.afe-flash--danger  { background: rgba(220,38,38,.07);  border-color: rgba(220,38,38,.2);   color: #b91c1c; }
.afe-flash--warning { background: rgba(217,119,6,.08);  border-color: rgba(217,119,6,.22);  color: #92400e; }
.afe-flash--info    { background: rgba(14,165,233,.08); border-color: rgba(14,165,233,.2);  color: #0369a1; }


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1199.98px) {
  .afe-panel-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 991.98px) {
  .afe-panel-shell { flex-direction: column; }
  .afe-sidebar, .afe-panel-sidebar {
    position: relative;
    top: auto;
    width: 100%;
    min-height: auto;
    max-height: none;
  }
  .afe-topbar__inner { min-height: auto; padding: .875rem 1rem; align-items: flex-start; }
  .afe-topbar__actions { justify-content: flex-start; width: 100%; }
  .afe-main { padding: 1.125rem !important; }
  .afe-kpi-grid, .afe-panel-grid--kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .afe-panel-grid--3 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 767.98px) {
  .afe-topbar__inner { flex-direction: column; align-items: stretch; gap: .75rem; }
  .afe-main { padding: .875rem !important; }
  .afe-kpi-grid, .afe-panel-grid--kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .875rem; }
  .afe-table-toolbar { flex-direction: column; align-items: stretch; }
  .afe-table-toolbar__search { min-width: 100%; max-width: 100%; }
  .afe-table-toolbar__left, .afe-table-toolbar__right { width: 100%; justify-content: space-between; }
  .table.afe-table { min-width: 640px; }
  .afe-page__header { flex-direction: column; align-items: stretch; }
}

@media (max-width: 479.98px) {
  .afe-kpi-grid, .afe-panel-grid--kpis { grid-template-columns: minmax(0, 1fr); }
}


/* ============================================================
   UI REFINEMENTS · Forms, accordions and cards
   ============================================================ */
.afe-app--panel,
.afe-app--pos {
  background:
    radial-gradient(circle at top left, rgba(var(--afe2-primary-rgb), .05), transparent 30%),
    linear-gradient(180deg, #f5f7fb 0%, #eef3f9 100%);
}

.afe-app--panel .card.border-0.shadow-sm.rounded-4,
.afe-app--pos .card.border-0.shadow-sm.rounded-4 {
  border: 1px solid rgba(203,213,225,.68) !important;
  background: linear-gradient(180deg, rgba(255,255,255,.985), rgba(248,250,252,.965));
  box-shadow: var(--afe2-shadow-sm) !important;
  overflow: hidden;
}

.afe-app--panel .form-control,
.afe-app--panel .form-select,
.afe-app--pos .form-control,
.afe-app--pos .form-select {
  min-height: 48px;
  border-radius: 16px !important;
  border-color: rgba(100,116,139,.18);
  background: rgba(255,255,255,.97);
  box-shadow: none !important;
}

.afe-app--panel textarea.form-control,
.afe-app--pos textarea.form-control {
  min-height: 120px;
}

.afe-app--panel .form-control:focus,
.afe-app--panel .form-select:focus,
.afe-app--pos .form-control:focus,
.afe-app--pos .form-select:focus {
  border-color: rgba(var(--afe2-primary-rgb), .5);
  box-shadow: 0 0 0 4px rgba(var(--afe2-primary-rgb), .09) !important;
}

.afe-app--panel .btn.btn-dark.rounded-pill,
.afe-app--pos .btn.btn-dark.rounded-pill,
.afe-app--panel .btn.btn-primary.rounded-pill,
.afe-app--pos .btn.btn-primary.rounded-pill,
.afe-app--panel .btn.btn-accent.rounded-pill,
.afe-app--pos .btn.btn-accent.rounded-pill {
  padding-inline: 1.2rem;
  min-height: 44px;
  border: 0;
  box-shadow: 0 10px 24px rgba(var(--afe2-primary-rgb), .18);
}

.afe-app--panel .btn.btn-outline-dark.rounded-pill,
.afe-app--pos .btn.btn-outline-dark.rounded-pill {
  min-height: 44px;
  border-color: rgba(100,116,139,.22);
  background: rgba(255,255,255,.9);
}

.afe-page-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
}

.afe-record-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 38px;
  padding: .45rem .85rem;
  border-radius: 999px;
  border: 1px solid rgba(100,116,139,.18);
  background: rgba(255,255,255,.9);
  color: #334155;
  font-size: .8rem;
  font-weight: 700;
}

.afe-form-accordion .accordion-item {
  border: 1px solid rgba(203,213,225,.75) !important;
  border-radius: 20px !important;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(248,250,252,.97));
  box-shadow: 0 10px 28px rgba(15,23,42,.04);
}

.afe-form-accordion .accordion-item + .accordion-item {
  margin-top: .95rem;
}

.afe-form-accordion .accordion-button {
  border: 0;
  padding: 1rem 1.15rem;
  font-weight: 800;
  color: #0f172a;
}

.afe-form-accordion .accordion-button small,
.afe-form-accordion .accordion-button .small {
  display: block;
  margin-top: .1rem;
  font-weight: 500;
  color: #64748b;
}

.afe-form-accordion .accordion-button:not(.collapsed) {
  color: #0f172a;
}

.afe-form-accordion .accordion-body {
  padding: 1.15rem 1.15rem 1.25rem;
}

.afe-form-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .7rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  color: #475569;
  background: rgba(241,245,249,.96);
  border: 1px solid rgba(203,213,225,.95);
}

.afe-form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .75rem;
  margin-top: 1.15rem;
}

.afe-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .75rem;
}

.afe-check-card {
  display: flex;
  align-items: center;
  gap: .8rem;
  min-height: 72px;
  padding: .95rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(203,213,225,.85);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.94));
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.afe-check-card:hover {
  border-color: rgba(var(--afe2-primary-rgb), .22);
  box-shadow: var(--afe2-shadow-xs);
  transform: translateY(-1px);
}

.afe-check-card .form-check-input {
  margin: 0;
  flex-shrink: 0;
}

.afe-check-card__body {
  min-width: 0;
}

.afe-check-card__title {
  font-size: .875rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
}

.afe-check-card__meta {
  margin-top: .15rem;
  font-size: .76rem;
  color: #64748b;
  line-height: 1.45;
}

.afe-form-note {
  border: 1px dashed rgba(148,163,184,.5);
  border-radius: 18px;
  padding: .9rem 1rem;
  background: rgba(248,250,252,.95);
}

.afe-card-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .9rem;
}

.afe-soft-block {
  border: 1px solid rgba(226,232,240,.92);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(248,250,252,.96));
  padding: 1rem 1.05rem;
}

.afe-soft-block__label {
  font-size: .74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #64748b;
  margin-bottom: .4rem;
}

.afe-soft-block__value {
  font-size: 1.02rem;
  font-weight: 800;
  color: #0f172a;
}

.afe-soft-block__meta {
  margin-top: .2rem;
  font-size: .8rem;
  color: #64748b;
}

.afe-table-responsive,
.afe-app--panel .table-responsive,
.afe-app--pos .table-responsive {
  border: 1px solid rgba(226,232,240,.92);
  border-radius: 20px;
  background: rgba(255,255,255,.94);
}

.afe-modal .accordion-body {
  background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(248,250,252,.98));
}

@media (max-width: 991.98px) {
  .afe-form-actions {
    justify-content: stretch;
  }

  .afe-form-actions > * {
    width: 100%;
  }
}


/* POS quick charge controls */
.afe-pos-hero__meta {
  display: grid;
  gap: .9rem;
}

.afe-pos-top-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .85rem;
}

.afe-pos-top-control {
  display: grid;
  gap: .38rem;
  padding: .8rem .85rem;
  border-radius: 22px;
  border: 1px solid rgba(15, 23, 42, .08);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
  box-shadow: var(--afe2-shadow-xs);
}

.afe-pos-top-control label {
  margin: 0;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--afe2-text-muted);
}

.afe-pos-top-control .form-select,
.afe-pos-top-control .form-control {
  min-height: 2.6rem;
  border-radius: 16px !important;
  border-color: rgba(15, 23, 42, .08);
  box-shadow: none;
  font-size: .9rem;
  font-weight: 700;
  background-color: #fff;
}

.afe-pos-top-control .form-select:disabled,
.afe-pos-top-control .form-control:disabled {
  background-color: #eef2f7;
  color: #94a3b8;
}

@media (max-width: 1199.98px) {
  .afe-pos-top-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .afe-pos-top-controls {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* POS modal compact refinement */
.afe-pos-modal .modal-dialog {
  align-items: center;
}

.afe-pos-modal .modal-content {
  border-radius: 28px !important;
}

.afe-pos-modal .modal-header,
.afe-pos-modal .modal-body {
  background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(248,250,252,.97));
}

.afe-pos-modal .modal-body {
  padding-top: .85rem;
}

.afe-pos-modal-card {
  background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(248,250,252,.97));
  box-shadow: var(--afe2-shadow-xs);
}

.afe-pos-modal-card--compact {
  position: sticky;
  top: 0;
}

.afe-pos-modal .form-label {
  font-size: .84rem;
  font-weight: 700;
  color: var(--afe2-text-muted);
}

.afe-pos-modal textarea.form-control {
  min-height: 88px;
}

#cliente-search-results {
  margin-top: .35rem;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(15,23,42,.08);
}

#cliente-search-results .list-group-item {
  border: 0;
  padding: .75rem .9rem;
}

#cliente-search-results .list-group-item + .list-group-item {
  border-top: 1px solid rgba(15,23,42,.06);
}

.afe-pos-search input {
  min-width: min(100%, 360px);
}

@media (max-width: 991.98px) {
  .afe-pos-modal .modal-dialog {
    margin: .65rem;
  }

  .afe-pos-modal-card--compact {
    position: static;
  }
}


/* UI central */
:root {
  --afe2-radius: 10px;
  --afe2-radius-lg: 14px;
  --afe2-radius-xl: 18px;
  --afe2-radius-pill: 10px;
  --afe2-sidebar-w: 286px;
}

.afe-app--panel,
.afe-app--pos {
  background:
    radial-gradient(circle at 4% 0%, rgba(var(--afe2-primary-rgb), .08), transparent 26%),
    radial-gradient(circle at 94% 6%, rgba(14,165,233,.055), transparent 24%),
    linear-gradient(180deg, #f7faff 0%, #eef3f9 100%);
}

.afe-main {
  width: 100%;
}

.afe-card,
.afe-kpi,
.afe-soft-block,
.afe-app--panel .card,
.afe-app--pos .card {
  border-radius: var(--afe2-radius-lg) !important;
}

.afe-card__header,
.afe-table-toolbar,
.afe-topbar__inner {
  gap: 1rem;
}

.afe-page__header {
  padding: .15rem 0 .2rem;
}

.afe-app--panel .btn,
.afe-app--pos .btn,
.afe-app--panel .btn.rounded-pill,
.afe-app--pos .btn.rounded-pill,
.afe-app--panel .btn.rounded-4,
.afe-app--pos .btn.rounded-4,
.afe-btn,
.afe-icon-action,
button.afe-icon-action,
.afe-pagination .page-link {
  border-radius: 10px !important;
}

.afe-app--panel .btn,
.afe-app--pos .btn,
.afe-btn {
  font-weight: 750;
  letter-spacing: -.01em;
}

.afe-app--panel .btn.btn-dark,
.afe-app--panel .btn.btn-primary,
.afe-app--panel .btn.btn-accent,
.afe-app--pos .btn.btn-dark,
.afe-app--pos .btn.btn-primary,
.afe-app--pos .btn.btn-accent {
  border-color: transparent;
  background: linear-gradient(180deg, rgba(var(--afe2-primary-rgb), .98), rgba(var(--afe2-primary-rgb), .88));
}

.afe-app--panel .btn-outline-dark,
.afe-app--panel .btn-outline-secondary,
.afe-app--panel .btn-outline-primary,
.afe-app--pos .btn-outline-dark,
.afe-app--pos .btn-outline-secondary,
.afe-app--pos .btn-outline-primary {
  background: rgba(255,255,255,.96);
  border-color: rgba(100,116,139,.24);
}

.afe-app--panel .form-control,
.afe-app--panel .form-select,
.afe-app--pos .form-control,
.afe-app--pos .form-select,
.afe-table-toolbar__search .form-control,
.afe-search {
  border-radius: 10px !important;
}

.afe-topbar {
  background: rgba(247,250,255,.94);
}

.afe-topbar__inner {
  flex-wrap: nowrap;
}

.afe-topbar__inner > div:first-of-type {
  min-width: 0;
}

.afe-topbar__actions {
  justify-content: flex-end;
}

.afe-topbar__chip,
.afe-record-pill,
.afe-badge,
.badge.rounded-pill {
  border-radius: 9px !important;
}

.badge,
.afe-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  min-height: 1.55rem;
}

.afe-sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 40px;
  padding: 0 .85rem;
  border-radius: 10px;
  border: 1px solid rgba(100,116,139,.22);
  background: rgba(255,255,255,.96);
  color: #0f172a;
  font-weight: 800;
  font-size: .86rem;
  box-shadow: var(--afe2-shadow-xs);
  flex-shrink: 0;
}

.afe-sidebar-toggle svg,
.afe-sidebar-toggle i {
  width: 17px;
  height: 17px;
}

.afe-sidebar-backdrop {
  display: none;
}

.afe-sidebar,
.afe-panel-sidebar {
  transition: width .22s ease, flex-basis .22s ease, max-width .22s ease, transform .22s ease, box-shadow .22s ease;
}

.afe-nav__item {
  border-radius: 10px;
}

@media (min-width: 992px) {
  body.afe-sidebar-collapsed .afe-sidebar,
  body.afe-sidebar-collapsed .afe-panel-sidebar {
    flex-basis: 88px;
    width: 88px;
    max-width: 88px;
  }

  body.afe-sidebar-collapsed .afe-brand {
    justify-content: center;
    padding-inline: .75rem;
  }

  body.afe-sidebar-collapsed .afe-brand > div:not(.afe-brand__logo),
  body.afe-sidebar-collapsed .afe-sidebar__label,
  body.afe-sidebar-collapsed .afe-nav__label,
  body.afe-sidebar-collapsed .afe-nav__badge,
  body.afe-sidebar-collapsed .afe-sidebar__footer {
    display: none !important;
  }

  body.afe-sidebar-collapsed .afe-sidebar__section {
    padding-inline: .65rem;
  }

  body.afe-sidebar-collapsed .afe-nav__item {
    justify-content: center;
    padding-inline: .65rem;
  }

  body.afe-sidebar-collapsed .afe-nav__icon {
    flex-basis: 20px;
  }
}

@media (max-width: 991.98px) {
  .afe-panel-shell {
    flex-direction: row;
  }

  .afe-sidebar,
  .afe-panel-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, var(--afe2-sidebar-w));
    max-width: 320px;
    min-height: 100dvh;
    max-height: 100dvh;
    transform: translateX(-105%);
    z-index: 1060;
    box-shadow: 24px 0 70px rgba(2,6,23,.28);
  }

  body.afe-sidebar-open .afe-sidebar,
  body.afe-sidebar-open .afe-panel-sidebar {
    transform: translateX(0);
  }

  body.afe-sidebar-open {
    overflow: hidden;
  }

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

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

  .afe-topbar__inner {
    flex-wrap: wrap;
    align-items: center;
  }

  .afe-topbar__inner > div:first-of-type {
    flex: 1 1 240px;
  }

  .afe-topbar__actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 767.98px) {
  .afe-topbar__inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .afe-topbar__actions {
    grid-column: 1 / -1;
  }

  .afe-topbar__chip {
    min-height: 34px;
  }

  .afe-main {
    padding: .9rem !important;
  }

  .afe-card__header,
  .afe-card__body,
  .afe-card__footer {
    padding-inline: 1rem;
  }

  .afe-table-toolbar__left,
  .afe-table-toolbar__right,
  .afe-topbar__actions {
    align-items: stretch;
  }

  .afe-topbar__actions .btn,
  .afe-topbar__actions form,
  .afe-topbar__actions form .btn {
    width: 100%;
  }
}

@media (max-width: 575.98px) {
  .afe-sidebar-toggle span {
    display: none;
  }

  .afe-sidebar-toggle {
    width: 42px;
    padding-inline: 0;
  }

  .afe-kpi,
  .afe-card,
  .afe-app--panel .card,
  .afe-app--pos .card {
    border-radius: 12px !important;
  }
}


/* ============================================================
   POS comercial · foco en venta y limpieza visual
   ============================================================ */
.afe-app--pos {
  background:
    radial-gradient(circle at 2% 0%, rgba(var(--afe2-primary-rgb), .10), transparent 25%),
    radial-gradient(circle at 92% 4%, rgba(14,165,233,.08), transparent 26%),
    linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
}

.afe-app--pos .pos-card,
.afe-app--pos .afe-pos-section,
.afe-app--pos .afe-pos-modal-card {
  border: 1px solid rgba(203,213,225,.82) !important;
  border-radius: 14px !important;
  box-shadow: 0 12px 34px rgba(15,23,42,.07) !important;
}

.afe-pos-hero--commercial {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(15,23,42,.98), rgba(30,41,59,.94) 56%, rgba(var(--afe2-primary-rgb), .88));
  color: #fff;
  border-color: rgba(255,255,255,.08) !important;
}

.afe-pos-hero--commercial::after {
  content: '';
  position: absolute;
  inset: auto -7rem -9rem auto;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  pointer-events: none;
}

.afe-pos-hero--commercial .text-muted,
.afe-pos-hero--commercial .afe-pos-hero__subtitle {
  color: rgba(255,255,255,.72) !important;
}

.afe-pos-eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: .25rem .58rem;
  border-radius: 8px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.9);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.afe-pos-hero__title {
  max-width: 720px;
  color: #fff;
  font-size: clamp(1.45rem, 2.4vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: -.04em;
  font-weight: 900;
}

.afe-pos-hero--commercial .afe-icon-action,
.afe-pos-hero--commercial .afe-pos-top-control {
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.14);
  color: #fff;
  backdrop-filter: blur(12px);
}

.afe-pos-hero--commercial .afe-icon-action:hover {
  background: rgba(255,255,255,.16);
  color: #fff;
}

.afe-pos-hero--commercial .afe-pos-top-control label {
  color: rgba(255,255,255,.72);
}

.afe-pos-hero--commercial .afe-pos-top-control .form-select,
.afe-pos-hero--commercial .afe-pos-top-control .form-control {
  background-color: rgba(255,255,255,.94);
  color: #0f172a;
  border-color: transparent;
}

.afe-pos-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: .85rem;
}

.afe-pos-product-card--commercial {
  min-height: 282px;
  border-radius: 14px !important;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.afe-pos-product-card--commercial:hover {
  transform: translateY(-3px);
  border-color: rgba(var(--afe2-primary-rgb), .35) !important;
  box-shadow: 0 16px 36px rgba(15,23,42,.10) !important;
}

.afe-pos-product-card__thumb {
  border-radius: 12px !important;
}

.afe-pos-product-card__name {
  min-height: 2.5rem;
  color: #0f172a;
  line-height: 1.22;
}

.afe-pos-product-card__meta {
  min-height: 2.6rem;
  line-height: 1.35;
}

.afe-pos-price {
  color: #0f172a;
  font-size: clamp(1.15rem, 1.55vw, 1.45rem);
  letter-spacing: -.035em;
}

.afe-app--pos .badge {
  border-radius: 8px !important;
  font-weight: 800;
}

.afe-pos-line {
  border-radius: 12px !important;
  background: linear-gradient(180deg, #fff, #f8fafc);
}

.afe-pos-summary {
  border-radius: 12px !important;
  background: linear-gradient(180deg, rgba(15,23,42,.97), rgba(30,41,59,.96)) !important;
  color: #fff;
}

.afe-pos-summary .small,
.afe-pos-summary span:first-child {
  color: rgba(255,255,255,.72);
}

.afe-pos-summary strong,
.afe-pos-summary .fs-4 {
  color: #fff;
}

.afe-app--pos .afe-icon-action,
.afe-app--pos .afe-icon-action--labeled {
  border-radius: 10px !important;
}

.afe-pos-modal .modal-content {
  border-radius: 16px !important;
}

.afe-pos-modal .modal-header {
  padding: 1rem 1.15rem .35rem;
}

.afe-pos-modal .modal-body {
  padding: .75rem 1.15rem 1.15rem;
}

.afe-pos-modal-card {
  border-radius: 12px !important;
}

.afe-pos-modal .form-label {
  font-size: .8rem;
  color: #475569;
}

.afe-pos-modal .bg-light {
  background-color: #f8fafc !important;
}

@media (max-width: 767.98px) {
  .afe-pos-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
  }

  .afe-pos-product-card--commercial {
    min-height: 250px;
    padding: .78rem !important;
  }

  .afe-pos-product-card__name {
    font-size: .92rem;
  }

  .afe-pos-price {
    font-size: 1.12rem;
  }

  .afe-pos-hero__title {
    font-size: 1.45rem;
  }
}

@media (max-width: 399.98px) {
  .afe-pos-product-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.afe-flash-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1120;
  display: grid;
  gap: .65rem;
  width: min(420px, calc(100vw - 2rem));
  pointer-events: none;
}

.afe-flash--floating {
  position: relative;
  align-items: center;
  min-height: 54px;
  padding: .82rem 3rem .82rem 1rem;
  border-radius: 12px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 22px 55px rgba(15,23,42,.18);
  backdrop-filter: blur(14px);
  pointer-events: auto;
  transform: translateY(0);
  opacity: 1;
  transition: opacity .22s ease, transform .22s ease;
}

.afe-flash--floating svg,
.afe-flash--floating i {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.afe-flash--floating span {
  line-height: 1.35;
}

.afe-flash--floating.afe-flash--success {
  background: rgba(240,253,244,.97);
  border-color: rgba(22,163,74,.28);
  color: #166534;
}

.afe-flash--floating.afe-flash--warning {
  background: rgba(255,251,235,.97);
  border-color: rgba(245,158,11,.34);
  color: #92400e;
}

.afe-flash--floating.afe-flash--danger {
  background: rgba(254,242,242,.97);
  border-color: rgba(220,38,38,.30);
  color: #991b1b;
}

.afe-flash--floating.afe-flash--info {
  background: rgba(240,249,255,.97);
  border-color: rgba(14,165,233,.28);
  color: #075985;
}

.afe-flash__close {
  position: absolute;
  top: 50%;
  right: .72rem;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: rgba(15,23,42,.07);
  color: inherit;
  cursor: pointer;
}

.afe-flash__close:hover {
  background: rgba(15,23,42,.12);
}

.afe-flash--leaving {
  opacity: 0;
  transform: translateY(-8px);
}

@media (max-width: 575.98px) {
  .afe-flash-stack {
    top: .75rem;
    right: .75rem;
    left: .75rem;
    width: auto;
  }
}


.afe-documents-table-wrap {
    overflow-x: auto;
}
.afe-documents-table {
    min-width: 1120px;
}
.afe-documents-actions-col,
.afe-documents-actions-cell {
    min-width: 280px;
    width: 280px;
}
.afe-documents-actions-cell .afe-document-actions {
    max-width: 280px;
    margin-left: auto;
    justify-content: flex-end;
    row-gap: .45rem;
}
.afe-documents-actions-cell .modal {
    text-align: left;
}

/* ============================================================
   CRUD forms in modal · space optimization
   ============================================================ */
.afe-crud-modal-actions {
  margin-left: auto;
}

.afe-page__header > .afe-crud-modal-actions,
.mb-4.d-flex > .afe-crud-modal-actions {
  align-self: flex-end;
}

.afe-crud-modal-trigger {
  white-space: nowrap;
}

.afe-crud-form-modal .modal-content {
  border: 0;
  border-radius: 22px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .18);
}

.afe-crud-form-modal .modal-header {
  border-bottom: 1px solid rgba(226, 232, 240, .95);
  padding: 1rem 1.15rem;
}

.afe-crud-form-modal .modal-body {
  padding: 1.15rem;
}

.afe-crud-form-modal form > .afe-form-actions,
.afe-crud-form-modal form > .d-grid:last-child,
.afe-crud-form-modal form > .col-12.d-grid:last-child {
  position: sticky;
  bottom: -1.15rem;
  z-index: 3;
  margin: 1rem -1.15rem -1.15rem;
  padding: .95rem 1.15rem;
  background: rgba(255, 255, 255, .98);
  border-top: 1px solid rgba(226, 232, 240, .92);
}

.afe-crud-modalized-row > .col-12 > .card,
.afe-crud-modalized-row > .col-12 > .afe-card {
  min-height: auto;
}

.afe-crud-price-action .small {
  line-height: 1.4;
}

@media (max-width: 767.98px) {
  .afe-crud-modal-actions {
    width: 100%;
    justify-content: stretch !important;
  }

  .afe-crud-modal-actions > .btn,
  .afe-crud-modal-actions > button {
    width: 100%;
  }
}

/* Inventario Pro · acciones rápidas con icono */
.afe-crud-modal-actions .afe-crud-modal-trigger--icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  overflow: visible;
  background: linear-gradient(180deg, rgba(37, 99, 235, .98), rgba(29, 78, 216, .98));
  color: #fff;
  border-color: rgba(37, 99, 235, .58);
  box-shadow: 0 12px 26px rgba(37, 99, 235, .22);
}

.afe-crud-modal-actions .afe-crud-modal-trigger--icon:hover,
.afe-crud-modal-actions .afe-crud-modal-trigger--icon:focus-visible {
  color: #fff;
  background: linear-gradient(180deg, rgba(29, 78, 216, 1), rgba(30, 64, 175, 1));
  border-color: rgba(30, 64, 175, .68);
  box-shadow: 0 16px 34px rgba(37, 99, 235, .28);
}

.afe-crud-modal-actions .afe-crud-modal-trigger--icon svg,
.afe-crud-modal-actions .afe-crud-modal-trigger--icon i {
  width: 18px;
  height: 18px;
}

.afe-crud-modal-actions .afe-crud-modal-trigger--icon::after {
  content: attr(data-afe-label);
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 1080;
  max-width: 220px;
  padding: .45rem .65rem;
  border-radius: .75rem;
  background: rgba(15, 23, 42, .96);
  color: #fff;
  font-size: .74rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .16s ease, transform .16s ease;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .24);
}

.afe-crud-modal-actions .afe-crud-modal-trigger--icon:hover::after,
.afe-crud-modal-actions .afe-crud-modal-trigger--icon:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.afe-crud-form-modal .afe-crud-modal-form__body {
  display: block;
}

@media (max-width: 767.98px) {
  .afe-crud-modal-actions {
    justify-content: flex-start !important;
  }

  .afe-crud-modal-actions > .afe-crud-modal-trigger--icon,
  .afe-crud-modal-actions > button.afe-crud-modal-trigger--icon {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    flex: 0 0 42px;
  }
}

/* Panel contable - afinado integral */
.afe-square-action,
.afe-card .btn,
.afe-hero-card .btn,
.afe-table .btn {
    border-radius: 0 !important;
    min-width: 42px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
}

.afe-nav__badge {
    margin-left: auto;
    font-size: .62rem;
    line-height: 1;
    padding: .23rem .35rem;
    border-radius: 0;
    background: rgba(37, 99, 235, .12);
    color: #1d4ed8;
    border: 1px solid rgba(37, 99, 235, .18);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.afe-nav__lock {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: .75;
}

.afe-nav__item.is-locked {
    opacity: .82;
}

.afe-clean-list {
    display: grid;
    gap: .55rem;
    padding-left: 1rem;
}

.afe-clean-list li {
    padding: .45rem .55rem;
    background: rgba(15, 23, 42, .035);
    border-left: 3px solid rgba(37, 99, 235, .35);
}

/* Contador sidebar: buscador y segmentación completa */
.afe-sidebar__search {
  position: relative;
  margin: .75rem 1rem .25rem;
}

.afe-sidebar__search svg,
.afe-sidebar__search i {
  position: absolute;
  left: .85rem;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--afe2-sb-text-muted);
  pointer-events: none;
}

.afe-sidebar__search input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: rgba(255,255,255,.045);
  color: #fff;
  font-size: .84rem;
  font-weight: 600;
  outline: none;
  padding: .6rem .85rem .6rem 2.35rem;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.afe-sidebar__search input::placeholder {
  color: var(--afe2-sb-text-muted);
}

.afe-sidebar__search input:focus {
  border-color: rgba(var(--afe2-primary-rgb), .55);
  background: rgba(255,255,255,.065);
  box-shadow: 0 0 0 3px rgba(var(--afe2-primary-rgb), .12);
}

.afe-sidebar__menu {
  flex: 1 1 auto;
  padding-bottom: 1rem;
}

.afe-sidebar__empty {
  margin: 1rem;
  padding: .85rem;
  border: 1px dashed rgba(255,255,255,.16);
  border-radius: 12px;
  color: var(--afe2-sb-text-muted);
  font-size: .84rem;
  font-weight: 600;
  text-align: center;
}

.afe-sidebar__section[hidden],
.afe-nav__item[hidden],
.afe-sidebar__empty[hidden] {
  display: none !important;
}

@media (min-width: 992px) {
  body.afe-sidebar-collapsed .afe-sidebar__search,
  body.afe-sidebar-collapsed .afe-sidebar__empty {
    display: none !important;
  }
}


/* Sidebar accordion */
.afe-sidebar__section-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--afe2-sb-text-muted);
  padding: .72rem .75rem .48rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  border-radius: 14px;
  font-size: .6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  line-height: 1.2;
  text-align: left;
  transition: background .16s ease, color .16s ease;
}

.afe-sidebar__section-toggle:hover,
.afe-sidebar__section-toggle:focus-visible {
  background: rgba(255,255,255,.055);
  color: #fff;
  outline: none;
}

.afe-sidebar__section-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.afe-sidebar__section-arrow {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  opacity: .78;
  transition: transform .18s ease, opacity .18s ease;
}

.afe-sidebar__section-arrow svg,
.afe-sidebar__section-arrow i {
  width: 16px;
  height: 16px;
  display: block;
}

.afe-sidebar__section.is-open > .afe-sidebar__section-toggle {
  color: #fff;
  background: rgba(255,255,255,.045);
}

.afe-sidebar__section.is-open > .afe-sidebar__section-toggle .afe-sidebar__section-arrow {
  transform: rotate(180deg);
  opacity: 1;
}

.afe-sidebar__section-body {
  padding-top: .28rem;
}

.afe-sidebar__section.is-closed > .afe-sidebar__section-body {
  display: none !important;
}

.afe-sidebar__label {
  display: block;
}

@media (min-width: 992px) {
  body.afe-sidebar-collapsed .afe-sidebar__section-toggle {
    justify-content: center;
    padding-inline: .45rem;
  }

  body.afe-sidebar-collapsed .afe-sidebar__section-title,
  body.afe-sidebar-collapsed .afe-sidebar__section-arrow {
    display: none !important;
  }

  body.afe-sidebar-collapsed .afe-sidebar__section.is-closed > .afe-sidebar__section-body {
    display: none !important;
  }
}


.access-selector-option {
    transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.access-selector-option:hover,
.access-selector-option:focus {
    background: #f8fafc;
    border-color: #94a3b8 !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .10);
    transform: translateY(-1px);
}

.afe-app--pos .container-fluid {
  padding-top: .85rem !important;
  padding-bottom: .85rem !important;
}

.afe-app--pos .pos-card,
.afe-app--pos .afe-pos-section,
.afe-app--pos .afe-pos-modal-card {
  border-radius: 12px !important;
}

.afe-app--pos .afe-pos-section--compact {
  padding: .75rem !important;
}

.afe-pos-shell {
  --bs-gutter-x: .85rem;
  --bs-gutter-y: .85rem;
}

.afe-pos-hero--compact {
  padding: .75rem !important;
}

.afe-pos-hero__meta {
  gap: .55rem !important;
}

.afe-pos-status-badges .badge,
.afe-app--pos .badge {
  font-size: .66rem;
  line-height: 1.08;
  padding: .26rem .42rem;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.afe-pos-top-controls {
  gap: .45rem !important;
}

.afe-pos-top-control {
  gap: .22rem !important;
  padding: .45rem .5rem !important;
  border-radius: 12px !important;
}

.afe-pos-top-control label {
  font-size: .61rem !important;
  line-height: 1.05;
}

.afe-pos-top-control .form-select,
.afe-pos-top-control .form-control {
  min-height: 2rem !important;
  border-radius: 10px !important;
  font-size: .76rem !important;
  padding-top: .28rem !important;
  padding-bottom: .28rem !important;
}

.afe-pos-search input {
  min-width: min(100%, 245px) !important;
  min-height: 2rem !important;
  font-size: .8rem !important;
}

.afe-pos-toggle {
  padding: .2rem .48rem !important;
  font-size: .72rem;
}

.afe-pos-product-grid {
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)) !important;
  gap: .55rem !important;
}

.afe-pos-product-card--commercial {
  min-height: 198px !important;
  padding: .55rem !important;
  border-radius: 11px !important;
}

.afe-pos-product-card__media {
  margin: -.1rem -.1rem .45rem !important;
}

.afe-pos-product-card__thumb--cover {
  height: 88px !important;
  border-radius: 11px !important;
  font-size: 1.55rem !important;
}

.afe-pos-product-card__image {
  height: 88px !important;
  border-radius: 11px !important;
}

.afe-pos-card-tags {
  min-height: 1.38rem;
}

.afe-pos-card-tags .badge {
  max-width: 48%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap !important;
}

.afe-pos-product-card__name {
  min-height: 2.1rem !important;
  font-size: .82rem !important;
  line-height: 1.18 !important;
  -webkit-line-clamp: 2;
}

.afe-pos-product-card__meta {
  min-height: auto !important;
  font-size: .66rem !important;
  line-height: 1.12 !important;
}

.afe-pos-price {
  font-size: .9rem !important;
  line-height: 1.1 !important;
  letter-spacing: -.02em !important;
}

.afe-pos-qty-input {
  width: 4.25rem !important;
  max-width: 4.25rem !important;
  min-height: 1.9rem !important;
  padding-inline: .5rem !important;
  font-size: .78rem !important;
}

.afe-app--pos .afe-icon-action {
  width: 2rem !important;
  height: 2rem !important;
  min-width: 2rem !important;
  min-height: 2rem !important;
  padding: .34rem !important;
}

.afe-app--pos .afe-icon-action svg,
.afe-app--pos .afe-icon-action i {
  width: 15px !important;
  height: 15px !important;
}

.afe-app--pos .afe-icon-action--labeled {
  width: auto !important;
  min-width: 2rem !important;
  gap: .3rem !important;
  padding-inline: .48rem !important;
}

.afe-app--pos .afe-icon-action--labeled span {
  font-size: .73rem !important;
}

.afe-pos-list {
  max-height: min(47vh, 560px) !important;
}

.afe-pos-line {
  font-size: .78rem;
  border-radius: 10px !important;
}

.afe-pos-line__meta,
.afe-pos-line .small {
  font-size: .68rem !important;
  line-height: 1.14 !important;
}

.afe-pos-summary {
  padding: .65rem !important;
}

.afe-pos-summary .small {
  font-size: .7rem !important;
}

.afe-pos-summary .fs-5,
.afe-pos-summary #pos-cart-total-view {
  font-size: 1rem !important;
}

.afe-pos-accordion .accordion-button {
  padding: .55rem .65rem !important;
  font-size: .78rem !important;
  min-height: 2rem;
}

.afe-pos-accordion .accordion-body {
  padding-top: .55rem !important;
}

.afe-pos-modal .modal-dialog {
  --bs-modal-width: 780px !important;
}

.afe-pos-modal .modal-header {
  padding: .65rem .85rem .15rem !important;
}

.afe-pos-modal .modal-body {
  padding: .55rem .85rem .85rem !important;
}

.afe-pos-charge-form {
  --bs-gutter-x: .45rem;
  --bs-gutter-y: .45rem;
}

.afe-pos-modal-card {
  padding: .6rem !important;
}

.afe-pos-modal .form-label,
.afe-pos-modal .form-check-label {
  font-size: .68rem !important;
  line-height: 1.08 !important;
}

.afe-pos-modal .form-control,
.afe-pos-modal .form-select {
  min-height: 2rem !important;
  border-radius: 10px !important;
  font-size: .78rem !important;
  padding-top: .32rem !important;
  padding-bottom: .32rem !important;
}

.afe-pos-modal textarea.form-control {
  min-height: 54px !important;
}

.afe-pos-modal .accordion-button {
  padding: .5rem .65rem !important;
  font-size: .78rem !important;
}

.afe-pos-modal .accordion-body {
  padding: .55rem !important;
}

.afe-pos-modal .btn {
  min-height: 2rem !important;
  padding: .34rem .65rem !important;
  font-size: .76rem !important;
}

.afe-pos-modal #cliente-search-results .list-group-item {
  padding: .45rem .55rem !important;
  font-size: .78rem;
}

.afe-inline-stat__label {
  font-size: .58rem !important;
  line-height: 1;
}

.afe-inline-stat__value {
  font-size: .9rem !important;
  line-height: 1.08;
}

.afe-pos-documents-table {
  font-size: .76rem !important;
}

.afe-pos-documents-table > :not(caption) > * > * {
  padding: .38rem .45rem !important;
  max-width: 14rem !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  line-height: 1.16 !important;
}

.afe-pos-documents-table .afe-doc-cell-main {
  min-width: 7rem;
}

.afe-pos-documents-table .afe-doc-flex-text {
  max-width: 11rem !important;
  overflow-wrap: anywhere !important;
}

.afe-pos-documents-table .afe-doc-key {
  max-width: 15rem !important;
  min-width: 0 !important;
  word-break: normal !important;
  overflow-wrap: anywhere !important;
}

.afe-pos-documents-table .afe-document-actions {
  gap: .2rem !important;
  flex-wrap: nowrap !important;
}

@media (max-width: 991.98px) {
  .afe-pos-top-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .afe-pos-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)) !important;
  }
}

@media (max-width: 767.98px) {
  .afe-app--pos .container-fluid {
    padding-inline: .65rem !important;
  }

  .afe-pos-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .afe-pos-product-card--commercial {
    min-height: 188px !important;
  }

  .afe-pos-top-controls {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* POS panel density correction */
.afe-app--negocio .afe-main {
  padding: .85rem 1rem !important;
}

.afe-app--negocio .afe-topbar__inner {
  min-height: 54px !important;
  padding: .55rem .85rem !important;
  gap: .55rem !important;
}

.afe-app--negocio .afe-topbar__title {
  font-size: .94rem !important;
  line-height: 1.12 !important;
}

.afe-app--negocio .afe-topbar__subtitle {
  margin-top: .08rem !important;
  font-size: .72rem !important;
  line-height: 1.15 !important;
}

.afe-app--negocio .afe-topbar__chip {
  height: 28px !important;
  padding-inline: .5rem !important;
  font-size: .68rem !important;
}

.afe-app--negocio .afe-page__header,
.afe-app--negocio .afe-main > .d-flex:first-child {
  margin-bottom: .7rem !important;
  gap: .55rem !important;
}

.afe-app--negocio .afe-page__title,
.afe-app--negocio .afe-main h1.h4,
.afe-app--negocio .afe-main .h4 {
  font-size: 1.05rem !important;
  line-height: 1.15 !important;
}

.afe-app--negocio .afe-page__subtitle,
.afe-app--negocio .afe-card__subtitle {
  display: none !important;
}

.afe-app--negocio .afe-card,
.afe-app--negocio .afe-main .card,
.afe-app--negocio .expense-card,
.afe-app--negocio .expense-hero,
.afe-app--negocio .modal-content {
  border-radius: 12px !important;
}

.afe-app--negocio .afe-card__header,
.afe-app--negocio .afe-main .card-header {
  padding: .65rem .75rem !important;
  gap: .5rem !important;
}

.afe-app--negocio .afe-card__body,
.afe-app--negocio .afe-card__footer,
.afe-app--negocio .afe-main .card-body,
.afe-app--negocio .afe-main .card-footer {
  padding: .75rem !important;
}

.afe-app--negocio .afe-card__title,
.afe-app--negocio .afe-main .card-header h2,
.afe-app--negocio .afe-main .card-header h3,
.afe-app--negocio .afe-main .card-header h5 {
  font-size: .86rem !important;
  line-height: 1.15 !important;
}

.afe-app--negocio .afe-main .p-5,
.afe-app--negocio .afe-main .p-lg-5,
.afe-app--negocio .afe-main .p-4,
.afe-app--negocio .afe-main .p-lg-4 {
  padding: .9rem !important;
}

.afe-app--negocio .afe-main .p-3,
.afe-app--negocio .afe-main .p-lg-3 {
  padding: .72rem !important;
}

.afe-app--negocio .afe-main .mb-5,
.afe-app--negocio .afe-main .mb-4 {
  margin-bottom: .85rem !important;
}

.afe-app--negocio .afe-main .mb-3 {
  margin-bottom: .6rem !important;
}

.afe-app--negocio .afe-main .gap-4,
.afe-app--negocio .afe-main .g-4 {
  gap: .85rem !important;
  --bs-gutter-x: .85rem !important;
  --bs-gutter-y: .85rem !important;
}

.afe-app--negocio .afe-main .gap-3,
.afe-app--negocio .afe-main .g-3 {
  gap: .6rem !important;
  --bs-gutter-x: .6rem !important;
  --bs-gutter-y: .6rem !important;
}

.afe-app--negocio .form-label {
  margin-bottom: .18rem !important;
  font-size: .72rem !important;
  line-height: 1.1 !important;
}

.afe-app--negocio .form-control,
.afe-app--negocio .form-select,
.afe-app--negocio .input-group .btn {
  min-height: 2.05rem !important;
  padding-top: .32rem !important;
  padding-bottom: .32rem !important;
  font-size: .78rem !important;
}

.afe-app--negocio textarea.form-control {
  min-height: 54px !important;
}

.afe-app--negocio .btn,
.afe-app--negocio .afe-btn {
  min-height: 2.05rem !important;
  padding: .34rem .65rem !important;
  font-size: .76rem !important;
}

.afe-app--negocio .afe-kpi-grid {
  gap: .6rem !important;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
  margin-bottom: .75rem !important;
}

.afe-app--negocio .afe-kpi,
.afe-app--negocio .afe-inline-stat,
.afe-app--negocio .expense-kpi {
  padding: .65rem !important;
  border-radius: 11px !important;
}

.afe-app--negocio .afe-kpi__icon {
  width: 1.9rem !important;
  height: 1.9rem !important;
  margin-bottom: .45rem !important;
}

.afe-app--negocio .afe-kpi__label,
.afe-app--negocio .afe-inline-stat__label {
  margin-bottom: .2rem !important;
  font-size: .62rem !important;
}

.afe-app--negocio .afe-kpi__value,
.afe-app--negocio .afe-inline-stat__value {
  font-size: 1.12rem !important;
  margin-bottom: .18rem !important;
}

.afe-app--negocio .afe-kpi__detail,
.afe-app--negocio .afe-inline-stat__hint {
  font-size: .68rem !important;
  line-height: 1.15 !important;
}

.afe-app--negocio .afe-sidebar__section {
  padding: .35rem .65rem 0 !important;
}

.afe-app--negocio .afe-sidebar__section-toggle {
  min-height: 32px !important;
  padding: .32rem .5rem !important;
  font-size: .72rem !important;
}

.afe-app--negocio .afe-nav {
  gap: 1px !important;
}

.afe-app--negocio .afe-nav__item {
  min-height: 34px !important;
  padding: .42rem .55rem !important;
  gap: .5rem !important;
  font-size: .78rem !important;
}

.afe-app--negocio .afe-brand {
  padding: .7rem .8rem !important;
}

.afe-app--negocio .afe-sidebar__footer {
  padding: .55rem .65rem .8rem !important;
  gap: .45rem !important;
}

.afe-app--negocio .afe-sidebar__helper {
  padding: .55rem .65rem !important;
}

.afe-app--negocio .afe-sidebar__helper-copy {
  font-size: .68rem !important;
  line-height: 1.25 !important;
}

.afe-app--negocio .expense-hero {
  box-shadow: 0 10px 28px rgba(15, 23, 42, .16) !important;
}

.afe-app--negocio .expense-toolbar .btn,
.afe-app--negocio .expense-actions .btn,
.afe-app--negocio .expense-modal-actions .btn {
  min-height: 2rem !important;
  border-radius: 10px !important;
}

.afe-app--negocio .expense-actions .btn,
.afe-app--negocio .expense-doc-icon {
  width: 2rem !important;
  height: 2rem !important;
}

.afe-app--negocio .expense-doc-icon {
  border-radius: 10px !important;
}

.afe-app--pos .afe-pos-section__head {
  min-height: auto !important;
}

.afe-app--pos .afe-pos-cart-line-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .45rem;
  align-items: start;
  margin-bottom: .35rem;
}

.afe-app--pos .afe-pos-cart-line-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .35rem;
}

.afe-app--pos .afe-pos-cart-line-actions form {
  margin: 0 !important;
}

.afe-app--pos .afe-pos-line__name,
.afe-app--pos .afe-pos-product-card__name,
.afe-app--negocio .table .fw-semibold {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

.afe-app--pos .afe-pos-line__name {
  -webkit-line-clamp: 2;
  line-height: 1.15;
}

.afe-app--pos .afe-pos-list {
  gap: .45rem !important;
  max-height: min(50vh, 520px) !important;
  overflow-y: auto;
  padding-right: .1rem;
}

.afe-app--pos .afe-pos-line {
  padding: .55rem !important;
}

.afe-app--pos .afe-pos-summary > .d-flex {
  margin-bottom: .3rem !important;
}

.afe-app--pos .afe-pos-summary > .d-flex:last-child {
  margin-bottom: 0 !important;
}

.afe-app--pos .afe-pos-product-grid {
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)) !important;
  gap: .45rem !important;
}

.afe-app--pos .afe-pos-product-card--commercial {
  min-height: 174px !important;
  padding: .45rem !important;
}

.afe-app--pos .afe-pos-product-card__media {
  margin-bottom: .28rem !important;
}

.afe-app--pos .afe-pos-product-card__thumb--cover,
.afe-app--pos .afe-pos-product-card__image {
  height: 72px !important;
}

.afe-app--pos .afe-pos-card-tags {
  min-height: 1.1rem !important;
  margin-bottom: .25rem !important;
}

.afe-app--pos .afe-pos-card-tags .badge {
  font-size: .57rem !important;
  padding: .18rem .28rem !important;
}

.afe-app--pos .afe-pos-product-card__name {
  min-height: 1.78rem !important;
  font-size: .75rem !important;
  line-height: 1.14 !important;
  -webkit-line-clamp: 2;
  margin-bottom: .18rem !important;
}

.afe-app--pos .afe-pos-product-card__meta {
  font-size: .6rem !important;
  margin-bottom: .25rem !important;
}

.afe-app--pos .afe-pos-price {
  font-size: .78rem !important;
  margin-bottom: .35rem !important;
}

.afe-app--pos .afe-pos-product-card--commercial form {
  gap: .32rem !important;
}

.afe-app--pos .afe-pos-qty-input {
  width: 3.75rem !important;
  max-width: 3.75rem !important;
  min-height: 1.72rem !important;
  font-size: .7rem !important;
}

.afe-app--pos .afe-pos-search {
  max-width: 360px;
}

.afe-app--pos .afe-pos-search input {
  min-width: min(100%, 210px) !important;
}

.afe-app--pos .afe-pos-toggle {
  line-height: 1 !important;
}

@media (max-width: 1199.98px) {
  .afe-app--pos .afe-pos-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)) !important;
  }
}

@media (max-width: 767.98px) {
  .afe-app--negocio .afe-main {
    padding: .65rem !important;
  }
  .afe-app--pos .afe-pos-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

.afe-app--negocio .afe-card__header p.text-muted,
.afe-app--negocio .afe-main .card-header p.text-muted,
.afe-app--negocio .afe-main > .d-flex:first-child p.text-muted {
  display: none !important;
}


.afe-app--pos [data-pos-add-trigger] {
  cursor: pointer;
  user-select: none;
}

.afe-app--pos [data-pos-add-trigger]:focus-visible {
  outline: 2px solid rgba(37, 99, 235, .45);
  outline-offset: 2px;
}

.afe-app--pos .afe-pos-product-card__media:hover .afe-pos-product-card__image,
.afe-app--pos .afe-pos-product-card__media:hover .afe-pos-product-card__thumb--cover,
.afe-app--pos .afe-pos-product-card__name:hover {
  filter: brightness(.98);
}
