:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --ink: #172033;
  --muted: #6b7280;
  --line: #e6ebf2;
  --primary: #2a5bd7;
  --primary-2: #6f8ff2;
  --sidebar: #101828;
  --success: #0f9d58;
  --danger: #d93025;
  --warning: #fbbc05;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--ink); }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 280px; background: linear-gradient(180deg, #0f172a 0%, #101828 100%); color: #fff; padding: 1.25rem; position: sticky; top: 0; height: 100vh; }
.brand-block { display: flex; gap: .875rem; align-items: center; padding: .75rem; border-radius: 1rem; background: rgba(255,255,255,.06); margin-bottom: 1rem; }
.brand-mark { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, #4f7cff, #7aa2ff); font-size: 1.25rem; }
.brand-title { font-weight: 800; letter-spacing: .2px; }
.brand-subtitle { font-size: .85rem; color: rgba(255,255,255,.75); }
.sidebar-nav .nav-link { color: rgba(255,255,255,.82); border-radius: 14px; padding: .85rem 1rem; display: flex; align-items: center; gap: .8rem; font-weight: 600; }
.sidebar-nav .nav-link:hover, .sidebar-nav .nav-link.active { background: rgba(255,255,255,.11); color: #fff; }
.sidebar-footer { margin-top: auto; padding-top: 1rem; }
.content-area { flex: 1; min-width: 0; }
.topbar { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: 1.25rem 1.5rem; background: rgba(255,255,255,.75); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 100; }
.page-title { font-size: 1.25rem; font-weight: 800; }
.page-subtitle { color: var(--muted); font-size: .92rem; }
.topbar-user { display: flex; align-items: center; gap: .75rem; background: #fff; border: 1px solid var(--line); padding: .5rem .75rem; border-radius: 999px; }
.avatar { width: 42px; height: 42px; border-radius: 999px; background: linear-gradient(135deg, #1d4ed8, #60a5fa); color: #fff; display: grid; place-items: center; font-weight: 800; }
.page-wrapper { padding: 1.5rem; }
.card-panel, .metric-card, .form-panel { background: var(--card); border: 1px solid var(--line); border-radius: 1.25rem; box-shadow: 0 12px 30px rgba(15, 23, 42, .05); }
.metric-card { padding: 1rem 1.1rem; height: 100%; }
.metric-card .metric-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: rgba(42, 91, 215, .1); color: var(--primary); font-size: 1.2rem; }
.metric-card .metric-value { font-size: 1.8rem; font-weight: 800; margin-top: .6rem; }
.metric-card .metric-label { color: var(--muted); font-size: .92rem; }
.card-panel { padding: 1.15rem; }
.card-panel h5 { font-weight: 800; margin-bottom: 1rem; }
.card-soft { border-radius: 1rem; background: #f9fbff; border: 1px solid var(--line); }
.table thead th { background: #f8fbff; color: #334155; border-bottom-width: 1px; }
.table td, .table th { vertical-align: middle; }
.badge { font-weight: 700; border-radius: 999px; padding: .55em .8em; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border: none; box-shadow: 0 10px 18px rgba(42, 91, 215, .22); }
.btn-soft-danger { background: #fff1f2; border: 1px solid #fecdd3; color: #be123c; }
.btn-soft-secondary { background: #f8fafc; border: 1px solid var(--line); color: #334155; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-title { font-size: 1.1rem; font-weight: 800; }
.section-note { color: var(--muted); font-size: .92rem; }
.form-panel { padding: 1.25rem; }
.form-control, .form-select { border-radius: .9rem; padding: .75rem .95rem; border-color: #d9e2ec; }
.form-control:focus, .form-select:focus { border-color: #9fb8ff; box-shadow: 0 0 0 .2rem rgba(42,91,215,.12); }
.label-text { font-weight: 700; margin-bottom: .4rem; }
.hero-login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.hero-side { background: linear-gradient(135deg, #0f172a, #1e3a8a 55%, #60a5fa); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: center; }
.hero-side h1 { font-size: 2.4rem; font-weight: 800; }
.hero-side p { color: rgba(255,255,255,.82); max-width: 520px; }
.hero-bullets { display: grid; gap: 1rem; margin-top: 1.5rem; }
.hero-bullet { display: flex; gap: 1rem; align-items: start; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.08); padding: 1rem; border-radius: 1rem; }
.hero-bullet i { font-size: 1.2rem; }
.login-side { display: grid; place-items: center; padding: 2rem; }
.login-card { width: min(460px, 100%); background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 1.5rem; padding: 2rem; box-shadow: 0 25px 45px rgba(15,23,42,.08); }
.login-logo { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; font-size: 1.4rem; margin-bottom: 1rem; }
.portal-wrap { max-width: 1040px; margin: 0 auto; padding: 2rem 1rem 3rem; }
.portal-card { background: #fff; border: 1px solid var(--line); border-radius: 1.5rem; padding: 1.25rem; box-shadow: 0 18px 40px rgba(15,23,42,.06); }
.timeline-item { padding: .85rem 0; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: 0; }
.small-muted { color: var(--muted); font-size: .88rem; }
@media (max-width: 991.98px) {
  .hero-login { grid-template-columns: 1fr; }
  .hero-side { min-height: 340px; }
  .page-wrapper { padding: 1rem; }
  .topbar { padding: 1rem; }
}
@media (max-width: 575.98px) {
  .topbar-user { padding: .35rem .5rem; }
  .page-title { font-size: 1.05rem; }
  .page-subtitle { display: none; }
  .login-card { padding: 1.4rem; }
  .hero-side { padding: 2rem 1.25rem; }
}

.action-group{display:inline-flex;gap:.35rem;flex-wrap:wrap;justify-content:flex-end}
.info-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem 1.25rem}
.info-grid span{display:block;font-size:.82rem;color:var(--muted);margin-bottom:.2rem}
.info-grid strong{display:block;font-size:1rem}
.list-group-item{border-color:var(--line)!important}
@media (max-width: 767.98px){.info-grid{grid-template-columns:1fr}}

.config-card{position:relative;overflow:hidden}.config-icon{width:58px;height:58px;border-radius:18px;display:grid;place-items:center;font-size:1.35rem}.col-span-2{grid-column:span 2}.table td .badge.text-bg-light{background:#eef4ff!important;color:#274690!important}

.sidebar {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.18) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 999px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.24); }

.ingredient-head {
  background: linear-gradient(135deg, #2a6de6, #1f6fe5);
  color: #fff;
}
.budget-switch-wrap {
  padding: .9rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 16px;
  width: 100%;
  background: #fbfcfe;
}
.btn-soft-danger {
  background: #fff5f5;
  color: #dc3545;
  border: 1px solid #f5c2c7;
}
.btn-soft-danger:hover {
  background: #ffe5e5;
  color: #b02a37;
}

.sidebar { display:flex; flex-direction:column; }
.sidebar-scroll{overflow-y:auto;overflow-x:hidden;flex:1;padding-right:.25rem;}
.sidebar-scroll::-webkit-scrollbar{width:6px;}
.sidebar-scroll::-webkit-scrollbar-thumb{background:rgba(255,255,255,.12);border-radius:999px;}
.sidebar-scroll::-webkit-scrollbar-track{background:transparent;}
.sidebar .btn-outline-light{border-color:rgba(255,255,255,.7);color:#fff;}
.sidebar .btn-outline-light:hover{background:rgba(255,255,255,.1);}

/* === Categorias y Procesos visual refresh === */
body.app-body { background: #eef2f6; }
.content-area main.page-wrapper { max-width: 1460px; margin: 0 auto; width: 100%; }
.topbar {
  background: rgba(255,255,255,.88);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .04);
}
.page-wrapper { padding: 1.5rem 1.6rem 2rem; }
.section-head.cp-header { margin-bottom: 1.4rem; }
.cp-screen .section-title { color: #0f172a; letter-spacing: -.02em; }
.cp-screen .section-note { color: #64748b; font-size: .98rem; }
.cp-btn-primary,
.cp-btn-secondary {
  border-radius: 14px;
  min-height: 46px;
  padding: .72rem 1.15rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cp-btn-primary {
  background: linear-gradient(135deg, #17985b, #16834f);
  border-color: #16834f;
  box-shadow: 0 10px 18px rgba(22, 131, 79, .18);
}
.cp-btn-primary:hover,
.cp-btn-primary:focus {
  background: linear-gradient(135deg, #14834e, #126c42);
  border-color: #126c42;
}
.cp-empty-state {
  border-radius: 24px;
  padding: 3rem 1.5rem !important;
}
.cp-empty-icon {
  width: 78px;
  height: 78px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: linear-gradient(135deg, #e8f5ee, #dff0e7);
  color: #16834f;
  font-size: 2rem;
}
.cp-category-card {
  background: #fff;
  border: 1px solid #dde5ee;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 16px 38px rgba(15, 23, 42, .05);
}
.cp-category-header {
  padding: 1.35rem 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #ebf0f5;
}
.cp-category-main {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}
.cp-category-icon {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: #e7f4ec;
  color: #16834f;
  font-size: 1.4rem;
}
.cp-category-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
}
.cp-category-title {
  font-size: 1.95rem;
  line-height: 1.1;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -.03em;
}
.cp-category-description {
  color: #64748b;
  margin-top: .25rem;
}
.cp-category-actions {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.cp-category-footer {
  padding: .95rem 1.4rem;
  border-top: 1px solid #ebf0f5;
  color: #64748b;
  font-weight: 500;
}
.cp-table { margin-bottom: 0; }
.cp-table thead th {
  background: #f7fafc;
  color: #334155;
  font-size: .84rem;
  font-weight: 800;
  letter-spacing: .01em;
  border-bottom: 1px solid #e6edf5;
  padding: .95rem 1rem;
}
.cp-table tbody td {
  padding: 1rem;
  border-color: #edf2f7;
}
.cp-action-group { gap: .45rem; }
.cp-icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}
.cp-pill,
.cp-status-badge,
.cp-type-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  border-radius: 999px;
  padding: .42rem .78rem;
  font-size: .82rem;
  font-weight: 800;
  line-height: 1;
}
.cp-status-badge.is-active,
.cp-pill-success {
  background: #e8f7ee;
  color: #15803d;
}
.cp-status-badge.is-inactive,
.cp-pill-neutral {
  background: #eef2f7;
  color: #64748b;
}
.cp-pill-info {
  background: #eef4ff;
  color: #2458c6;
}
.cp-pill-warning {
  background: #fff4d8;
  color: #b7791f;
}
.cp-type-pill {
  background: #f1f5f9;
  color: #334155;
  text-transform: lowercase;
}
.cp-process-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.35rem;
  align-items: stretch;
}
.cp-process-card {
  background: #fff;
  border: 1px solid #dde5ee;
  border-radius: 24px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .05);
  padding: 1.3rem;
  display: flex;
  flex-direction: column;
  min-height: 308px;
}
.cp-process-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.cp-order-chip {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #e8f5ee;
  color: #16834f;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex: 0 0 42px;
}
.cp-process-body {
  flex: 1;
}
.cp-process-title {
  font-size: 1.3rem;
  line-height: 1.2;
  margin: 0 0 .6rem;
  font-weight: 800;
  color: #0f172a;
  word-break: break-word;
}
.cp-process-description {
  color: #64748b;
  font-size: .95rem;
  margin: 0 0 1rem;
  min-height: 44px;
}
.cp-process-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
}
.cp-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem .8rem;
  border: 1px solid #e5ebf2;
  border-radius: 12px;
  color: #475569;
  background: #fff;
  font-weight: 600;
}
.cp-stat-chip i { color: #16834f; }
.cp-process-footer {
  margin-top: 1.1rem;
}
.cp-enter-btn {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  background: linear-gradient(135deg, #1b9a5c, #16834f);
  border-color: #16834f;
}
.cp-inline-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-top: .85rem;
}
.cp-structure-card .cp-category-header {
  border-bottom: 1px solid #ebf0f5;
}
.cp-code {
  background: #fff1f2;
  color: #be185d;
  padding: .2rem .45rem;
  border-radius: 8px;
  font-size: .92rem;
}
.cp-form-screen { max-width: 1120px; }
.cp-form-panel {
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: 0 16px 38px rgba(15, 23, 42, .05);
}
.cp-form-panel .form-control,
.cp-form-panel .form-select {
  min-height: 50px;
  border-radius: 14px;
  border-color: #dbe4ec;
}
.cp-form-panel textarea.form-control { min-height: 120px; }
.cp-helper-box {
  border-radius: 16px;
  border-color: #fde4a8;
  background: #fff8e8;
  color: #6b5a1f;
}
@media (max-width: 1199.98px) {
  .cp-category-title { font-size: 1.65rem; }
}
@media (max-width: 991.98px) {
  .content-area main.page-wrapper { max-width: 100%; }
  .cp-category-header { padding: 1.15rem; }
  .cp-category-title { font-size: 1.45rem; }
  .cp-process-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
}
@media (max-width: 767.98px) {
  .page-wrapper { padding: 1rem 1rem 1.5rem; }
  .cp-category-header,
  .cp-category-main {
    flex-direction: column;
    align-items: flex-start;
  }
  .cp-category-actions { width: 100%; justify-content: flex-start; }
  .cp-inline-actions { grid-template-columns: 1fr; }
  .cp-process-grid { grid-template-columns: 1fr; }
  .cp-table thead th,
  .cp-table tbody td { padding: .82rem .8rem; }
}

/* v4 alignment fix for category product tables */
.cp-table-fixed {
  table-layout: fixed;
  width: 100%;
}
.cp-table-fixed th,
.cp-table-fixed td {
  vertical-align: middle;
}
.cp-table-fixed td:nth-child(1),
.cp-table-fixed td:nth-child(2) {
  white-space: normal;
  word-break: break-word;
}
.cp-table-fixed th:nth-child(3),
.cp-table-fixed td:nth-child(3),
.cp-table-fixed th:nth-child(4),
.cp-table-fixed td:nth-child(4) {
  text-align: center;
}
.cp-table-fixed th:nth-child(5),
.cp-table-fixed td:nth-child(5) {
  text-align: right;
}
.cp-table-fixed .cp-action-group {
  justify-content: flex-end;
}
@media (max-width: 767.98px) {
  .cp-table-fixed {
    table-layout: auto;
  }
}

/* v5 shift process/state/actions slightly left */
.cp-table-fixed th:nth-child(5),
.cp-table-fixed td:nth-child(5) {
  padding-right: 1.5rem;
}
.cp-table-fixed th:nth-child(3),
.cp-table-fixed td:nth-child(3),
.cp-table-fixed th:nth-child(4),
.cp-table-fixed td:nth-child(4) {
  padding-left: .75rem;
  padding-right: .75rem;
}

/* v6 form size and layout polish */
.cp-form-screen {
  max-width: 1320px;
  width: 100%;
}
.cp-form-screen .cp-header {
  margin-bottom: 1.75rem;
}
.cp-form-panel {
  max-width: 1180px;
  padding: 1.9rem 2rem;
  border-radius: 26px;
}
.cp-form-panel .row {
  --bs-gutter-x: 1.5rem;
  --bs-gutter-y: 1.5rem;
}
.cp-form-panel .label-text {
  font-size: 1.02rem;
  margin-bottom: .55rem;
  color: #0f172a;
}
.cp-form-panel .form-control,
.cp-form-panel .form-select {
  min-height: 54px;
  padding: .9rem 1rem;
  font-size: 1rem;
}
.cp-form-panel textarea.form-control {
  min-height: 138px;
}
.cp-form-actions {
  border-top: 1px solid #e8eef5;
  padding-top: 1.2rem;
}
.cp-form-actions .btn {
  min-width: 138px;
}
@media (max-width: 991.98px) {
  .cp-form-panel {
    max-width: 100%;
    padding: 1.35rem;
  }
}

/* v7 category navigation and process capture flow */
.sidebar-section-label {
  padding: .85rem 1rem .35rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .72rem;
  font-weight: 800;
  color: rgba(226, 232, 240, .68);
}
.nav-link-sub {
  margin-left: .75rem;
  margin-right: .5rem;
  padding: .7rem .95rem;
  border-radius: 14px;
  font-size: .95rem;
}
.nav-link-sub i {
  font-size: .95rem;
}
.cp-status-badge.is-warning {
  background: #fef3c7;
  color: #a16207;
}
.cp-product-grid {
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}
.cp-product-card {
  min-height: 260px;
}
.cp-inline-actions-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.cp-entry-panel {
  max-width: 100%;
}
.cp-side-panel {
  background: #ffffff;
  border: 1px solid #e5ebf2;
  border-radius: 24px;
  padding: 1.35rem;
  box-shadow: 0 16px 38px rgba(15, 23, 42, .05);
}
.cp-side-panel-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 1rem;
}
.cp-history-list {
  display: flex;
  flex-direction: column;
  gap: .9rem;
}
.cp-history-item {
  border: 1px solid #e8eef5;
  border-radius: 16px;
  padding: .9rem 1rem;
  background: #f8fafc;
}
@media (max-width: 991.98px) {
  .cp-inline-actions-3 {
    grid-template-columns: 1fr;
  }
}

/* v8 nested category/product/process sidebar */
.sidebar-nav .sidebar-tree-toggle,
.sidebar-nav .sidebar-product-toggle {
  width: 100%;
  border: 0;
  text-align: left;
  background: transparent;
  cursor: pointer;
}
.sidebar-nav .sidebar-tree-toggle.active,
.sidebar-nav .sidebar-tree-toggle[aria-expanded="true"] {
  background: rgba(255, 255, 255, .12);
  color: #fff;
}
.sidebar-tree-group {
  margin: .12rem 0 .35rem;
  padding-left: .25rem;
  border-left: 2px solid rgba(255, 255, 255, .08);
}
.sidebar-product-toggle {
  margin: .08rem .25rem .08rem .35rem;
  width: calc(100% - .6rem) !important;
  padding: .68rem .85rem !important;
  font-size: .94rem;
  font-weight: 600 !important;
  color: rgba(255,255,255,.84) !important;
  border-radius: 12px !important;
}
.sidebar-product-toggle:hover,
.sidebar-product-toggle.active,
.sidebar-product-toggle[aria-expanded="true"] {
  background: rgba(255, 255, 255, .09) !important;
  color: #fff !important;
}
.sidebar-product-group {
  margin-left: 1.25rem;
  border-left: 2px solid rgba(255,255,255,.08);
  padding-left: .45rem;
}
.sidebar-leaf {
  margin: .08rem .35rem .08rem .15rem;
  width: calc(100% - .5rem);
  padding: .62rem .75rem !important;
  border-radius: 10px !important;
  font-size: .9rem;
  font-weight: 600 !important;
  color: rgba(255,255,255,.78) !important;
}
.sidebar-leaf:hover,
.sidebar-leaf.active {
  background: rgba(255,255,255,.10) !important;
  color: #fff !important;
}
.sidebar-process-link {
  font-size: .86rem;
  color: rgba(255,255,255,.70) !important;
}
.sidebar-create-product {
  margin-top: .25rem;
  color: rgba(255,255,255,.62) !important;
}
.sidebar-empty-item {
  padding: .55rem 1rem .55rem 2.2rem;
  color: rgba(255,255,255,.5);
  font-size: .86rem;
}
.tree-chevron {
  font-size: .72rem;
  transition: transform .18s ease;
}
.sidebar-tree-toggle[aria-expanded="true"] .tree-chevron,
.sidebar-product-toggle[aria-expanded="true"] .tree-chevron {
  transform: rotate(180deg);
}
.sidebar-section-label {
  margin-top: .7rem;
  margin-bottom: .25rem;
}


/* Produccion / Inventario grouped menu */
.sidebar-tree-leaf {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: .08rem .35rem .08rem .35rem;
  width: calc(100% - .7rem);
  padding: .62rem .85rem !important;
  border-radius: 10px !important;
  font-size: .9rem;
  font-weight: 600 !important;
  color: rgba(255,255,255,.78) !important;
  text-decoration: none;
}
.sidebar-tree-leaf:hover,
.sidebar-tree-leaf.active {
  background: rgba(255,255,255,.10) !important;
  color: #fff !important;
}

/* v12 ajustes de orden del menu y acciones */
.product-actions-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: .45rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.product-actions-row .btn {
  border-radius: 10px;
  font-weight: 700;
}
@media (max-width: 1199.98px) {
  .product-actions-row {
    flex-wrap: wrap;
  }
}
.cp-category-actions form {
  margin: 0;
}

/* v13 responsive/mobile operational mode */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  overflow-x: hidden;
}
img, svg, video, canvas {
  max-width: 100%;
}
.btn, .nav-link, button, input, select, textarea {
  touch-action: manipulation;
}
.mobile-only { display: none !important; }
.desktop-only { display: initial !important; }

@media (max-width: 991.98px) {
  .app-shell {
    display: block;
    min-height: 100vh;
  }
  .content-area {
    width: 100%;
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    padding: .8rem .9rem;
    align-items: center;
  }
  .topbar-user {
    gap: .45rem;
    padding: .35rem .45rem;
  }
  .topbar-user .avatar {
    width: 36px;
    height: 36px;
  }
  .topbar-user .fw-semibold,
  .topbar-user .text-muted {
    max-width: 96px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar-user .btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
  }
  .topbar-user .btn .me-1,
  .topbar-user .btn span {
    display: none !important;
  }
  .page-wrapper {
    padding: 1rem .9rem 1.35rem;
  }
  .section-head {
    align-items: stretch;
    flex-direction: column;
    gap: .85rem;
  }
  .section-head > .d-flex,
  .section-head > a.btn,
  .section-head > .btn,
  .section-head .cp-category-actions {
    width: 100%;
  }
  .section-head > a.btn,
  .section-head > .btn,
  .section-head .btn {
    min-height: 44px;
  }
  .section-title {
    font-size: 1.35rem !important;
    line-height: 1.2;
  }
  .section-note {
    font-size: .92rem !important;
  }
  .card-panel,
  .metric-card,
  .form-panel,
  .cp-category-card,
  .cp-process-card,
  .cp-side-panel {
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .05);
  }
  .metric-card {
    padding: .95rem;
  }
  .metric-card .metric-icon {
    width: 42px;
    height: 42px;
  }
  .metric-card .metric-value {
    font-size: 1.55rem;
  }
  .offcanvas.sidebar-mobile {
    width: min(92vw, 360px);
    background: #101828;
    color: #fff;
  }
  .sidebar-mobile .offcanvas-header {
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .sidebar-mobile .btn-close {
    filter: invert(1) grayscale(100%);
  }
  .sidebar-mobile .sidebar-nav .nav-link {
    margin: .05rem .75rem;
  }
}

@media (max-width: 767.98px) {
  .mobile-only { display: initial !important; }
  .desktop-only { display: none !important; }
  .page-wrapper {
    padding: .85rem .72rem 1.15rem;
  }
  .topbar {
    gap: .6rem;
  }
  .page-title {
    max-width: 48vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .page-subtitle {
    display: none !important;
  }
  .card-panel,
  .form-panel {
    padding: 1rem;
  }
  .cp-form-panel {
    padding: 1rem !important;
  }
  .cp-category-header {
    padding: 1rem !important;
  }
  .cp-category-icon,
  .cp-empty-icon {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
    border-radius: 16px;
    font-size: 1.35rem;
  }
  .cp-category-title {
    font-size: 1.28rem !important;
  }
  .cp-category-actions,
  .cp-category-actions form,
  .cp-category-actions .btn {
    width: 100%;
  }
  .cp-category-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: .55rem;
  }
  .cp-process-grid,
  .cp-product-grid {
    grid-template-columns: 1fr !important;
    gap: .85rem;
  }
  .cp-process-card,
  .cp-product-card {
    min-height: auto;
    padding: 1rem;
  }
  .cp-process-title {
    font-size: 1.15rem;
  }
  .cp-process-description {
    min-height: 0;
    font-size: .92rem;
  }
  .cp-process-stats,
  .cp-inline-actions,
  .cp-inline-actions-3,
  .action-group,
  .product-actions-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: .55rem !important;
    width: 100%;
  }
  .action-group .btn,
  .action-group form,
  .action-group form .btn,
  .product-actions-row .btn,
  .product-actions-row form,
  .product-actions-row form .btn,
  .cp-inline-actions .btn,
  .cp-inline-actions form,
  .cp-inline-actions form .btn {
    width: 100%;
  }
  .cp-icon-btn {
    width: 100%;
    min-height: 42px;
  }
  .cp-btn-primary,
  .cp-btn-secondary,
  .cp-enter-btn {
    width: 100%;
    min-height: 46px;
  }
  .form-control,
  .form-select,
  .cp-form-panel .form-control,
  .cp-form-panel .form-select {
    min-height: 48px;
    font-size: 16px;
  }
  textarea.form-control,
  .cp-form-panel textarea.form-control {
    min-height: 108px;
  }
  .cp-form-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }
  .cp-form-actions .btn {
    width: 100%;
  }
}

/* Mobile table-to-card transformation. Labels are injected by JS in footer.php. */
@media (max-width: 767.98px) {
  .table-responsive {
    overflow: visible;
  }
  .table-responsive > table.erp-mobile-table {
    border-collapse: separate;
    border-spacing: 0 .8rem;
    width: 100%;
  }
  .table-responsive > table.erp-mobile-table > thead {
    display: none;
  }
  .table-responsive > table.erp-mobile-table > tbody,
  .table-responsive > table.erp-mobile-table > tbody > tr,
  .table-responsive > table.erp-mobile-table > tbody > tr > td {
    display: block;
    width: 100%;
  }
  .table-responsive > table.erp-mobile-table > tbody > tr {
    background: #fff;
    border: 1px solid #e5ebf2;
    border-radius: 18px;
    box-shadow: 0 10px 22px rgba(15, 23, 42, .045);
    overflow: hidden;
    margin-bottom: .85rem;
  }
  .table-responsive > table.erp-mobile-table > tbody > tr > td {
    border: 0 !important;
    border-bottom: 1px solid #eef2f7 !important;
    padding: .8rem .95rem !important;
    text-align: left !important;
  }
  .table-responsive > table.erp-mobile-table > tbody > tr > td:last-child {
    border-bottom: 0 !important;
  }
  .table-responsive > table.erp-mobile-table > tbody > tr > td::before {
    content: attr(data-label);
    display: block;
    color: #64748b;
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
    margin-bottom: .28rem;
  }
  .table-responsive > table.erp-mobile-table > tbody > tr > td[data-label=""],
  .table-responsive > table.erp-mobile-table > tbody > tr > td[colspan] {
    text-align: center !important;
  }
  .table-responsive > table.erp-mobile-table > tbody > tr > td[data-label=""]::before,
  .table-responsive > table.erp-mobile-table > tbody > tr > td[colspan]::before {
    display: none;
  }
  .table-responsive > table.erp-mobile-table > tbody > tr.collapse,
  .table-responsive > table.erp-mobile-table > tbody > tr.collapsing {
    box-shadow: none;
    border: 0;
    background: transparent;
    overflow: visible;
  }
  .table-responsive > table.erp-mobile-table > tbody > tr.collapse > td,
  .table-responsive > table.erp-mobile-table > tbody > tr.collapsing > td {
    padding: .2rem 0 .9rem !important;
    border: 0 !important;
  }
  .table-responsive > table.erp-mobile-table .card-soft {
    border-radius: 16px;
  }
  .table-responsive > table.erp-mobile-table .badge {
    white-space: normal;
  }
}

/* === v14 premium unified design: Alma Zamora === */
:root {
  --az-navy-950: #071a2d;
  --az-navy-900: #08233d;
  --az-navy-850: #0a2b4d;
  --az-blue: #0b55b7;
  --az-blue-2: #0d6efd;
  --az-blue-soft: #eaf2ff;
  --az-wine: #7b0f3a;
  --az-wine-2: #9d174d;
  --az-bg: #f5f7fb;
  --az-card: #ffffff;
  --az-line: #e5ebf2;
  --az-text: #0f1f33;
  --az-muted: #667085;
  --primary: var(--az-blue);
  --primary-2: var(--az-blue-2);
  --line: var(--az-line);
  --muted: var(--az-muted);
  --card: var(--az-card);
}

html, body,
button, input, select, textarea,
.table, .btn, .badge, .form-control, .form-select {
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
}

body.app-body {
  background: var(--az-bg) !important;
  color: var(--az-text);
  font-size: 15px;
}

.app-shell {
  background: var(--az-bg);
}

.sidebar,
.sidebar-mobile {
  background:
    radial-gradient(circle at 18% 0%, rgba(35, 104, 188, .24), transparent 26%),
    linear-gradient(180deg, var(--az-navy-900) 0%, var(--az-navy-950) 58%, #061525 100%) !important;
  border-right: 1px solid rgba(255,255,255,.07);
  color: #fff;
}

.sidebar {
  width: 292px;
  padding: 1.35rem 1rem 1.15rem;
}

.brand-block-premium {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  min-height: auto;
  margin-bottom: 1.05rem;
  padding: 1.05rem .8rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.brand-symbol {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  color: #fff;
  opacity: .98;
}

.brand-symbol svg {
  width: 54px;
  height: 54px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-text {
  text-align: center;
}

.brand-title {
  color: #fff;
  font-size: 1.62rem;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -.03em;
}

.brand-subtitle {
  color: rgba(255,255,255,.86);
  font-size: .72rem;
  line-height: 1.2;
  margin-top: .28rem;
  font-weight: 700;
  letter-spacing: .09em;
}

.sidebar-nav {
  gap: .16rem;
}

.sidebar-nav .nav-link,
.sidebar-nav .sidebar-tree-leaf,
.sidebar-tree-toggle,
.sidebar-product-toggle,
.sidebar-leaf,
.nav-link-sub {
  color: #fff !important;
  min-height: 46px;
  border-radius: 12px;
  padding: .76rem .88rem;
  display: flex;
  align-items: center;
  gap: .72rem;
  font-weight: 700;
  letter-spacing: -.01em;
  text-decoration: none;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  opacity: .96;
}

.sidebar-nav .nav-link i,
.sidebar-nav .sidebar-tree-leaf i,
.sidebar-tree-toggle i,
.sidebar-product-toggle i,
.sidebar-leaf i,
.nav-link-sub i {
  color: #fff !important;
  opacity: .96;
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .sidebar-tree-leaf:hover,
.sidebar-tree-toggle:hover,
.sidebar-product-toggle:hover,
.sidebar-leaf:hover,
.nav-link-sub:hover {
  background: rgba(255,255,255,.08) !important;
  color: #fff !important;
  opacity: 1;
}

.sidebar-nav .nav-link.active,
.sidebar-nav .sidebar-tree-leaf.active,
.sidebar-tree-toggle.active,
.sidebar-product-toggle.active,
.sidebar-leaf.active,
.nav-link-sub.active {
  background: linear-gradient(135deg, #0f64c9, #084ca7) !important;
  color: #fff !important;
  box-shadow: 0 13px 24px rgba(5, 61, 134, .24), inset 0 1px 0 rgba(255,255,255,.12);
}

.sidebar-tree-group,
.sidebar-product-group {
  margin-left: .76rem;
  padding-left: .72rem;
  border-left: 1px solid rgba(255,255,255,.12);
}

.sidebar-empty-item {
  color: rgba(255,255,255,.68) !important;
  padding: .55rem .85rem;
  font-weight: 600;
}

.sidebar-section-label {
  color: rgba(255,255,255,.67) !important;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .9rem .85rem .35rem !important;
}

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 1rem;
}

.sidebar-footer .btn,
.sidebar .btn-outline-light {
  border-color: rgba(255,255,255,.28) !important;
  color: #fff !important;
  border-radius: 14px;
  font-weight: 700;
}

.sidebar::after {
  content: "";
  display: block;
  min-height: 106px;
  margin: auto -.55rem -.7rem;
  opacity: .38;
  background:
    radial-gradient(ellipse at 72% 82%, rgba(255,255,255,.25) 0 1px, transparent 2px),
    repeating-linear-gradient(168deg, transparent 0 12px, rgba(255,255,255,.11) 13px 15px, transparent 16px 28px),
    linear-gradient(180deg, transparent, rgba(255,255,255,.05));
  border-radius: 18px;
}

.content-area {
  background: var(--az-bg);
}

.topbar {
  min-height: 78px;
  background: rgba(255,255,255,.92) !important;
  border-bottom: 1px solid var(--az-line);
  box-shadow: 0 8px 24px rgba(15, 31, 51, .035) !important;
  backdrop-filter: blur(18px);
  padding: .95rem 1.45rem !important;
}

.topbar-menu-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--az-text);
  font-size: 1.38rem;
}

.topbar-menu-btn:hover {
  background: #f3f6fb;
  border-color: var(--az-line);
}

.topbar-user {
  background: transparent !important;
  border: 0 !important;
  padding: .35rem .25rem !important;
  border-radius: 16px !important;
}

.avatar {
  background: linear-gradient(135deg, #0a4b9d, #0d6efd) !important;
  box-shadow: 0 8px 18px rgba(11,85,183,.18);
}

.page-wrapper {
  max-width: 1480px !important;
  padding: 2rem 2rem 2.4rem !important;
}

.section-head {
  margin-bottom: 1.35rem !important;
}

.section-title,
.cp-screen .section-title {
  font-size: clamp(1.65rem, 2.2vw, 2.15rem) !important;
  line-height: 1.12;
  font-weight: 800 !important;
  letter-spacing: -.04em !important;
  color: var(--az-text) !important;
}

.section-note,
.cp-screen .section-note {
  color: var(--az-muted) !important;
  font-size: .98rem !important;
  margin-top: .25rem;
}

.card-panel,
.metric-card,
.form-panel,
.cp-category-card,
.cp-process-card,
.cp-side-panel,
.cp-form-panel {
  background: #fff !important;
  border: 1px solid var(--az-line) !important;
  border-radius: 18px !important;
  box-shadow: 0 18px 40px rgba(15,31,51,.055) !important;
}

.card-panel,
.form-panel,
.cp-form-panel {
  padding: 1.45rem !important;
}

.metric-card {
  padding: 1.25rem !important;
}

.metric-card .metric-icon {
  background: var(--az-blue-soft) !important;
  color: var(--az-blue) !important;
}

.metric-card .metric-value {
  color: var(--az-text);
  letter-spacing: -.04em;
}

.btn {
  border-radius: 11px;
  font-weight: 700;
}

.btn-primary,
.btn-success,
.cp-btn-primary,
.cp-enter-btn {
  background: linear-gradient(135deg, #0d63c7, #084ca7) !important;
  border-color: #0a56b0 !important;
  box-shadow: 0 10px 18px rgba(11,85,183,.20) !important;
  color: #fff !important;
}

.btn-primary:hover,
.btn-success:hover,
.cp-btn-primary:hover,
.cp-enter-btn:hover {
  background: linear-gradient(135deg, #0a56b0, #073f8b) !important;
  border-color: #073f8b !important;
}

.btn-soft-secondary,
.btn-outline-secondary {
  background: #fff !important;
  border-color: #d8e0ea !important;
  color: #344054 !important;
}

.form-control,
.form-select {
  border-radius: 11px !important;
  border-color: #d8e0ea !important;
  background-color: #fff;
}

.form-control:focus,
.form-select:focus {
  border-color: #87b7ff !important;
  box-shadow: 0 0 0 .22rem rgba(13,110,253,.12) !important;
}

.table {
  color: #253449;
}

.table thead th,
.cp-table thead th {
  background: #fbfcfe !important;
  color: #344054 !important;
  font-size: .86rem !important;
  font-weight: 800 !important;
  border-color: #e6edf5 !important;
  padding: 1rem 1rem !important;
}

.table tbody td,
.cp-table tbody td {
  border-color: #edf2f7 !important;
  padding: 1rem 1rem !important;
}

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

.action-group .btn-sm,
.product-actions-row .btn-sm,
.cp-icon-btn {
  width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 !important;
  border-radius: 9px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.badge.bg-success,
.badge.text-bg-success,
.cp-pill-success,
.cp-status-badge.is-active {
  background: #e8f7ee !important;
  color: #15803d !important;
}

.badge.bg-warning,
.badge.text-bg-warning,
.cp-pill-warning,
.cp-status-badge.is-warning {
  background: #fff4d8 !important;
  color: #a16207 !important;
}

.cp-category-icon,
.cp-empty-icon,
.cp-order-chip {
  background: var(--az-blue-soft) !important;
  color: var(--az-blue) !important;
}

.cp-stat-chip i {
  color: var(--az-blue) !important;
}

.cp-code {
  background: #eef4ff !important;
  color: #0a56b0 !important;
}

.hero-side,
.login-logo {
  background: linear-gradient(135deg, var(--az-navy-900), var(--az-blue)) !important;
}

.mobile-brand-header {
  padding: 1rem 1rem .7rem !important;
}

.mobile-brand {
  flex: 1;
  align-items: flex-start !important;
  border-bottom: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.mobile-brand .brand-symbol {
  width: 40px;
  height: 40px;
}

.mobile-brand .brand-symbol svg {
  width: 40px;
  height: 40px;
}

.mobile-brand .brand-title {
  font-size: 1.25rem;
}

.mobile-brand .brand-subtitle {
  font-size: .62rem;
}

.sidebar-mobile .offcanvas-body {
  background: transparent;
}

@media (max-width: 991.98px) {
  .topbar {
    min-height: 68px;
    padding: .78rem 1rem !important;
  }
  .page-wrapper {
    padding: 1.2rem 1rem 1.6rem !important;
  }
  .sidebar-mobile {
    width: min(92vw, 360px) !important;
  }
}

@media (max-width: 767.98px) {
  .page-wrapper {
    padding: 1rem .78rem 1.35rem !important;
  }
  .section-title,
  .cp-screen .section-title {
    font-size: 1.45rem !important;
  }
  .card-panel,
  .form-panel,
  .cp-form-panel {
    padding: 1rem !important;
  }
  .action-group .btn-sm,
  .product-actions-row .btn-sm,
  .cp-icon-btn {
    width: 100% !important;
  }
}


/* v15 global visual consistency and sidebar refinement */
.sidebar::after {
  display: none !important;
  content: none !important;
}

.brand-block-premium {
  margin: 0 .1rem 1.15rem !important;
  padding: 1.2rem 1rem 1.35rem !important;
  border: 1px solid rgba(255,255,255,.08) !important;
  border-radius: 22px !important;
  background:
    radial-gradient(circle at 50% 0%, rgba(69, 134, 233, .24), transparent 58%),
    linear-gradient(180deg, rgba(255,255,255,.065), rgba(255,255,255,.025)) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 16px 28px rgba(0,0,0,.16) !important;
}

.brand-symbol {
  width: 62px !important;
  height: 62px !important;
}

.brand-symbol svg {
  width: 62px !important;
  height: 62px !important;
}

.brand-title {
  font-size: 1.78rem !important;
}

.sidebar-scroll,
.sidebar-nav {
  position: relative;
  z-index: 1;
}

.sidebar-footer {
  border-top: 0 !important;
  padding-top: .95rem !important;
}

.sidebar-footer-card {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 1rem;
  background:
    radial-gradient(circle at 18% 0%, rgba(57, 127, 234, .22), transparent 34%),
    linear-gradient(180deg, rgba(8, 43, 85, .92) 0%, rgba(6, 28, 55, .98) 100%);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 12px 26px rgba(0,0,0,.18);
}

.sidebar-footer-card::before {
  content: "";
  position: absolute;
  inset: auto -22% -30% -12%;
  height: 90px;
  background: repeating-linear-gradient(168deg, transparent 0 13px, rgba(255,255,255,.08) 14px 16px, transparent 17px 30px);
  opacity: .55;
  pointer-events: none;
}

.sidebar-footer-badge,
.sidebar-footer-note,
.sidebar-footer-card .btn {
  position: relative;
  z-index: 1;
}

.sidebar-footer-badge {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: #fff;
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: .55rem;
}

.sidebar-footer-badge i {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.12);
  font-size: 1rem;
}

.sidebar-footer-note {
  color: rgba(255,255,255,.7);
  font-size: .84rem;
  line-height: 1.45;
  margin-bottom: .9rem;
}

.sidebar-footer-card .btn {
  min-height: 44px;
  background: rgba(255,255,255,.02) !important;
}

.topbar-user {
  align-items: center;
  gap: .85rem !important;
  background: #fff !important;
  border: 1px solid var(--az-line) !important;
  box-shadow: 0 8px 18px rgba(15,31,51,.04);
  padding: .42rem .5rem .42rem .42rem !important;
}

.topbar-user .text-muted {
  color: #667085 !important;
}

.table thead th:last-child,
.table tbody td:last-child {
  min-width: 170px;
}

.table-action-cell,
.table td.text-end {
  white-space: nowrap;
}

.action-group,
.product-actions-row {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: .45rem !important;
  flex-wrap: nowrap !important;
}

.action-group form,
.product-actions-row form {
  display: inline-flex;
  margin: 0;
}

.action-group .btn-sm,
.product-actions-row .btn-sm,
.cp-icon-btn {
  width: 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 !important;
}

.action-group .btn-sm i,
.product-actions-row .btn-sm i,
.cp-icon-btn i {
  margin: 0 !important;
}

@media (max-width: 991.98px) {
  .topbar-user {
    padding-right: .35rem !important;
  }
}

@media (max-width: 767.98px) {
  .action-group,
  .product-actions-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100%;
  }
  .action-group .btn-sm,
  .product-actions-row .btn-sm,
  .cp-icon-btn {
    width: 100% !important;
  }
}

/* v16 precision refresh aligned to approved reference */
:root {
  --az-sidebar-start: #082b57;
  --az-sidebar-end: #031a34;
  --az-sidebar-accent: #0e63c8;
  --az-page-bg: #f4f7fb;
  --az-card-border: #e5ebf2;
  --az-text-strong: #163152;
  --az-text-soft: #667085;
}

body.app-body {
  background: var(--az-page-bg) !important;
}

.sidebar,
.sidebar-mobile {
  background:
    radial-gradient(circle at 12% 0%, rgba(78, 145, 232, .16), transparent 24%),
    linear-gradient(180deg, var(--az-sidebar-start) 0%, var(--az-sidebar-end) 100%) !important;
}

.sidebar {
  width: 286px !important;
  padding: 1.15rem 1rem 0 !important;
}

.brand-block-premium {
  margin: 0 0 1.1rem !important;
  padding: .25rem 0 1.15rem !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.brand-symbol,
.brand-symbol svg {
  width: 60px !important;
  height: 60px !important;
}

.brand-title {
  font-size: 1.02rem !important;
  font-weight: 500 !important;
  letter-spacing: -.02em !important;
}

.brand-subtitle {
  font-size: .64rem !important;
  letter-spacing: .12em !important;
  color: rgba(255,255,255,.86) !important;
}

.sidebar-nav {
  gap: .22rem !important;
}

.sidebar-nav .nav-link,
.sidebar-nav .sidebar-tree-leaf,
.sidebar-tree-toggle,
.sidebar-product-toggle,
.sidebar-leaf,
.nav-link-sub {
  min-height: 48px !important;
  padding: .82rem .92rem !important;
  border-radius: 13px !important;
  font-size: .99rem !important;
  font-weight: 600 !important;
}

.sidebar-nav .nav-link.active,
.sidebar-nav .sidebar-tree-leaf.active,
.sidebar-tree-toggle.active,
.sidebar-product-toggle.active,
.sidebar-leaf.active,
.nav-link-sub.active {
  background: linear-gradient(135deg, #1068d1, #0a56b0) !important;
  box-shadow: 0 14px 24px rgba(6, 65, 140, .26) !important;
}

.sidebar-section-label {
  padding: 1rem .92rem .4rem !important;
  color: rgba(255,255,255,.72) !important;
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 0 .9rem !important;
}

.sidebar-footer-card {
  min-height: 118px;
  padding: 0 !important;
  border-radius: 22px !important;
  background:
    radial-gradient(circle at 18% 0%, rgba(63, 128, 223, .24), transparent 34%),
    linear-gradient(180deg, rgba(5, 34, 69, .64) 0%, rgba(4, 26, 52, .78) 100%) !important;
  border: 1px solid rgba(255,255,255,.06) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03) !important;
}

.sidebar-footer-card::before {
  display: none !important;
}

.sidebar-footer-illustration {
  width: 100%;
  min-height: 118px;
  border-radius: 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 130'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0%25' stop-color='%23082b57' stop-opacity='.0'/%3E%3Cstop offset='100%25' stop-color='%23031a34' stop-opacity='.0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 94 C42 86 86 96 122 87 C163 76 205 82 239 73 C269 66 291 70 320 59 L320 130 L0 130 Z' fill='%23052245' fill-opacity='.9'/%3E%3Cpath d='M0 102 C38 94 76 104 117 94 C160 84 201 90 242 80 C270 73 293 78 320 68' fill='none' stroke='white' stroke-opacity='.08' stroke-width='2'/%3E%3Cpath d='M0 113 C38 103 76 113 117 103 C160 93 201 99 242 89 C270 82 293 87 320 77' fill='none' stroke='white' stroke-opacity='.08' stroke-width='2'/%3E%3Cpath d='M0 124 C38 114 76 124 117 114 C160 104 201 110 242 100 C270 93 293 98 320 88' fill='none' stroke='white' stroke-opacity='.08' stroke-width='2'/%3E%3Cpath d='M240 88 l14 -18 12 18' fill='none' stroke='white' stroke-opacity='.18' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Crect x='246' y='88' width='20' height='17' rx='2' fill='white' fill-opacity='.11'/%3E%3Crect x='252' y='94' width='5' height='11' fill='white' fill-opacity='.18'/%3E%3Cpath d='M254 70 v10 M248 74 h12 M250 78 h8' stroke='white' stroke-opacity='.15' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: cover;
}

.topbar {
  min-height: 82px !important;
  padding: 1rem 1.65rem !important;
  background: rgba(255,255,255,.96) !important;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0 !important;
  background: transparent !important;
  color: #344054 !important;
  font-size: 1.25rem !important;
  border-radius: 12px !important;
}

.topbar-icon-btn:hover {
  background: #f4f7fb !important;
}

.topbar-badge {
  position: absolute;
  top: 3px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 .22rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #0b5cc0;
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1;
}

.topbar-divider {
  width: 1px;
  height: 32px;
  background: #e6ebf2;
}

.topbar-account {
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: .9rem !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.topbar-account::after {
  display: none !important;
}

.account-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.account-name {
  color: #243b53;
  font-weight: 700;
  font-size: 1rem;
}

.account-role {
  color: #667085;
  font-size: .92rem;
}

.account-chevron {
  color: #344054;
  font-size: .95rem;
}

.avatar,
.profile-menu-avatar {
  width: 44px !important;
  height: 44px !important;
  border-radius: 999px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a4f9f, #0c63c8) !important;
  color: #fff;
  font-weight: 800;
  letter-spacing: -.02em;
}

.profile-menu {
  min-width: 230px;
  border-radius: 16px !important;
  padding: .5rem !important;
}

.profile-menu-header {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .35rem .4rem .45rem;
}

.profile-menu-name {
  font-weight: 700;
  color: #243b53;
}

.profile-menu-role {
  color: #667085;
  font-size: .88rem;
}

.page-wrapper {
  max-width: 1520px !important;
  padding: 2.2rem 2rem 2.5rem !important;
}

.section-title,
.cp-screen .section-title {
  color: var(--az-text-strong) !important;
  font-size: clamp(2rem, 2.6vw, 2.35rem) !important;
  font-weight: 700 !important;
  letter-spacing: -.05em !important;
}

.section-note,
.cp-screen .section-note {
  color: var(--az-text-soft) !important;
  font-size: 1rem !important;
}

.card-panel,
.metric-card,
.form-panel,
.cp-category-card,
.cp-process-card,
.cp-side-panel,
.cp-form-panel {
  border-radius: 20px !important;
  border-color: var(--az-card-border) !important;
  box-shadow: 0 18px 40px rgba(15,31,51,.05) !important;
}

.btn-primary,
.btn-success,
.cp-btn-primary,
.cp-enter-btn {
  min-height: 40px;
  padding-inline: 1.1rem !important;
  border-radius: 11px !important;
}

.table thead th,
.cp-table thead th {
  background: #fcfdff !important;
  color: #50627b !important;
}

.table thead th:last-child,
.table tbody td:last-child {
  min-width: 152px !important;
}

.table-action-cell,
.table td.text-end {
  white-space: nowrap;
}

.action-group,
.product-actions-row,
.cp-action-group {
  display: inline-flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: .42rem !important;
}

.action-group form,
.product-actions-row form,
.cp-action-group form {
  display: inline-flex !important;
  margin: 0 !important;
}

.action-group .btn-sm,
.product-actions-row .btn-sm,
.cp-icon-btn,
.cp-action-group .btn-sm {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden;
}

.action-group .btn-sm span,
.product-actions-row .btn-sm span,
.cp-action-group .btn-sm span {
  display: none !important;
}

.action-group .btn-sm i,
.product-actions-row .btn-sm i,
.cp-icon-btn i,
.cp-action-group .btn-sm i {
  font-size: .95rem;
  line-height: 1;
  margin: 0 !important;
}

.table-responsive {
  scrollbar-width: thin;
}

@media (max-width: 991.98px) {
  .topbar {
    padding: .9rem 1rem !important;
  }
  .topbar-actions {
    gap: .55rem;
  }
  .topbar-divider,
  .topbar-icon-btn {
    display: none !important;
  }
  .account-name {
    font-size: .95rem;
  }
  .account-role,
  .account-chevron {
    display: none;
  }
  .page-wrapper {
    padding: 1.3rem 1rem 1.7rem !important;
  }
}

@media (max-width: 767.98px) {
  .sidebar-mobile .brand-block-premium {
    padding-top: .15rem !important;
  }
  .section-title,
  .cp-screen .section-title {
    font-size: 1.8rem !important;
  }
}


/* v17: restaurar Portal QR y quitar cierre decorativo sin modulo */
.sidebar-footer {
  margin-top: auto !important;
  padding: 1rem 0 .95rem !important;
  border-top: 1px solid rgba(255,255,255,.10) !important;
}
.sidebar-footer-card,
.sidebar-footer-illustration {
  display: none !important;
}
.sidebar-qr-link,
.sidebar .sidebar-qr-link {
  min-height: 46px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 15px !important;
  border: 1px solid rgba(255,255,255,.32) !important;
  color: #fff !important;
  background: rgba(255,255,255,.035) !important;
  font-weight: 700 !important;
  text-decoration: none !important;
}
.sidebar-qr-link:hover,
.sidebar .sidebar-qr-link:hover {
  background: rgba(255,255,255,.10) !important;
  border-color: rgba(255,255,255,.48) !important;
  color: #fff !important;
}

/* v19: mejoras de presupuesto en editar proyecto */
.project-edit-form .budget-switch-wrap {
  display: none !important;
}

.project-budget-toggle {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .72rem .9rem;
  border: 1px solid #dfe7f0;
  border-radius: 13px;
  background: #fff;
}

.project-budget-toggle .form-check-input {
  width: 2.85rem;
  height: 1.45rem;
  margin: 0;
  flex: 0 0 auto;
  cursor: pointer;
  border-color: #bfd1e8;
  box-shadow: none !important;
}

.project-budget-toggle .form-check-input:checked {
  background-color: #0d63c7;
  border-color: #0d63c7;
}

.project-budget-toggle-label {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
}

.project-budget-toggle-label span {
  color: #163152;
  font-weight: 800;
}

.project-budget-toggle-label small {
  color: #667085;
  font-size: .78rem;
  margin-top: .16rem;
}

.project-budget-panel {
  padding: 1.15rem 1.25rem 1.25rem;
  border: 1px solid #dfe7f0;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.project-panel-title {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin-bottom: 1rem;
}

.project-panel-title i {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: #0d63c7;
  background: #eef5ff;
  font-size: 1.1rem;
}

.project-panel-title strong {
  display: block;
  color: #163152;
  font-size: 1.02rem;
}

.project-panel-title span {
  display: block;
  color: #667085;
  font-size: .88rem;
  margin-top: .1rem;
}

.budget-amount-group .input-group-text {
  min-width: 52px;
  justify-content: center;
  border-color: #d8e0ea;
  background: #f7faff;
  color: #0a56b0;
  font-weight: 800;
  border-radius: 11px 0 0 11px !important;
}

.budget-amount-group .form-control {
  border-left: 0 !important;
  border-radius: 0 11px 11px 0 !important;
}

.project-schedule-panel {
  border: 1px solid #dfe7f0;
  background: #fbfdff !important;
}

.project-form-actions {
  align-items: center;
}

@media (max-width: 575.98px) {
  .project-code-row {
    flex-direction: column;
  }
  .project-code-row .btn {
    width: 100%;
  }
  .project-budget-panel {
    padding: 1rem;
  }
  .project-form-actions {
    display: grid !important;
    grid-template-columns: 1fr;
  }
}

/* v20: presupuesto proyecto - switch limpio y prefijo visible */
.project-edit-form .budget-switch-wrap {
  display: none !important;
}

.project-budget-toggle {
  min-height: 50px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  padding: .72rem .95rem !important;
  border: 1px solid #dfe7f0 !important;
  border-radius: 13px !important;
  background: #fff !important;
  box-shadow: none !important;
}

.project-budget-checkbox {
  position: absolute !important;
  opacity: 0 !important;
  width: 1px !important;
  height: 1px !important;
  pointer-events: none !important;
}

.project-budget-toggle-label {
  width: 100%;
  margin: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: .75rem !important;
  cursor: pointer;
  user-select: none;
  line-height: 1 !important;
}

.project-budget-toggle-label small {
  display: none !important;
}

.project-budget-toggle-text,
.project-budget-toggle-label > span:not(.project-switch-ui) {
  color: #163152 !important;
  font-weight: 800 !important;
  font-size: .98rem !important;
  line-height: 1.2 !important;
}

.project-switch-ui {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #e7eef8;
  border: 1px solid #c8d8ee;
  transition: .18s ease;
  box-shadow: inset 0 1px 3px rgba(15, 31, 51, .08);
}

.project-switch-ui span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 31, 51, .18);
  transition: .18s ease;
}

.project-budget-checkbox:checked + .project-budget-toggle-label .project-switch-ui {
  background: #0d63c7;
  border-color: #0d63c7;
}

.project-budget-checkbox:checked + .project-budget-toggle-label .project-switch-ui span {
  transform: translateX(20px);
}

.project-budget-panel {
  padding: 1.15rem 1.25rem 1.25rem !important;
  border: 1px solid #dfe7f0 !important;
  border-radius: 18px !important;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
}

.budget-amount-group {
  display: flex !important;
  flex-wrap: nowrap !important;
}

.budget-amount-group .input-group-text {
  display: inline-flex !important;
  min-width: 54px !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid #d8e0ea !important;
  border-right: 0 !important;
  background: #f4f8ff !important;
  color: #0a56b0 !important;
  font-weight: 800 !important;
  border-radius: 11px 0 0 11px !important;
}

.budget-amount-group .budget-amount-input,
.budget-amount-group .form-control {
  border-left: 0 !important;
  border-radius: 0 11px 11px 0 !important;
}

@media (max-width: 767.98px) {
  .project-budget-toggle {
    min-height: 48px !important;
  }
  .project-budget-panel {
    padding: 1rem !important;
  }
}


/* v21: presupuesto compacto y monto con miles */
.project-budget-toggle {
  min-height: 50px !important;
  padding: .68rem .9rem !important;
  border: 1px solid #dfe7f0 !important;
  border-radius: 12px !important;
  background: #fff !important;
  box-shadow: none !important;
}

.project-budget-toggle-label {
  width: auto !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: .58rem !important;
}

.project-switch-ui {
  flex: 0 0 38px !important;
  width: 38px !important;
  height: 20px !important;
  border-radius: 999px !important;
}

.project-switch-ui span {
  top: 2px !important;
  left: 2px !important;
  width: 14px !important;
  height: 14px !important;
}

.project-budget-checkbox:checked + .project-budget-toggle-label .project-switch-ui span {
  transform: translateX(18px) !important;
}

.project-budget-toggle-text,
.project-budget-toggle-label > span:not(.project-switch-ui) {
  font-size: .95rem !important;
  font-weight: 750 !important;
}

.budget-amount-group .budget-amount-input {
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}


/* v22: boton compacto de aplica presupuesto */
.project-budget-toggle {
  width: auto !important;
  min-height: auto !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  display: inline-flex !important;
  align-items: center !important;
}

.project-budget-toggle-label {
  display: inline-flex !important;
  align-items: center !important;
  gap: .6rem !important;
  padding: .62rem .88rem !important;
  border: 1px solid #d8e2ef !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  cursor: pointer !important;
  user-select: none !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

.project-budget-checkbox {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.project-switch-ui {
  flex: 0 0 16px !important;
  width: 16px !important;
  height: 16px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 4px !important;
  background: #eef3fa !important;
  border: 1px solid #c8d4e3 !important;
}

.project-switch-ui span {
  position: static !important;
  display: block !important;
  width: 0 !important;
  height: 0 !important;
  border-radius: 2px !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}

.project-budget-toggle-text,
.project-budget-toggle-label > span:not(.project-switch-ui) {
  font-size: .95rem !important;
  font-weight: 700 !important;
  color: #153e75 !important;
}

.project-budget-checkbox:checked + .project-budget-toggle-label {
  border-color: rgba(27, 96, 220, 0.24) !important;
  background: linear-gradient(180deg, #f8fbff 0%, #edf5ff 100%) !important;
}

.project-budget-checkbox:checked + .project-budget-toggle-label .project-switch-ui {
  background: #1d68dc !important;
  border-color: #1d68dc !important;
}

.project-budget-checkbox:checked + .project-budget-toggle-label .project-switch-ui span {
  width: 8px !important;
  height: 8px !important;
  background: #ffffff !important;
}

@media (max-width: 767.98px) {
  .project-budget-toggle-label {
    padding: .58rem .8rem !important;
  }

  .project-budget-toggle-text,
  .project-budget-toggle-label > span:not(.project-switch-ui) {
    font-size: .92rem !important;
  }
}


/* v23: switch de presupuesto tipo boton antiguo, compacto y limpio */
.project-budget-toggle {
  width: auto !important;
  min-height: auto !important;
  padding: 0 !important;
  margin-top: .25rem !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  display: inline-flex !important;
  align-items: center !important;
}

.project-budget-checkbox {
  position: absolute !important;
  opacity: 0 !important;
  width: 1px !important;
  height: 1px !important;
  pointer-events: none !important;
}

.project-budget-toggle-label {
  width: 54px !important;
  height: 28px !important;
  padding: 0 !important;
  margin: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  position: relative !important;
  border: 1.5px solid #0d63c7 !important;
  border-radius: 999px !important;
  background: #ffffff !important;
  cursor: pointer !important;
  user-select: none !important;
  box-shadow: 0 2px 8px rgba(13, 99, 199, .08) !important;
}

.project-switch-ui {
  position: absolute !important;
  left: 4px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 20px !important;
  height: 20px !important;
  border-radius: 999px !important;
  background: #0d63c7 !important;
  border: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: left .18s ease, background .18s ease !important;
  box-shadow: 0 2px 6px rgba(13, 99, 199, .18) !important;
  flex: none !important;
}

.project-switch-ui::before {
  content: "\f4f4";
  font-family: "bootstrap-icons";
  color: #ffffff;
  font-size: .68rem;
  line-height: 1;
}

.project-switch-ui span,
.project-budget-toggle-text,
.project-budget-toggle-label > span:not(.project-switch-ui) {
  display: none !important;
}

.project-budget-checkbox:checked + .project-budget-toggle-label {
  background: #eef5ff !important;
  border-color: #0d63c7 !important;
}

.project-budget-checkbox:checked + .project-budget-toggle-label .project-switch-ui {
  left: 28px !important;
  background: #0d63c7 !important;
  transform: translateY(-50%) !important;
}

.project-budget-checkbox:focus + .project-budget-toggle-label {
  box-shadow: 0 0 0 .18rem rgba(13, 99, 199, .14) !important;
}

@media (max-width: 767.98px) {
  .project-budget-toggle-label {
    width: 52px !important;
    height: 27px !important;
  }
  .project-switch-ui {
    width: 19px !important;
    height: 19px !important;
  }
  .project-budget-checkbox:checked + .project-budget-toggle-label .project-switch-ui {
    left: 27px !important;
  }
}


/* v24: alinear switch debajo del label y mantener tamaño compacto */
.project-budget-field {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
}

.project-budget-field > .label-text {
  display: block !important;
  margin-bottom: .45rem !important;
}

.project-budget-field .project-budget-toggle {
  display: flex !important;
  align-items: center !important;
  min-height: 50px !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.project-budget-field .project-budget-toggle-label {
  width: 54px !important;
  height: 28px !important;
  min-width: 54px !important;
  min-height: 28px !important;
  margin: 0 !important;
  padding: 0 !important;
}

@media (max-width: 767.98px) {
  .project-budget-field .project-budget-toggle {
    min-height: 48px !important;
  }
}


/* v28: ajustes de Gestión de Categorías y Procesos */
.cp-screen .section-head.cp-header .section-note:empty {
  display: none !important;
}

.cp-category-header {
  padding: 1rem 1.2rem !important;
  align-items: center !important;
}

.cp-category-main {
  gap: .75rem !important;
}

.cp-category-main > div {
  min-width: 0 !important;
}

.cp-category-title {
  font-size: 1.55rem !important;
  letter-spacing: -.02em !important;
}

.cp-category-title-row {
  gap: .5rem !important;
}

.cp-category-actions {
  gap: .45rem !important;
  align-items: center !important;
}

.cp-category-actions .cp-btn-secondary {
  min-height: 38px !important;
  padding: .5rem .85rem !important;
  border-radius: 12px !important;
  font-size: .9rem !important;
}

.cp-category-footer {
  padding: .72rem 1rem !important;
  font-size: .92rem !important;
}

.cp-table-fixed {
  table-layout: fixed !important;
}

.cp-table-fixed thead th:nth-child(1),
.cp-table-fixed tbody td:nth-child(1) {
  width: 26% !important;
}

.cp-table-fixed thead th:nth-child(2),
.cp-table-fixed tbody td:nth-child(2) {
  width: 36% !important;
}

.cp-table-fixed thead th:nth-child(3),
.cp-table-fixed tbody td:nth-child(3) {
  width: 14% !important;
  text-align: center !important;
}

.cp-table-fixed thead th:nth-child(4),
.cp-table-fixed tbody td:nth-child(4) {
  width: 12% !important;
  text-align: center !important;
}

.cp-table-fixed thead th:nth-child(5),
.cp-table-fixed tbody td:nth-child(5) {
  width: 12% !important;
  text-align: right !important;
  padding-right: 1rem !important;
}

.cp-icon-btn {
  width: 34px !important;
  height: 34px !important;
  border-radius: 9px !important;
  font-size: .9rem !important;
}

.cp-btn-primary,
.cp-btn-secondary {
  border-radius: 12px !important;
  min-height: 42px !important;
  padding: .58rem 1rem !important;
  font-size: .95rem !important;
}

.cp-form-screen {
  max-width: 100% !important;
}

.cp-form-screen .cp-header {
  max-width: 1180px !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  align-items: center !important;
}

.cp-form-panel {
  width: min(100%, 1180px) !important;
  max-width: 1180px !important;
  margin-left: 0 !important;
  padding: 1.75rem 1.85rem !important;
  border-radius: 22px !important;
}

.cp-form-panel .row {
  --bs-gutter-x: 1.25rem !important;
  --bs-gutter-y: 1.25rem !important;
}

.cp-form-panel .form-control,
.cp-form-panel .form-select {
  min-height: 50px !important;
  padding: .75rem .95rem !important;
}

.cp-form-panel textarea.form-control {
  min-height: 122px !important;
}

.cp-helper-box {
  font-size: .95rem !important;
  line-height: 1.45 !important;
}

.cp-form-actions {
  padding-top: 1.25rem !important;
}

.cp-type-pill {
  text-transform: none !important;
}

@media (max-width: 991.98px) {
  .cp-category-actions {
    width: 100% !important;
    justify-content: flex-start !important;
  }
  .cp-category-header {
    align-items: flex-start !important;
  }
}

@media (max-width: 767.98px) {
  .cp-category-title {
    font-size: 1.32rem !important;
  }

  .cp-category-actions .cp-btn-secondary {
    min-height: 36px !important;
    padding: .45rem .7rem !important;
    font-size: .85rem !important;
  }

  .cp-form-panel {
    padding: 1.1rem !important;
  }

  .cp-table-fixed {
    table-layout: auto !important;
  }
}

/* v29: ajustar ancho completo en Agregar/Editar columna */
.cp-form-screen .cp-header,
.cp-form-screen .cp-form-panel {
  width: 100% !important;
  max-width: none !important;
}

.cp-form-screen .cp-header {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 1rem !important;
}

.cp-form-screen .cp-form-panel {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

@media (max-width: 767.98px) {
  .cp-form-screen .cp-header {
    gap: .75rem !important;
  }
}

/* Ajuste Alma Zamora: tarjetas de procesos compactas y en grilla fija.
   En escritorio se muestran 4 procesos por fila; luego bajan a 3, 2 y 1 según el ancho. */
.cp-config-process-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 1rem !important;
}
.cp-config-process-grid .cp-process-card {
  min-height: 300px;
}
.cp-config-process-grid .cp-process-footer {
  gap: .75rem;
}
@media (max-width: 1399.98px) {
  .cp-config-process-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}
@media (max-width: 1199.98px) {
  .cp-config-process-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 767.98px) {
  .cp-config-process-grid { grid-template-columns: 1fr !important; }
}


/* Ajuste Alma Zamora: botones inferiores compactos dentro de tarjetas de procesos.
   Evita que "Columnas", "Editar" y "Eliminar" queden apretados en tarjetas de 4 columnas. */
.cp-config-process-grid .cp-inline-actions-3 {
  gap: .55rem !important;
}

.cp-config-process-grid .cp-inline-actions-3 .cp-btn-secondary,
.cp-config-process-grid .cp-inline-actions-3 button.cp-btn-secondary {
  min-height: 42px !important;
  padding: .52rem .48rem !important;
  font-size: .86rem !important;
  line-height: 1.1 !important;
  letter-spacing: -.01em !important;
  white-space: nowrap !important;
}

.cp-config-process-grid .cp-inline-actions-3 .cp-btn-secondary i,
.cp-config-process-grid .cp-inline-actions-3 button.cp-btn-secondary i {
  font-size: .82rem !important;
  margin-right: .25rem !important;
}

@media (max-width: 1399.98px) {
  .cp-config-process-grid .cp-inline-actions-3 .cp-btn-secondary,
  .cp-config-process-grid .cp-inline-actions-3 button.cp-btn-secondary {
    font-size: .9rem !important;
    padding: .55rem .55rem !important;
  }
}

/* v36: Registro de procesos tipo Excel reutilizable para todos los procesos configurados. */
.cp-registro-screen {
  max-width: none !important;
}

.cp-registro-screen .cp-header,
.cp-registro-screen .cp-grid-panel {
  width: 100% !important;
  max-width: none !important;
}

.cp-grid-panel {
  padding: 1.35rem !important;
}

.cp-inline-alert {
  border-radius: 14px !important;
  margin-bottom: 1rem !important;
}

.cp-registro-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.cp-scroll-hint {
  color: #2563eb;
  font-weight: 700;
  font-size: .92rem;
  display: none;
  align-items: center;
  gap: .35rem;
}

.cp-excel-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #dbe5f2;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
  -webkit-overflow-scrolling: touch;
}

.cp-excel-table {
  margin-bottom: 0 !important;
  border-collapse: separate;
  border-spacing: 0;
}

.cp-excel-table thead th {
  background: #f8fbff !important;
  color: #12345a !important;
  font-size: .82rem !important;
  font-weight: 800 !important;
  white-space: nowrap;
  padding: .95rem .8rem !important;
  border-bottom: 1px solid #dbe5f2 !important;
}

.cp-excel-table tbody td {
  vertical-align: middle !important;
  padding: .82rem .8rem !important;
  border-bottom: 1px solid #e8eef7 !important;
  white-space: nowrap;
  font-size: .92rem;
}

.cp-excel-table tbody tr:last-child td {
  border-bottom: 0 !important;
}

.cp-excel-table .cp-col-number,
.cp-excel-table .cp-row-number {
  width: 76px;
  min-width: 76px;
  text-align: center;
}

.cp-read-row:hover td {
  background: #f8fbff;
}

.cp-edit-row td {
  background: #f5f9ff !important;
  border-top: 1px solid #2f75e8 !important;
  border-bottom: 1px solid #2f75e8 !important;
}

.cp-edit-row td:first-child {
  border-left: 1px solid #2f75e8 !important;
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

.cp-edit-row td:last-child {
  border-right: 1px solid #2f75e8 !important;
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

.cp-edit-row-active td {
  background: #eef6ff !important;
}

.cp-new-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 30px;
  padding: .25rem .5rem;
  border-radius: 999px;
  background: #eaf2ff;
  color: #0f5fc4;
  font-size: .78rem;
  font-weight: 800;
}

.cp-grid-input {
  min-width: 130px !important;
  height: 42px !important;
  border-radius: 10px !important;
  font-size: .92rem !important;
  padding: .5rem .7rem !important;
}

.cp-grid-textarea {
  min-width: 190px !important;
  resize: vertical;
  min-height: 42px !important;
}

.cp-empty-cell {
  color: #94a3b8;
  font-weight: 700;
}

.cp-actions-cell {
  min-width: 145px;
}

.cp-actions-cell .cp-action-group {
  display: flex;
  align-items: center;
  gap: .45rem;
}

.cp-actions-cell form {
  margin: 0;
}

.cp-save-row {
  min-height: 38px !important;
  padding: .45rem .72rem !important;
  font-size: .82rem !important;
  border-radius: 10px !important;
  white-space: nowrap;
}

.cp-mobile-savebar {
  margin-top: 1rem;
}

.cp-lock-note {
  color: #64748b;
  font-weight: 700;
  font-size: .92rem;
  display: flex;
  align-items: center;
  gap: .45rem;
}

.cp-mobile-savebar .cp-lock-note {
  margin-top: .8rem;
}

@media (max-width: 991.98px) {
  .cp-registro-screen .section-title {
    font-size: 1.55rem !important;
  }
  .cp-grid-panel {
    padding: 1rem !important;
  }
  .cp-scroll-hint {
    display: flex;
    width: 100%;
  }
  .cp-excel-table thead th,
  .cp-excel-table tbody td {
    padding: .68rem .55rem !important;
    font-size: .86rem !important;
  }
  .cp-grid-input {
    min-width: 112px !important;
    height: 40px !important;
    font-size: .86rem !important;
    padding: .45rem .6rem !important;
  }
  .cp-grid-textarea {
    min-width: 160px !important;
  }
  .cp-excel-table .cp-col-number,
  .cp-excel-table .cp-row-number {
    width: 58px;
    min-width: 58px;
  }
}

@media (max-width: 575.98px) {
  .cp-registro-toolbar .btn {
    width: 100%;
    justify-content: center;
  }
  .cp-mobile-savebar .cp-btn-primary {
    min-height: 48px !important;
    font-size: .95rem !important;
  }
}

/* v37: Fila de nuevo registro más limpia e integrada en la tabla tipo Excel. */
.cp-registro-toolbar {
  align-items: center;
  margin-bottom: 1rem !important;
}

.cp-new-record-btn {
  border-radius: 12px !important;
  padding: .7rem 1rem !important;
  font-size: .95rem !important;
  box-shadow: 0 10px 22px rgba(15, 95, 196, .18) !important;
}

.cp-auto-meta-note {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: #53657d;
  background: #f8fbff;
  border: 1px solid #dbe5f2;
  border-radius: 12px;
  padding: .62rem .9rem;
  font-weight: 700;
  font-size: .9rem;
}

.cp-auto-meta-note i {
  color: #0f5fc4;
  font-size: 1rem;
}

.cp-excel-table thead th {
  padding: .82rem .72rem !important;
}

.cp-excel-table tbody td {
  padding: .72rem .72rem !important;
}

.cp-edit-row td {
  background: #f7fbff !important;
  border-top: 1px solid #2f75e8 !important;
  border-bottom: 1px solid #2f75e8 !important;
}

.cp-edit-row td:first-child {
  border-left: 1px solid #2f75e8 !important;
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

.cp-edit-row td:last-child {
  border-right: 1px solid #2f75e8 !important;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

.cp-grid-input {
  min-width: 118px !important;
  max-width: 180px;
  height: 40px !important;
  border-radius: 10px !important;
  font-size: .9rem !important;
  padding: .45rem .62rem !important;
}

.cp-grid-observacion {
  min-width: 220px !important;
  max-width: 340px;
}

.cp-grid-textarea {
  min-width: 180px !important;
  max-width: 320px;
  height: 40px !important;
  min-height: 40px !important;
  resize: none !important;
  overflow: hidden;
}

.cp-new-badge {
  min-width: 48px;
  min-height: 28px;
  padding: .2rem .48rem;
  border-radius: 999px;
  background: #eaf2ff;
  color: #0f5fc4;
  font-size: .76rem;
}

.cp-actions-cell {
  min-width: 138px;
  text-align: center;
}

.cp-save-row {
  min-height: 38px !important;
  padding: .45rem .78rem !important;
  font-size: .86rem !important;
  border-radius: 10px !important;
}

.cp-cancel-row {
  color: #2563eb !important;
  text-decoration: none !important;
  font-weight: 800 !important;
  padding: .45rem .55rem !important;
}

.cp-cancel-row:hover {
  text-decoration: underline !important;
}

.cp-read-row .cp-actions-cell {
  min-width: 112px;
}

@media (max-width: 991.98px) {
  .cp-auto-meta-note {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    font-size: .84rem;
    padding: .58rem .75rem;
  }

  .cp-grid-input {
    min-width: 106px !important;
    max-width: 160px;
    height: 38px !important;
    font-size: .84rem !important;
  }

  .cp-grid-observacion,
  .cp-grid-textarea {
    min-width: 165px !important;
    max-width: 240px;
  }

  .cp-actions-cell {
    min-width: 120px;
  }
}


/* Estados editables inline en listados */
.status-inline-form {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 0;
}

.status-inline-select {
  width: auto !important;
  min-width: 136px;
  max-width: 176px;
  border: 1px solid transparent !important;
  border-radius: 999px !important;
  padding: .38rem 2rem .38rem .88rem !important;
  font-size: .79rem !important;
  font-weight: 800 !important;
  line-height: 1.15 !important;
  cursor: pointer;
  box-shadow: none !important;
  text-align: center !important;
  text-align-last: center !important;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23344054' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .72rem center;
  background-size: 12px 12px;
}

.status-inline-select:hover {
  filter: brightness(.99);
}

.status-inline-select:focus {
  border-color: #9cc3ff !important;
  box-shadow: 0 0 0 .18rem rgba(13, 110, 253, .10) !important;
}

.status-inline-select option {
  background: #ffffff !important;
  color: #1f2937 !important;
  font-weight: 400 !important;
  text-align: left !important;
  padding-left: .75rem;
}

.status-inline-select.is-info {
  color: #075985 !important;
  background-color: #cffafe !important;
}

.status-inline-select.is-primary {
  color: #1d4ed8 !important;
  background-color: #dbeafe !important;
}

.status-inline-select.is-warning {
  color: #92400e !important;
  background-color: #fef3c7 !important;
}

.status-inline-select.is-success {
  color: #166534 !important;
  background-color: #dcfce7 !important;
}

.status-inline-select.is-danger {
  color: #b42318 !important;
  background-color: #fee4e2 !important;
}

.status-inline-select.is-neutral {
  color: #475467 !important;
  background-color: #f2f4f7 !important;
}

/* Preview compacto de orden cerrada en Nuevo lote */
.az-order-preview {
  border: 1px solid #dbe5f0;
  border-radius: 16px;
  background: #f8fbff;
  padding: 14px 16px;
}
.az-order-preview span {
  display: block;
  color: #607086;
  font-size: .78rem;
  font-weight: 700;
  margin-bottom: 3px;
}
.az-order-preview strong {
  color: #082b52;
  font-size: .95rem;
}


/* Ordenes de produccion: buscador de producto, info de proyecto y fechas */
.az-combo {
  position: relative;
}

.az-combo-input {
  width: 100%;
}

.az-combo-dropdown {
  display: none;
  position: absolute;
  z-index: 120;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #d7e1ef;
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
  padding: 6px;
}

.az-combo.is-open .az-combo-dropdown {
  display: block;
}

.az-combo-option {
  width: 100%;
  border: 0;
  background: #ffffff;
  color: #0f172a;
  text-align: left;
  font-weight: 400;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1.3;
}

.az-combo-option:hover,
.az-combo-option:focus {
  background: #0d6efd;
  color: #ffffff;
  outline: none;
}

.az-combo-empty {
  padding: 10px 12px;
  color: #64748b;
  font-size: .92rem;
}

.az-combo.has-error .az-combo-input {
  border-color: #dc3545;
  box-shadow: 0 0 0 .18rem rgba(220, 53, 69, .12);
}

.az-project-info-box,
.az-date-group {
  border: 1px solid #d9e6f5;
  border-radius: 1rem;
  background: #f8fbff;
  padding: 1rem;
}

.az-project-info-title,
.az-date-group-title {
  font-weight: 800;
  color: #0b2f5b;
  margin-bottom: .75rem;
}

.az-project-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem;
}

.az-project-info-grid > div {
  background: #ffffff;
  border: 1px solid #e6edf7;
  border-radius: .85rem;
  padding: .8rem .95rem;
}

.az-project-info-grid span {
  display: block;
  font-size: .82rem;
  color: #64748b;
  margin-bottom: .2rem;
}

.az-project-info-grid strong {
  color: #0f172a;
}

@media (max-width: 768px) {
  .az-project-info-grid {
    grid-template-columns: 1fr;
  }
}
