:root {
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-700: #1e40af;
  --primary-soft: #eaf1ff;
  --secondary: #0ea5e9;
  --bg: #f6f8fc;
  --bg-2: #eef4ff;
  --card: #ffffff;
  --text: #101828;
  --muted: #667085;
  --muted-2: #98a2b3;
  --line: #e4e9f2;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #f97316;
  --warning-soft: #ffedd5;
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --purple: #7c3aed;
  --purple-soft: #ede9fe;
  --radius-xs: 10px;
  --radius-sm: 14px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --shadow-card: 0 18px 45px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 22px rgba(15, 23, 42, 0.06);
  --sidebar-width: 280px;
  --topbar-height: 82px;
  --mobile-nav-height: 78px;
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

body {
  overflow-x: hidden;
}

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

button {
  cursor: pointer;
}

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

.app-root {
  min-height: 100vh;
}

.app-loading {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 18px;
  text-align: center;
  color: var(--muted);
}

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  color: #fff;
  font-size: 24px;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  box-shadow: 0 18px 35px rgba(37, 99, 235, 0.28);
}

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 520px);
  background:
    radial-gradient(circle at 18% 18%, rgba(37, 99, 235, 0.18), transparent 28%),
    radial-gradient(circle at 65% 88%, rgba(14, 165, 233, 0.16), transparent 26%),
    linear-gradient(135deg, #eef5ff 0%, #ffffff 50%, #f6f8fc 100%);
}

.login-hero {
  position: relative;
  overflow: hidden;
  padding: 64px;
  display: flex;
  align-items: center;
}

.login-hero::before,
.login-hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
}

.login-hero::before {
  width: 360px;
  height: 360px;
  background: linear-gradient(135deg, rgba(37,99,235,0.22), rgba(14,165,233,0.08));
  top: 10%;
  left: 8%;
}

.login-hero::after {
  width: 220px;
  height: 220px;
  background: rgba(124,58,237,0.10);
  bottom: 12%;
  right: 14%;
}

.hero-card {
  position: relative;
  width: min(680px, 100%);
  padding: 44px;
  border-radius: 38px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(255,255,255,0.9);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px);
}

.hero-eyebrow {
  color: var(--primary);
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 12px;
  text-transform: uppercase;
}

.hero-title {
  font-size: clamp(38px, 5vw, 68px);
  line-height: 0.98;
  margin: 16px 0;
  letter-spacing: -0.06em;
}

.hero-text {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
  max-width: 560px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 34px;
}

.hero-mini-card {
  padding: 18px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid var(--line);
}

.hero-mini-card strong {
  display: block;
  font-size: 24px;
}

.hero-mini-card span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-card {
  width: min(420px, 100%);
  padding: 34px;
  border-radius: 30px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  color: var(--primary);
  font-size: 22px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  box-shadow: 0 12px 26px rgba(37,99,235,0.25);
}

.login-card h1 {
  margin: 34px 0 8px;
  font-size: 32px;
  letter-spacing: -0.04em;
}

.login-card p {
  margin: 0 0 24px;
  color: var(--muted);
}

.form-field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

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

.control {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  outline: none;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  transition: 0.2s ease;
}

textarea.control {
  height: auto;
  min-height: 98px;
  padding-top: 14px;
  resize: vertical;
}

.control:focus {
  border-color: rgba(37,99,235,0.7);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.12);
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 22px;
  font-size: 13px;
  color: var(--muted);
}

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

.link {
  color: var(--primary);
  font-weight: 700;
}

.btn {
  border: 0;
  border-radius: var(--radius-sm);
  height: 46px;
  padding: 0 18px;
  font-weight: 800;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #315cf6);
  box-shadow: 0 14px 24px rgba(37,99,235,0.24);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-600), var(--primary));
}

.btn-outline {
  color: var(--primary);
  background: #fff;
  border: 1px solid rgba(37,99,235,0.35);
}

.btn-soft {
  color: var(--primary);
  background: var(--primary-soft);
}

.btn-danger-soft {
  color: var(--danger);
  background: var(--danger-soft);
}

.w-full {
  width: 100%;
}

.login-hint {
  margin-top: 22px;
  padding: 14px;
  border-radius: 18px;
  color: var(--muted);
  font-size: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

/* App shell */
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 0;
  padding: 28px 18px;
  background: rgba(255,255,255,0.9);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  z-index: 20;
  overflow: hidden;
}

.nav {
  display: grid;
  gap: 7px;
  margin-top: 42px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  overscroll-behavior: contain;
}

.nav::-webkit-scrollbar {
  width: 5px;
}

.nav::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.nav-item {
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 15px;
  color: #344054;
  font-weight: 700;
  font-size: 14px;
  transition: 0.18s ease;
}

.nav-item:hover,
.nav-item.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 16px;
}

.help-card {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f8fbff, #fff);
  border: 1px solid var(--line);
}

.help-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

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

.version {
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: var(--topbar-height) 1fr;
}

.topbar {
  height: var(--topbar-height);
  background: rgba(255,255,255,0.86);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 15;
  backdrop-filter: blur(16px);
}

.search {
  position: relative;
  width: min(560px, 50vw);
}

.search input {
  padding-left: 46px;
  padding-right: 52px;
  height: 48px;
  border-radius: 14px;
}

.search .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  translate: 0 -50%;
  color: var(--muted);
}

.search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  translate: 0 -50%;
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--muted);
  background: #f2f5fa;
  font-size: 12px;
  font-weight: 800;
}

.topbar-spacer {
  flex: 1;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  color: #475467;
  position: relative;
}

.badge-dot {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  border: 2px solid #fff;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 8px;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  object-fit: cover;
  background: linear-gradient(135deg, #fee2e2, #dbeafe);
  border: 2px solid #fff;
  box-shadow: 0 8px 20px rgba(15,23,42,0.12);
}

.user-meta strong {
  display: block;
  font-size: 14px;
}

.user-meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.content {
  padding: 30px 32px 38px;
}

.mobile-header,
.mobile-bottom-nav {
  display: none;
}

/* Common layout */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.crumbs {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.page-title {
  margin: 0;
  font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -0.055em;
}

.page-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.card-pad {
  padding: 22px;
}

.grid {
  display: grid;
  gap: 18px;
}

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

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

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

.kpi-card {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 116px;
  padding: 20px;
}

.kpi-icon {
  width: 54px;
  height: 54px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 25px;
}

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

.kpi-card strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
  letter-spacing: -0.04em;
}

.trend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.trend.up {
  color: var(--success);
  background: var(--success-soft);
}

.trend.down {
  color: var(--danger);
  background: var(--danger-soft);
}

.bg-blue { background: #dbeafe; color: var(--primary); }
.bg-green { background: var(--success-soft); color: var(--success); }
.bg-orange { background: var(--warning-soft); color: var(--warning); }
.bg-purple { background: var(--purple-soft); color: var(--purple); }
.bg-red { background: var(--danger-soft); color: var(--danger); }

.section-title {
  margin: 0 0 16px;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.chart-placeholder {
  height: 240px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(37,99,235,0.10), rgba(37,99,235,0)),
    repeating-linear-gradient(to top, transparent, transparent 39px, #e7edf7 40px);
  position: relative;
  overflow: hidden;
}

.chart-placeholder svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.donut {
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background:
    conic-gradient(#2563eb 0 48%, #10b981 48% 73%, #8b5cf6 73% 88%, #f59e0b 88% 100%);
  display: grid;
  place-items: center;
  margin: 0 auto;
}

.donut-inner {
  width: 128px;
  height: 128px;
  border-radius: 999px;
  background: #fff;
  display: grid;
  place-items: center;
  text-align: center;
  box-shadow: inset 0 0 0 1px var(--line);
}

.donut-inner strong {
  font-size: 20px;
}

.list {
  display: grid;
}

.activity-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.activity-row:last-child {
  border-bottom: 0;
}

.activity-icon {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.activity-row strong {
  display: block;
  font-size: 14px;
}

.activity-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.pill {
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pill.success { color: var(--success); background: var(--success-soft); }
.pill.warning { color: var(--warning); background: var(--warning-soft); }
.pill.danger { color: var(--danger); background: var(--danger-soft); }
.pill.info { color: var(--primary); background: var(--primary-soft); }
.pill.neutral { color: var(--muted); background: #f2f5fa; }

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.quick-card {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
  font-weight: 800;
  color: #344054;
}

.quick-card span {
  font-size: 28px;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.table th,
.table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.table tr:last-child td {
  border-bottom: 0;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-img {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: #f2f5fa;
  object-fit: cover;
  flex: 0 0 auto;
}

.product-cell strong {
  display: block;
  font-size: 13px;
}

.product-cell span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.mobile-card-list {
  display: none;
}

.product-mobile-card {
  padding: 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.product-mobile-head {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 14px;
  align-items: center;
}

.product-mobile-img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 16px;
  background: #f2f5fa;
}

.product-mobile-card h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.product-mobile-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.product-mobile-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.product-mobile-meta span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.product-mobile-meta strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-chip {
  height: 42px;
  border-radius: 999px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #344054;
  font-weight: 800;
}

.filter-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 18px;
}

.document-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  gap: 24px;
  align-items: start;
  width: 100%;
  max-width: 100%;
}

.document-layout > *,
.document-layout .grid,
.document-layout .card,
.purchase-line-list {
  min-width: 0;
}

.summary-panel {
  position: sticky;
  top: calc(var(--topbar-height) + 22px);
  align-self: start;
  min-width: 0;
  width: 100%;
  z-index: 1;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.summary-line:last-child {
  border-bottom: 0;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 18px 0;
  font-size: 14px;
}

.summary-total strong {
  font-size: 28px;
  letter-spacing: -0.04em;
}

.info-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: #eff6ff;
  color: var(--primary);
  border: 1px solid #bfdbfe;
  font-weight: 700;
  font-size: 13px;
}

.info-box small {
  display: block;
  color: #475467;
  font-weight: 500;
  margin-top: 3px;
}

.line-editor {
  display: grid;
  gap: 10px;
}

.qty-control {
  display: inline-flex;
  height: 36px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.qty-control button {
  width: 34px;
  height: 34px;
  border: 0;
  color: var(--primary);
  background: #fff;
  font-weight: 900;
  font-size: 16px;
}

.qty-control span {
  width: 34px;
  text-align: center;
  font-weight: 800;
}

.mobile-sticky-actions {
  display: none;
}

/* Toasts */
.toast-root {
  position: fixed;
  right: 20px;
  top: 20px;
  z-index: 200;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 280px;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 16px;
  color: #344054;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  animation: toast-in .18s ease-out;
}

.toast.success { border-color: #bbf7d0; }
.toast.error { border-color: #fecaca; }
.toast strong {
  display: block;
  margin-bottom: 3px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* Maestros */
.master-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.master-sidebar {
  position: sticky;
  top: calc(var(--topbar-height) + 22px);
  max-height: calc(100vh - var(--topbar-height) - 44px);
  overflow: auto;
}

.master-tabs {
  display: grid;
  gap: 8px;
}

.master-tab {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: center;
  padding: 11px;
  text-align: left;
  color: #344054;
  transition: 0.16s ease;
}

.master-tab:hover,
.master-tab.active {
  background: var(--primary-soft);
  border-color: #bfdbfe;
  color: var(--primary);
}

.master-tab > span {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #fff;
  box-shadow: var(--shadow-soft);
  font-weight: 900;
}

.master-tab strong {
  display: block;
  font-size: 13px;
}

.master-tab small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  text-transform: capitalize;
}

.master-main {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.master-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

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

.master-search {
  min-width: 240px;
}

.master-form-card {
  scroll-margin-top: 100px;
}

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

.master-span-2 {
  grid-column: span 2;
}

.master-checkbox {
  min-height: 48px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  background: #fff;
}

.master-checkbox span {
  margin-bottom: 6px;
}

.master-checkbox input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

.master-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

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

.empty-inline {
  padding: 34px;
  color: var(--muted);
  text-align: center;
}


/* Responsive fix - maestros */
.content {
  max-width: 100%;
  overflow-x: hidden;
}

.btn-sm {
  height: 36px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 12px;
}

.master-layout,
.master-main,
.master-main .card {
  min-width: 0;
}

.master-layout {
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
}

.master-main .card {
  overflow: hidden;
}

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

.master-table {
  min-width: 760px;
  table-layout: fixed;
}

.master-table th,
.master-table td {
  padding: 13px 10px;
  font-size: 12.5px;
  line-height: 1.25;
  word-break: normal;
  overflow-wrap: anywhere;
}


.master-table .row-actions {
  flex-wrap: nowrap;
}

.master-table .pill {
  padding: 6px 9px;
  font-size: 11px;
}

.master-mobile-card {
  width: 100%;
  min-width: 0;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.master-mobile-card-head {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.master-mobile-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 900;
}

.master-mobile-title {
  min-width: 0;
}

.master-mobile-title h3 {
  margin: 0 0 4px;
  font-size: 16px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.master-mobile-title p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.master-mobile-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.master-mobile-details span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.master-mobile-details strong {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.master-mobile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.master-mobile-actions .btn {
  width: 100%;
}


/* Sidebar collapse */
.shell {
  transition: grid-template-columns 0.22s ease;
}

.shell.sidebar-collapsed {
  grid-template-columns: 0 1fr;
}

.shell.sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
  padding-left: 0;
  padding-right: 0;
  border-right: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.desktop-menu-toggle {
  flex: 0 0 auto;
}

/* Compras */
.purchase-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.purchase-search {
  max-width: 360px;
}

.purchase-table {
  min-width: 860px;
  table-layout: fixed;
}

.purchase-table th,
.purchase-table td {
  overflow-wrap: anywhere;
}

.purchase-lines-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.purchase-line-list {
  display: grid;
  gap: 12px;
}

.purchase-line {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(92px, .48fr) minmax(118px, .58fr) minmax(112px, .56fr) minmax(116px, .58fr) minmax(116px, .58fr) minmax(130px, .64fr) 48px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  max-width: 100%;
}

.purchase-line .form-field {
  margin-bottom: 0;
}

.purchase-line > * {
  min-width: 0;
}


.purchase-line-subtotal {
  min-height: 48px;
  display: grid;
  align-content: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}

.purchase-line-subtotal span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.purchase-line-subtotal strong {
  margin-top: 3px;
  font-size: 14px;
}


/* Salidas y transferencias */
.transfer-line {
  grid-template-columns: minmax(260px, 1.4fr) minmax(120px, .6fr) minmax(180px, .8fr) 54px;
}

.purchase-line select,
.purchase-line input {
  min-width: 0;
}


.purchase-price-field {
  gap: 7px;
}

.purchase-entry-type {
  min-height: 48px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 0 10px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: #eff6ff;
}

.purchase-entry-type > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.purchase-entry-type.active {
  background: #fff7ed;
  border-color: #fed7aa;
}

.purchase-entry-type.active > span {
  color: #c2410c;
}

.purchase-gift-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  padding: 0;
  border-radius: 999px;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  width: fit-content;
}

.purchase-entry-type.active .purchase-gift-check {
  color: #c2410c;
}

.purchase-gift-check input {
  width: 15px;
  height: 15px;
  accent-color: #f97316;
}

.purchase-gift-check strong {
  line-height: 1;
}

.purchase-line-gift {
  border-color: #fed7aa;
  background: linear-gradient(135deg, #fff7ed 0%, #ffffff 42%);
}


/* Reevaluaciones */
.reevaluation-layout {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.reevaluation-form {
  margin-top: 18px;
}

.cost-current-card {
  min-height: 78px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, #eff6ff, #ffffff);
  border: 1px solid #bfdbfe;
  display: grid;
  align-content: center;
}

.cost-current-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cost-current-card strong {
  margin-top: 5px;
  color: var(--primary);
  font-size: 22px;
  letter-spacing: -0.04em;
}

.reevaluation-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.reevaluation-table {
  min-width: 940px;
  table-layout: fixed;
}

.timeline {
  display: grid;
  gap: 18px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  position: relative;
}

.timeline-item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 26px;
  width: 2px;
  height: calc(100% + 2px);
  background: var(--line);
}

.timeline-item > span {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #e2e8f0;
  border: 5px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
  z-index: 1;
}

.timeline-item.active > span {
  background: var(--primary);
  box-shadow: 0 0 0 5px rgba(37,99,235,.14);
}

.timeline-item strong {
  display: block;
  font-size: 14px;
}

.timeline-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}


/* Reportes funcionales */
.report-layout {
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.report-sidebar {
  position: sticky;
  top: calc(var(--topbar-height) + 22px);
  max-height: calc(100vh - var(--topbar-height) - 44px);
  overflow: auto;
}

.report-main {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  align-items: end;
}

.report-filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.report-table {
  min-width: 980px;
  table-layout: fixed;
}

.report-table th,
.report-table td {
  overflow-wrap: anywhere;
  vertical-align: middle;
}

.report-charts {
  align-items: stretch;
}

.report-tabs .master-tab {
  min-height: 62px;
}

/* Dialogos de maestros */
.master-list-card {
  min-height: min(760px, calc(100vh - var(--topbar-height) - 148px));
}

.master-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(8px);
}

.master-dialog {
  width: min(980px, 100%);
  max-height: min(86vh, 860px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: 28px;
  background: var(--card);
  border: 1px solid rgba(255,255,255,.72);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
}

.master-dialog-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
}

.master-dialog-top small {
  display: block;
  margin-bottom: 6px;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 11px;
}

.master-dialog-top h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
  color: var(--text);
}

.master-dialog-top p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.master-dialog-close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 16px;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
}

.master-dialog-close:hover {
  color: var(--danger);
  background: #fff5f5;
  border-color: #fecaca;
}

.master-dialog-body {
  min-height: 0;
  overflow: auto;
  padding: 24px;
}

.master-dialog .master-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.master-dialog .master-span-2 {
  grid-column: span 2;
}

.master-dialog .master-form-actions {
  position: sticky;
  bottom: -24px;
  z-index: 2;
  margin: 24px -24px -24px;
  padding: 16px 24px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}


/* Ajuste final de grids y columna de acciones */
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.table {
  border-spacing: 0;
}

.table tbody tr.grid-row-selected td,
.table tbody tr:hover td {
  box-shadow: none !important;
}

.table tbody tr.grid-row-selected td {
  background: #dbeafe !important;
}

.table .table-actions-header,
.table .table-actions-cell {
  width: auto !important;
  min-width: 156px;
  white-space: nowrap !important;
  overflow: visible !important;
}

.table .table-actions-cell {
  position: relative;
  z-index: 2;
}

.table .table-actions-cell .row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: nowrap !important;
  width: max-content;
  max-width: none;
  overflow: visible;
  position: relative;
  z-index: 4;
}

.table .table-actions-cell .btn,
.table .table-actions-cell button {
  pointer-events: auto;
  flex: 0 0 auto;
}

.master-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto !important;
}

.master-table th,
.master-table td {
  overflow-wrap: normal !important;
  word-break: normal !important;
}

.master-table th:not(.table-actions-header),
.master-table td:not(.table-actions-cell) {
  min-width: 120px;
  max-width: 240px;
}

.master-table .table-actions-header,
.master-table .table-actions-cell {
  min-width: 264px;
  max-width: none;
}

.master-table .table-actions-cell {
  background-clip: padding-box;
}

.purchase-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto !important;
}

.purchase-table th:not(.table-actions-header),
.purchase-table td:not(.table-actions-cell) {
  min-width: 120px;
  max-width: 260px;
}

.purchase-table .table-actions-header,
.purchase-table .table-actions-cell {
  min-width: 210px;
}

.master-icon-action {
  width: 44px;
  min-width: 44px;
  padding-inline: 0;
}

.master-table[data-catalog="productos"] .table-actions-header,
.master-table[data-catalog="productos"] .table-actions-cell,
.master-table[data-catalog="proveedores"] .table-actions-header,
.master-table[data-catalog="proveedores"] .table-actions-cell {
  min-width: 276px;
}


/* Fix v18 - seleccion y acciones de grids en maestros */
.master-table {
  table-layout: auto !important;
  width: max-content !important;
  min-width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

.master-table th,
.master-table td {
  min-width: 118px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.master-table .table-actions-header,
.master-table .table-actions-cell {
  width: 296px !important;
  min-width: 296px !important;
  max-width: 296px !important;
  overflow: visible !important;
}

.master-table .table-actions-cell .row-actions {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  width: 100% !important;
  max-width: 100% !important;
  justify-content: flex-start !important;
  align-items: center !important;
  overflow: visible !important;
}

.master-icon-action,
.master-table .table-actions-cell button,
.master-mobile-actions button {
  pointer-events: auto !important;
  position: relative;
  z-index: 8;
  flex: 0 0 auto;
}

.master-table tbody tr[data-master-row-id] {
  cursor: pointer;
}

.master-table tbody tr.grid-row-selected td,
.master-table tbody tr.grid-row-selected:hover td {
  background: #dbeafe !important;
  box-shadow: none !important;
  outline: none !important;
}


/* Fix v19 - selección real y clics en acciones de maestros */
.master-table tbody tr[data-master-row-id],
.master-mobile-card[data-master-row-id] {
  cursor: pointer;
}

.master-table tbody tr.grid-row-selected td,
.master-table tbody tr[data-selected="true"] td,
.master-table tbody tr.grid-row-selected:hover td,
.master-table tbody tr[data-selected="true"]:hover td {
  background: #dbeafe !important;
  box-shadow: none !important;
  outline: none !important;
}

.master-table .table-actions-cell,
.master-table .table-actions-cell *,
.master-mobile-actions,
.master-mobile-actions * {
  pointer-events: auto !important;
}

.master-table .table-actions-cell {
  position: relative !important;
  z-index: 25 !important;
  overflow: visible !important;
}

.master-table .table-actions-cell .row-actions {
  position: relative !important;
  z-index: 30 !important;
}

.master-table .table-actions-cell button,
.master-icon-action,
.master-mobile-actions button {
  position: relative !important;
  z-index: 35 !important;
  cursor: pointer !important;
}

/* Fix v20: dialogos y toasts por encima de los modales de maestros */
.swal2-container {
  z-index: 20000 !important;
}

.toast-root {
  z-index: 20000 !important;
}

.app-dialog-overlay {
  z-index: 20000 !important;
}

.history-filters {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.master-dialog .history-filters {
  align-items: end;
}

.purchase-line-remove {
  min-height: 48px;
}

/* v24 - Vencimientos: tabla compacta sin scroll horizontal innecesario */
.expiration-editor-card {
  width: min(760px, 96vw) !important;
}

.expiration-editor-wrap {
  overflow-x: hidden;
}

.expiration-editor-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.expiration-editor-table .expiration-date-col {
  width: auto;
}

.expiration-editor-table .expiration-available-col {
  width: 120px;
}

.expiration-editor-table .expiration-qty-col {
  width: 150px;
}

.expiration-editor-table .expiration-action-col {
  width: 64px;
}

.expiration-editor-table th,
.expiration-editor-table td {
  white-space: normal;
  vertical-align: middle;
}

.expiration-date-control,
.expiration-qty-control {
  width: 100%;
  min-width: 0;
}

.expiration-qty-control {
  max-width: 132px;
}

.expiration-action-cell {
  text-align: right;
}

.expiration-remove-btn {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}

@media (max-width: 640px) {
  .expiration-editor-card {
    width: 100% !important;
  }

  .expiration-editor-table .expiration-available-col {
    width: 92px;
  }

  .expiration-editor-table .expiration-qty-col {
    width: 112px;
  }

  .expiration-editor-table .expiration-action-col {
    width: 48px;
  }

  .expiration-qty-control {
    max-width: 100px;
  }

  .expiration-remove-btn {
    width: 36px;
    min-width: 36px;
    height: 36px;
  }
}

/* v35 - alertas de vencimiento en inventario */
.inventory-avatar-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.inventory-expiration-alert {
  position: absolute;
  right: -7px;
  top: -7px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fed7aa;
  display: grid;
  place-items: center;
  font-size: 13px;
  box-shadow: 0 8px 18px rgba(234, 88, 12, .18);
  z-index: 2;
}

.inventory-expiration-table-wrap {
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.inventory-expiration-table {
  margin: 0;
  min-width: 720px;
}

.inventory-expiration-table th {
  background: #eff6ff;
}

.dashboard-expiration-breakdown button {
  text-align: left;
}

/* v36 - detalle de vencimientos: contenido más limpio y tablas sin bordes redondeados */
.inventory-expiration-dialog-content {
  text-align: left;
  display: grid;
  gap: 18px;
}

.inventory-expiration-summary {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) repeat(3, minmax(150px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.inventory-expiration-summary-card {
  padding: 13px 14px;
  border: 1px solid #dbe4f0;
  background: #f8fafc;
  min-width: 0;
}

.inventory-expiration-summary-card span {
  display: block;
  margin-bottom: 5px;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.inventory-expiration-summary-card strong {
  display: block;
  color: #111827;
  font-size: 15px;
  line-height: 1.25;
  word-break: break-word;
}

.inventory-expiration-summary-card-accent {
  border-color: #fed7aa;
  background: #fff7ed;
}

.inventory-expiration-summary-card-accent strong {
  color: #c2410c;
}

.inventory-expiration-table-wrap {
  border-radius: 0 !important;
  border: 1px solid #dbe4f0;
  box-shadow: none;
}

.inventory-expiration-table {
  min-width: 680px;
}

.inventory-expiration-table th,
.inventory-expiration-table td {
  padding: 13px 14px;
}

.inventory-expiration-table th {
  background: #eef5ff !important;
  color: #1f2937;
  border-bottom: 1px solid #bfdbfe;
}

.inventory-expiration-table tbody td {
  background: #fff !important;
}

.inventory-expiration-table tbody tr:hover td {
  background: #f8fafc !important;
}

.inventory-dialog-overlay .master-dialog-body {
  background: #fff;
}

@media (max-width: 960px) {
  .inventory-expiration-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-expiration-summary-card-wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .inventory-expiration-summary {
    grid-template-columns: 1fr;
  }
}

/* Buscador reutilizable de productos */
.product-search-field {
  min-width: 0;
}

.product-search-trigger {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}

.product-search-trigger:hover {
  border-color: rgba(37, 99, 235, .36);
  background: #f8fafc;
}

.product-search-trigger.has-value {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.product-search-trigger:disabled {
  opacity: .7;
  cursor: not-allowed;
}

.product-search-trigger-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.product-search-trigger-text strong,
.product-search-trigger-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-search-trigger-text strong {
  font-size: 13px;
  font-weight: 800;
}

.product-search-trigger-text small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.product-search-trigger em {
  flex: 0 0 auto;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  color: #2563eb;
  background: #fff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 5px 9px;
}

.shared-product-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 3600;
  background: rgba(15, 23, 42, .52);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.shared-product-picker-dialog {
  width: min(920px, 96vw);
  max-height: 88vh;
  overflow: hidden;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .30);
  display: flex;
  flex-direction: column;
}

.shared-product-picker-head {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(148, 163, 184, .22);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  background: #f8fafc;
}

.shared-product-picker-head small {
  display: block;
  color: #2563eb;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.shared-product-picker-head h2 {
  margin: 0;
  color: #0f172a;
  font-size: 20px;
}

.shared-product-picker-head p {
  margin: 4px 0 0;
  color: #64748b;
  font-weight: 700;
  line-height: 1.35;
}

.shared-product-picker-filters {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(148, 163, 184, .16);
}

.shared-product-picker-count {
  padding: 9px 20px;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.shared-product-picker-results {
  padding: 0 20px 20px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.shared-product-picker-result {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, .28);
  background: #fff;
  border-radius: 16px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) max-content;
  gap: 10px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}

.shared-product-picker-result:hover {
  background: #f8fafc;
  border-color: rgba(37, 99, 235, .35);
}

.shared-product-picker-result.selected {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, .50);
}

.shared-product-picker-result:disabled {
  cursor: not-allowed;
  opacity: .68;
  background: #f8fafc;
}

.shared-product-picker-avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 900;
  font-size: 13px;
}

.shared-product-picker-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.shared-product-picker-main strong {
  color: #0f172a;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shared-product-picker-main small {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.shared-product-picker-status {
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
}

.shared-product-picker-empty {
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  color: #64748b;
  font-weight: 800;
  text-align: center;
}

@media (max-width: 700px) {
  .shared-product-picker-overlay {
    align-items: stretch;
    padding: 10px;
  }

  .shared-product-picker-dialog {
    width: 100%;
    max-height: 94vh;
  }

  .shared-product-picker-result {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .shared-product-picker-status {
    grid-column: 2;
  }
}

.shared-product-picker-pagination {
  padding: 10px 20px 18px;
  border-top: 1px solid rgba(148, 163, 184, .16);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

.shared-product-picker-pagination .small {
  min-height: 34px;
  padding: 7px 12px;
}

.shared-product-picker-pagination button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

@media (max-width: 700px) {
  .shared-product-picker-pagination {
    justify-content: space-between;
    padding: 10px 14px 14px;
  }
}


/* Compact dropdown actions used by list rows */
.compact-actions-menu{
  display:inline-block;
  position:relative;
  text-align:left;
  min-width:104px;
}
.compact-actions-menu[open]{
  z-index:20;
}
.compact-actions-trigger{
  list-style:none;
  cursor:pointer;
  user-select:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  min-height:34px;
  padding:8px 12px;
  border:1px solid #bfdbfe;
  border-radius:12px;
  background:#fff;
  color:#1d4ed8;
  font-weight:900;
  font-size:.78rem;
  box-shadow:0 8px 18px rgba(37,99,235,.08);
}
.compact-actions-trigger::-webkit-details-marker{display:none;}
.compact-actions-trigger::after{
  content:'▾';
  font-size:.68rem;
  line-height:1;
  color:#2563eb;
}
.compact-actions-menu[open] .compact-actions-trigger{
  background:#eff6ff;
  border-color:#93c5fd;
}
.compact-actions-list{
  display:grid;
  gap:5px;
  margin-top:7px;
  min-width:150px;
  padding:7px;
  border:1px solid rgba(191,219,254,.95);
  border-radius:14px;
  background:#fff;
  box-shadow:0 18px 45px rgba(15,23,42,.16);
}
.compact-actions-item{
  width:100%;
  border:0;
  background:#f8fafc;
  color:#334155;
  border-radius:10px;
  padding:8px 10px;
  text-align:left;
  font-weight:900;
  font-size:.78rem;
  cursor:pointer;
  display:flex;
  align-items:center;
  gap:8px;
}
.compact-actions-item:hover,
.compact-actions-item:focus{
  background:#e0f2fe;
  color:#1d4ed8;
  outline:none;
}
.compact-actions-item.is-primary{
  color:#1d4ed8;
  background:#eff6ff;
}
.compact-actions-item.is-danger{
  color:#b91c1c;
  background:#fef2f2;
}
.compact-actions-item.is-danger:hover,
.compact-actions-item.is-danger:focus{
  background:#fee2e2;
  color:#991b1b;
}
.compact-actions-icon{
  width:18px;
  display:inline-flex;
  justify-content:center;
  flex:0 0 18px;
}
.table-actions-cell .compact-actions-menu{
  min-width:auto;
}
.compact-mobile-actions .compact-actions-menu,
.compact-mobile-actions .compact-actions-trigger{
  width:100%;
}
.compact-mobile-actions .compact-actions-list{
  width:100%;
}

/* v193 CXP / payment split */
.purchase-payment-box {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid rgba(37, 99, 235, .14);
  border-radius: 20px;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.purchase-payment-head {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.purchase-payment-head h3 {
  margin: 0;
  font-size: 1rem;
  color: #0f172a;
}

.purchase-payment-head p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: .9rem;
}

.purchase-payment-summary {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid rgba(226, 232, 240, .9);
  color: #64748b;
  font-size: .9rem;
}

.form-field.is-required > span::after {
  content: ' *';
  color: #dc2626;
}

/* v217 - CXC: ventana de movimientos homologada con el detalle de CXP */
.cxc-detail-overlay {
  padding: 18px !important;
}

.app-dialog.cxc-movements-dialog {
  width: min(920px, calc(100vw - 28px)) !important;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 22px !important;
  border-radius: 24px;
  background: #fff;
}

.cxc-movements-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 0 0 16px;
  border-bottom: 1px solid rgba(226, 232, 240, .95);
  background: #fff;
}

.cxc-movements-title-block {
  min-width: 0;
}

.cxc-movements-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: #2563eb;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.app-dialog.cxc-movements-dialog .cxc-movements-header h2 {
  margin: 0;
  color: #0f172a;
  font-size: clamp(1.55rem, 2.6vw, 2rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.app-dialog.cxc-movements-dialog .cxc-movements-header p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: .95rem;
  line-height: 1.35;
}

.cxc-dialog-close {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 14px;
  background: #fff;
  color: #334155;
  box-shadow: none;
}

.cxc-dialog-close:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

.cxc-movements-body {
  overflow: auto;
  padding: 0;
}

.cxc-movements-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin: 16px 0 12px;
}

.cxc-money-card {
  display: grid;
  gap: 4px;
  min-height: auto;
  padding: 12px;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 16px;
  background: #f8fafc;
  box-shadow: none;
}

.cxc-money-card span,
.cxc-movements-meta span {
  color: #64748b;
  font-size: .74rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .045em;
}

.cxc-money-card strong {
  color: #0f172a;
  font-size: 1.08rem;
  line-height: 1.15;
  white-space: nowrap;
}

.cxc-money-card.primary,
.cxc-money-card.success,
.cxc-money-card.neutral {
  border-color: rgba(226, 232, 240, .95);
  background: #f8fafc;
}

.cxc-movements-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.cxc-movements-meta article {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 16px;
  background: #f8fafc;
}

.cxc-movements-meta strong {
  color: #0f172a;
  font-size: .94rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.cxc-origin-link {
  border: 0;
  background: transparent;
  color: #0f172a;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  padding: 0;
  text-align: left;
  text-decoration: none;
}

.cxc-origin-link:hover {
  color: #2563eb;
  text-decoration: underline;
}

.cxc-movements-section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin: 4px 0 10px;
}

.cxc-movements-section-title h3 {
  margin: 0;
  color: #0f172a;
  font-size: 1.1rem;
}

.cxc-movements-section-title > strong {
  color: #64748b;
  font-size: .86rem;
}

.cxc-movements-table-wrap {
  overflow: auto;
  max-height: 42vh;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 16px;
  background: #fff;
}

.cxc-movements-table {
  width: 100%;
  min-width: 0 !important;
  table-layout: fixed;
  border-collapse: collapse;
}

.cxc-movements-table th,
.cxc-movements-table td {
  padding: 13px 11px;
  border-bottom: 1px solid rgba(226, 232, 240, .95);
  white-space: normal;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.cxc-movements-table th {
  background: #dbeafe;
  color: #0f172a;
  font-size: .74rem;
  font-weight: 900;
}

.cxc-movements-table tr:last-child td {
  border-bottom: 0;
}

.cxc-movements-table .right {
  text-align: right;
}

.cxc-movement-date-col {
  width: 22%;
}

.cxc-movement-type-col {
  width: 18%;
}

.cxc-movement-money-col {
  width: 14%;
}

.cxc-movement-ref-col {
  width: 19%;
}

.cxc-movement-type {
  color: #2563eb;
}

.cxc-empty-movement {
  padding: 20px;
  border: 1px dashed rgba(148, 163, 184, .75);
  border-radius: 18px;
  color: #64748b;
  font-weight: 800;
  text-align: center;
  background: #f8fafc;
}

.app-dialog-actions.cxc-movements-actions {
  margin-top: 16px;
  padding: 0;
  border-top: 1px solid rgba(226, 232, 240, .95);
  padding-top: 16px;
  background: #fff;
}

@media (max-width: 760px) {
  .cxc-detail-overlay {
    padding: 10px !important;
  }

  .app-dialog.cxc-movements-dialog {
    width: calc(100vw - 20px) !important;
    max-height: 92vh;
  }

  .cxc-movement-date-col,
  .cxc-movement-type-col,
  .cxc-movement-money-col,
  .cxc-movement-ref-col {
    width: auto;
  }
}

@media (max-width: 639px) {
  .cxc-detail-overlay {
    padding: 0 !important;
  }

  .app-dialog.cxc-movements-dialog {
    width: 100% !important;
    max-height: 94vh;
    border-radius: 24px 24px 0 0;
  }

  .cxc-movements-summary,
  .cxc-movements-meta {
    grid-template-columns: 1fr;
  }

  .cxc-movements-section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .cxc-movements-table {
    min-width: 680px !important;
  }

  .cxc-movements-actions .btn {
    width: 100%;
  }
}

/* v231: ajustes de pie de dialogos de busqueda con opcion Todos */
.shared-entity-picker-dialog .shared-product-picker-pagination:empty {
  display: none;
}

.shared-entity-picker-actions {
  width: 100%;
  box-sizing: border-box;
  margin: 0 !important;
  padding: 14px 20px 20px;
  border-top: 1px solid rgba(148, 163, 184, .18);
  background: #fff;
  display: flex !important;
  align-items: center;
  justify-content: flex-end !important;
  gap: 10px;
  flex: 0 0 auto;
}

.shared-entity-picker-actions .btn {
  min-width: 104px;
  min-height: 44px;
  border-radius: 14px;
  font-weight: 900;
}

.shared-entity-picker-actions .btn-outline {
  background: #fff;
  border-color: #93c5fd;
  color: #2563eb;
}

.shared-entity-picker-actions .btn-primary {
  box-shadow: 0 14px 30px rgba(37, 99, 235, .22);
}

@media (max-width: 560px) {
  .shared-entity-picker-actions {
    padding: 12px 14px 14px;
  }

  .shared-entity-picker-actions .btn {
    flex: 1 1 0;
    min-width: 0;
  }
}
